Skip to content

Commit d694869

Browse files
committed
Code Formatting: eslint and prettier applied
1 parent 6e15a68 commit d694869

File tree

7 files changed

+679
-177
lines changed

7 files changed

+679
-177
lines changed

.eslintrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 2020,
5+
"sourceType": "module",
6+
"ecmaFeatures": {
7+
"jsx": true
8+
}
9+
},
10+
"settings": {
11+
"react": {
12+
"version": "detect"
13+
}
14+
},
15+
"extends": [
16+
"plugin:react/recommended",
17+
"plugin:@typescript-eslint/recommended",
18+
"prettier/@typescript-eslint",
19+
"plugin:prettier/recommended"
20+
],
21+
"rules": {
22+
"quotes": ["error", "double"],
23+
// Indent with 4 spaces
24+
"indent": ["error", "tab"],
25+
// Indent JSX with 4 spaces
26+
"react/jsx-indent": ["error", "tab"],
27+
// Indent props with 4 spaces
28+
"react/jsx-indent-props": ["error", "tab"],
29+
"prettier/prettier": [
30+
"error",
31+
{
32+
"endOfLine": "auto"
33+
}
34+
]
35+
}
36+
}

package.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"build": "react-dotenv && react-scripts build",
88
"test": "react-scripts test",
99
"eject": "react-scripts eject",
10+
"lint:fix": "eslint src/*.ts --fix",
11+
"lint": "eslint src/*.ts",
12+
"test-lint": "lint-staged",
13+
"prettify": "prettier src/*.ts --write",
1014
"storybook": "start-storybook -p 6006",
1115
"build-storybook": "build-storybook"
1216
},
@@ -48,6 +52,29 @@
4852
"@storybook/addon-actions": "^6.1.15",
4953
"@storybook/addon-essentials": "^6.1.15",
5054
"@storybook/addon-links": "^6.1.15",
51-
"@storybook/react": "^6.1.15"
55+
"@storybook/react": "^6.1.15",
56+
"@typescript-eslint/eslint-plugin": "^4.14.1",
57+
"@typescript-eslint/parser": "^4.14.1",
58+
"eslint": "^7.18.0",
59+
"eslint-config-prettier": "^7.2.0",
60+
"eslint-plugin-prettier": "^3.3.1",
61+
"eslint-plugin-react": "^7.22.0",
62+
"prettier": "^2.2.1",
63+
"husky": "^4.3.8",
64+
"lint-staged": "^10.5.3"
65+
},
66+
"husky": {
67+
"hooks": {
68+
"pre-commit": "lint-staged"
69+
}
70+
},
71+
"lint-staged": {
72+
"*.(js|html|css|scss|json)": [
73+
"prettier --write"
74+
],
75+
".(js|ts)": [
76+
"yarn lint:fix",
77+
"yarn lint"
78+
]
5279
}
5380
}

public/env.js

Lines changed: 156 additions & 131 deletions
Large diffs are not rendered by default.

src/reportWebVitals.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import { ReportHandler } from 'web-vitals';
1+
import { ReportHandler } from "web-vitals";
22

3-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4-
if (onPerfEntry && onPerfEntry instanceof Function) {
5-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6-
getCLS(onPerfEntry);
7-
getFID(onPerfEntry);
8-
getFCP(onPerfEntry);
9-
getLCP(onPerfEntry);
10-
getTTFB(onPerfEntry);
11-
});
12-
}
3+
const reportWebVitals = (onPerfEntry?: ReportHandler): void => {
4+
if (onPerfEntry && onPerfEntry instanceof Function) {
5+
import("web-vitals").then(
6+
({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
7+
getCLS(onPerfEntry);
8+
getFID(onPerfEntry);
9+
getFCP(onPerfEntry);
10+
getLCP(onPerfEntry);
11+
getTTFB(onPerfEntry);
12+
}
13+
);
14+
}
1315
};
1416

1517
export default reportWebVitals;

src/setupTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// allows you to do things like:
33
// expect(element).toHaveTextContent(/react/i)
44
// learn more: https://github.com/testing-library/jest-dom
5-
import '@testing-library/jest-dom';
5+
import "@testing-library/jest-dom";

tsconfig.json

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
{
2-
"compilerOptions": {
3-
"target": "es5",
4-
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
8-
],
9-
"allowJs": true,
10-
"skipLibCheck": true,
11-
"esModuleInterop": true,
12-
"allowSyntheticDefaultImports": true,
13-
"strict": true,
14-
"forceConsistentCasingInFileNames": true,
15-
"noFallthroughCasesInSwitch": true,
16-
"module": "esnext",
17-
"moduleResolution": "node",
18-
"resolveJsonModule": true,
19-
"isolatedModules": true,
20-
"noEmit": true,
21-
"jsx": "react-jsx"
22-
},
23-
"include": [
24-
"src"
25-
]
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"allowSyntheticDefaultImports": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"module": "esnext",
13+
"moduleResolution": "node",
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"noEmit": true,
17+
"jsx": "react-jsx"
18+
},
19+
"include": ["src"],
20+
"exclude": ["node_modules", "build"]
2621
}

0 commit comments

Comments
 (0)