-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
76 lines (76 loc) · 1.93 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module.exports = {
env: {
node: true,
es6: true,
browser: true
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
requireConfigFile: false,
ecmaFeatures: {
jsx: true,
modules: true,
experimentalObjectRestSpread: true
},
babelOptions: {
presets: ['@babel/preset-react']
}
},
plugins: ['prettier', 'import'],
extends: ['eslint:recommended', 'prettier', 'plugin:import/recommended', 'react-app'],
root: true,
rules: {
semi: [2, 'always', {omitLastInOneLineBlock: true}],
'space-before-function-paren': 'off',
// 'no-unused-vars': 2,
'react/no-did-update-set-state': ['off'],
'react/jsx-uses-vars': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-key': 'error',
'react/prop-types': 'warn',
'no-use-before-define': ['error', {functions: false}],
'react/jsx-first-prop-new-line': [1, 'multiline'],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'no-console': ['warn'],
'comma-dangle': ['warn', 'never'],
eqeqeq: [2, 'always'],
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
alphabetize: {
order: 'asc'
},
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before'
}
],
pathGroupsExcludedImportTypes: ['builtin']
}
]
},
// new settings to allow .jsx imports
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
moduleDirectory: ['node_modules', 'src/']
}
}
}
// old settings restricting imports to .js only
// settings: {
// 'import/extensions': ['.js'],
// 'import/resolver': {
// node: {
// moduleDirectory: ['node_modules', 'src/']
// }
// }
// }
};