Skip to content

Commit 0db8843

Browse files
committed
adding eslint
1 parent 9f5018b commit 0db8843

10 files changed

+285
-44
lines changed

.eslintrc.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"plugin:react/recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"airbnb",
10+
"plugin:prettier/recommended"
11+
],
12+
"parser": "@typescript-eslint/parser",
13+
"parserOptions": {
14+
"ecmaFeatures": {
15+
"jsx": true
16+
},
17+
"ecmaVersion": 12,
18+
"sourceType": "module"
19+
},
20+
"settings": {
21+
"react": {
22+
"version": "detect"
23+
},
24+
"import/resolver": {
25+
"node": {
26+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
27+
}
28+
}
29+
},
30+
"plugins": ["react", "@typescript-eslint"],
31+
"rules": {
32+
"import/prefer-default-export": "off",
33+
"react/react-in-jsx-scope": "off",
34+
"react/jsx-filename-extension": "off",
35+
"no-undef": "off",
36+
"no-use-before-define": "off",
37+
"@typescript-eslint/no-use-before-define": ["error"],
38+
"import/extensions": [
39+
"error",
40+
"ignorePackages",
41+
{
42+
"js": "never",
43+
"jsx": "never",
44+
"ts": "never",
45+
"tsx": "never"
46+
}
47+
]
48+
}
49+
}

.prettierrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 2
7+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": true
4+
},
5+
}

package.json

+20-6
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,44 @@
1414
"author": "MrNovado <novado@ymail.com>",
1515
"license": "MIT",
1616
"dependencies": {
17+
"@testing-library/jest-dom": "^5.11.4",
18+
"@testing-library/react": "^11.1.0",
19+
"@testing-library/user-event": "^12.1.10",
1720
"@xstate/inspect": "^0.4.1",
1821
"@xstate/react": "^1.3.1",
1922
"@xstate/test": "^0.4.2",
2023
"react": "^17.0.1",
2124
"react-dom": "^17.0.1",
2225
"react-scripts": "4.0.3",
23-
"typescript": "^4.1.2",
26+
"typescript": "4.1.2",
2427
"web-vitals": "^1.0.1",
2528
"xstate": "^4.16.2"
2629
},
2730
"devDependencies": {
28-
"@testing-library/jest-dom": "^5.11.4",
29-
"@testing-library/react": "^11.1.0",
30-
"@testing-library/user-event": "^12.1.10",
3131
"@types/jest": "^26.0.15",
3232
"@types/node": "^12.0.0",
3333
"@types/react": "^17.0.0",
34-
"@types/react-dom": "^17.0.0"
34+
"@types/react-dom": "^17.0.0",
35+
"@typescript-eslint/eslint-plugin": "^4.15.2",
36+
"@typescript-eslint/parser": "^4.15.2",
37+
"eslint": "^7.21.0",
38+
"eslint-config-airbnb": "^18.2.1",
39+
"eslint-config-prettier": "^8.1.0",
40+
"eslint-plugin-import": "^2.22.1",
41+
"eslint-plugin-jsx-a11y": "^6.4.1",
42+
"eslint-plugin-prettier": "^3.3.1",
43+
"eslint-plugin-react": "^7.22.0",
44+
"eslint-plugin-react-hooks": "^4.2.0",
45+
"prettier": "^2.2.1",
46+
"prettier-eslint": "^12.0.0"
3547
},
3648
"scripts": {
3749
"start": "react-scripts start",
3850
"build": "react-scripts build",
3951
"test": "react-scripts test",
40-
"eject": "react-scripts eject"
52+
"qa": "yarn run qa:types && yarn run qa:lint",
53+
"qa:types": "tsc --noEmit",
54+
"qa:lint": "eslint --ext js,ts,tsx ./src --quiet --fix"
4155
},
4256
"eslintConfig": {
4357
"extends": [

src/app-container/App.test.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from "react";
2-
import { render, screen } from "@testing-library/react";
1+
import { render, screen } from '@testing-library/react';
32

4-
import { App } from "./App";
3+
import { App } from './App';
54

6-
test("renders learn react link", () => {
5+
test('renders learn react link', () => {
76
render(<App />);
87
const linkElement = screen.getByText(/learn react/i);
98
expect(linkElement).toBeInTheDocument();

src/app-container/App.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import "./App.css";
1+
import './App.css';
22

3-
export const App = () => {
4-
return <div className="App"></div>;
5-
};
3+
export const App = (): JSX.Element => <div className="App" />;

src/app-container/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { App } from "./App";
1+
export { App } from './App';

src/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
33

4-
import "./index.css";
5-
import reportWebVitals from "./reportWebVitals";
4+
import './index.css';
5+
import reportWebVitals from './reportWebVitals';
66

7-
import { App } from "./app-container";
7+
import { App } from './app-container';
88

99
ReactDOM.render(
1010
<React.StrictMode>
1111
<App />
1212
</React.StrictMode>,
13-
document.getElementById("root")
13+
document.getElementById('root'),
1414
);
1515

1616
// If you want to start measuring performance in your app, pass a function

src/pages/TicTacToePage.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const TicTacToePage = () => {
2-
return <div>TicTacToePage</div>;
3-
};
1+
export const TicTacToePage = () => <div>TicTacToePage</div>;

0 commit comments

Comments
 (0)