Skip to content

Commit b77b646

Browse files
TCA-499 #comment This commit merges branch 'eslint-prettier' into TCA-499_eslint
2 parents c63b1ce + 0051c67 commit b77b646

File tree

5 files changed

+2126
-55
lines changed

5 files changed

+2126
-55
lines changed

package.json

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
"start": "sh start-ssl.sh",
88
"start:brooke": "sudo sh start-ssl-brooke.sh",
99
"build": "yarn react-app-rewired build",
10-
"lint": "tslint 'src-ts/**/*.{ts,tsx}' && eslint 'src*/**/*.{js,jsx,ts,tsx}'",
11-
"lint:fix": "tslint 'src-ts/**/*.{ts,tsx}' --fix && eslint 'src*/**/*.{js,jsx,ts,tsx}' --fix",
12-
"tslint": "tslint 'src-ts/**/*.{ts,tsx}'",
13-
"tslint:fix": "tslint 'src-ts/**/*.{ts,tsx}' --fix",
14-
"eslint": "eslint 'src/**/*.{js,jsx}'",
15-
"eslint:fix": "eslint 'src/**/*.{js,jsx}' --fix",
10+
"lint:ts": "eslint -c ./src-ts/.eslintrc.js 'src-ts/**/*.{ts,tsx}'",
11+
"lint:ts:fix": "eslint -c ./src-ts/.eslintrc.js 'src-ts/**/*.{ts,tsx}' --fix",
12+
"lint:js": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}'",
13+
"lint:js:fix": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}' --fix",
14+
"lint": "npm run lint:js && npm run lint:ts",
15+
"lint:fix": "npm run lint:js:fix && npm run lint:ts:fix",
16+
"prettier": "prettier ./src-ts/**/*.{ts,tsx} --check",
17+
"prettier:fix": "prettier ./src-ts/**/*.{ts,tsx} --write",
18+
"format:all": "npm run prettier:fix && npm run lint:fix",
1619
"test": "react-scripts test --watchAll",
1720
"test:no-watch": "react-scripts test --watchAll=false --passWithNoTests",
1821
"cy:run": "cypress run --reporter junit",
@@ -102,6 +105,8 @@
102105
"@types/segment-analytics": "^0.0.34",
103106
"@types/systemjs": "^6.1.1",
104107
"@types/uuid": "^8.3.4",
108+
"@typescript-eslint/eslint-plugin": "^5.30.6",
109+
"@typescript-eslint/parser": "^5.30.6",
105110
"@wdio/junit-reporter": "^7.25.1",
106111
"autoprefixer": "^10.4.12",
107112
"babel-eslint": "^11.0.0-beta.2",
@@ -114,11 +119,17 @@
114119
"cross-env": "^7.0.3",
115120
"cypress": "^10.10.0",
116121
"eslint": "^8.25.0",
122+
"eslint-config-airbnb": "^19.0.4",
117123
"eslint-config-prettier": "^8.5.0",
118124
"eslint-config-react-app": "^7.0.1",
119125
"eslint-config-react-important-stuff": "^3.0.0",
126+
"eslint-import-resolver-typescript": "^3.2.5",
120127
"eslint-plugin-cypress": "^2.12.1",
128+
"eslint-plugin-import": "^2.25.3",
129+
"eslint-plugin-jsx-a11y": "^6.5.1",
121130
"eslint-plugin-prettier": "^4.2.1",
131+
"eslint-plugin-react": "^7.28.0",
132+
"eslint-plugin-react-hooks": "^4.3.0",
122133
"file-loader": "^6.2.0",
123134
"husky": "^8.0.1",
124135
"identity-obj-proxy": "^3.0.0",
@@ -127,8 +138,8 @@
127138
"jest-cli": "^29.2.0",
128139
"lint-staged": "^13.0.3",
129140
"nyc": "^15.1.0",
130-
"postcss-loader": "^7.0.1",
131-
"postcss-scss": "^4.0.5",
141+
"postcss-loader": "^4.0.4",
142+
"postcss-scss": "^3.0.2",
132143
"prettier": "^2.7.1",
133144
"pretty-quick": "^3.1.3",
134145
"resolve-url-loader": "^5.0.0",
@@ -138,6 +149,7 @@
138149
"style-loader": "^3.3.1",
139150
"systemjs-webpack-interop": "^2.3.7",
140151
"tslint": "^6.1.3",
152+
"webpack": "^4.41.2",
141153
"webpack-cli": "^4.10.0",
142154
"webpack-config-single-spa-react": "^4.0.3",
143155
"webpack-dev-server": "^4.11.1",

src-ts/.eslintrc.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
},
7+
extends: [
8+
'plugin:react/recommended',
9+
'airbnb',
10+
'plugin:@typescript-eslint/recommended',
11+
'prettier'
12+
],
13+
parser: '@typescript-eslint/parser',
14+
parserOptions: {
15+
useJSXTextNode: true,
16+
project: "./tsconfig.json",
17+
tsconfigRootDir: ".",
18+
tsx: true,
19+
jsx: true,
20+
sourceType: 'module',
21+
},
22+
plugins: [
23+
'react',
24+
'@typescript-eslint',
25+
'react-hooks',
26+
],
27+
settings: {
28+
react: {
29+
"version": "detect"
30+
},
31+
"import/resolver": {
32+
typescript: {},
33+
}
34+
},
35+
rules: {
36+
'@typescript-eslint/explicit-function-return-type': 'off',
37+
'@typescript-eslint/no-inferrable-types': 'off',
38+
'@typescript-eslint/no-shadow': 'error',
39+
'import/extensions': 'off',
40+
'import/prefer-default-export': 'off',
41+
'indent': [
42+
2,
43+
4,
44+
{
45+
SwitchCase: 1,
46+
},
47+
],
48+
'no-shadow': 'off',
49+
'no-use-before-define': [
50+
'error',
51+
{ functions: false }
52+
],
53+
'padded-blocks': [
54+
'error',
55+
{ }
56+
],
57+
'react-hooks/exhaustive-deps': 'warn',
58+
'react-hooks/rules-of-hooks': 'error',
59+
'react/function-component-definition': [
60+
2,
61+
{
62+
namedComponents: 'arrow-function'
63+
}
64+
],
65+
'react/jsx-filename-extension': [
66+
1,
67+
{
68+
extensions: [
69+
'.tsx',
70+
'.jsx',
71+
]
72+
},
73+
],
74+
'react/jsx-indent-props': [
75+
2,
76+
4,
77+
],
78+
'react/jsx-indent': [
79+
2,
80+
4,
81+
],
82+
'react/jsx-props-no-spreading': [
83+
2,
84+
{ html: 'ignore' },
85+
],
86+
'react/react-in-jsx-scope': 'off',
87+
'react/require-default-props': 'off',
88+
'semi': [
89+
'error',
90+
'never',
91+
],
92+
},
93+
};

src-ts/.prettierrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSpacing: true,
4+
jsxSingleQuote: true,
5+
printWidth: 100,
6+
semi: false,
7+
singleQuote: true,
8+
trailingComma: 'all',
9+
}

src/.eslintrc.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
jest: true,
7+
},
8+
extends: [
9+
'react-app',
10+
'react-app/jest',
11+
],
12+
parserOptions: {
13+
useJSXTextNode: true,
14+
jsx: true,
15+
sourceType: 'module',
16+
},
17+
plugins: [
18+
'react',
19+
],
20+
settings: {
21+
react: {
22+
version: 'detect',
23+
},
24+
},
25+
rules: {
26+
'no-useless-escape': 0,
27+
},
28+
}

0 commit comments

Comments
 (0)