-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
163 lines (163 loc) · 4.22 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
module.exports = {
root: true,
globals: {
JSX: 'readonly',
},
env: {
node: true,
browser: true,
es2021: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 6,
ecmaFeatures: {
jsx: true,
modules: true,
},
},
plugins: ['react', 'react-hooks', 'import'],
extends: [
'airbnb',
'airbnb/hooks',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
indent: ['error', 2, { SwitchCase: 1 }],
requireSemicolons: 'off',
'global-require': 'warn',
'arrow-body-style': 'off',
'vars-on-top': 'error',
'prefer-arrow-callback': 'warn',
strict: 'warn',
'no-var': 'warn',
'no-console': 'off',
'prefer-template': 'error',
'spaced-comment': 'error',
'max-len': 'off',
'arrow-parens': 'off',
quotes: 'error',
'no-param-reassign': 'off',
'no-undef': 'warn',
'consistent-return': 'off',
'no-unused-vars': 'warn',
'no-use-before-define': 'off',
'comma-dangle': 'error',
camelcase: 'off',
'no-mixed-operators': [
'error',
{
groups: [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
'object-shorthand': 'warn',
'no-multiple-empty-lines': 'error',
'no-underscore-dangle': 'error',
'func-names': 'off',
'prefer-const': 'error',
'padded-blocks': 'error',
'no-trailing-spaces': 'error',
'no-shadow': 'warn',
'object-curly-spacing': 'error',
'array-callback-return': 'error',
'quote-props': 'error',
'eol-last': 'error',
eqeqeq: 'warn',
'generator-star-spacing': 'error',
'function-paren-newline': 'error',
'no-restricted-syntax': 'error',
'class-methods-use-this': 'error',
'no-plusplus': 'warn',
'object-curly-newline': 'warn',
'no-return-assign': 'warn',
'prefer-destructuring': 'warn',
'no-lonely-if': 'warn',
'no-loop-func': 'warn',
'no-nested-ternary': 'warn',
'no-else-return': 'warn',
'no-empty': ['error', { allowEmptyCatch: true }],
'react/display-name': 'off',
'react/prop-types': 'off',
'react/jsx-no-bind': 'warn',
'react/no-array-index-key': 'warn',
'react/no-unused-state': 'warn',
'react/no-multi-comp': 'warn',
'react/jsx-closing-bracket-location': 'warn',
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/no-string-refs': 'warn',
'react/forbid-prop-types': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/method-signature-style': 'warn',
'import/prefer-default-export': 'off',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'never',
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
},
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
camelcase: 'warn',
},
},
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {},
'babel-module': {},
node: {
extensions: ['.js', '.ts', '.tsx'],
},
},
},
ignorePatterns: [
'node_modules',
'gatsby-*.js',
'.eslintrc.js',
],
};