-
Notifications
You must be signed in to change notification settings - Fork 79
/
.eslintrc.js
89 lines (88 loc) · 2.7 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
77
78
79
80
81
82
83
84
85
86
87
88
89
// const { off } = require('process');
module.exports = {
env: {
es2020: true,
node: true,
browser: true,
},
root: true,
// prettier should be last
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
// 'plugin:react/app',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
localStorage: true,
fetch: true,
window: true,
sessionStorage: true,
alert: true,
document: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
globalReturn: false,
},
ecmaVersion: 2020,
sourceType: 'module',
babelOptions: {
configFile: './babel.config.json',
},
},
plugins: ['react-hooks', 'react'],
settings: {
react: {
version: 'detect',
},
},
rules: {
// default rules
'no-console': 'off',
'no-unused-vars': ['warn', { "varsIgnorePattern": "^_" }], // change to 'error' 🙏
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'no-param-reassign': 'off', // priority 1, easy
'no-shadow': 'off', // priority 1, med
'no-nested-ternary': 'off', // priority 2, med
'no-restricted-globals': 'off', // priority 1, med
'no-restricted-syntax': 'off', // priority 2, harder
'arrow-body-style': 'off',
'guard-for-in': 'off', // priority 2, two instances
'max-len': 'off',
'no-unsafe-optional-chaining': 'off',
'no-return-assign': 'off', // priority 1, easy
'consistent-return': 'off', // priority 2, harder basically all the services
radix: 'off', // priority 1, parseInt ??
'no-unused-expressions': 'off', // priority 2, formatPeriods() conditional appends
// import rules
'import/prefer-default-export': 'off', // priority 2, med
'import/no-named-as-default': 'off', // priority 1, easy
'import/no-extraneous-dependencies': 'off', // priority 1, harder
'import/no-cycle': 'off', // priority 2, harder in contexts
// react rules
'react/prop-types': 'off', // can stay off
'react/jsx-props-no-spreading': 'off', // priority 3, hard
'react/no-array-index-key': 'off', // priority 1, easy-ish
'react/jsx-wrap-multilines': 'off', // priority 3, conflicting with prettier formatting only
'react/jsx-one-expression-per-line': 'off',
'react/jsx-curly-newline': 'off', // priority 2, harder conflicting with prettier
'react/display-name': 'off',
'react/destructuring-assignment': 'off',
'jsx-quotes': ['error', 'prefer-single'], // leave
'prettier/prettier': 'error',
},
overrides: [
{
files: ['**/*.stories.*'],
rules: {
'import/no-anonymous-default-export': 'off',
},
},
],
};