-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
181 lines (181 loc) · 5.4 KB
/
.eslintrc.cjs
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'prettier', // prettier should be the last
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'no-fallthrough': 'off',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2018,
project: 'tsconfig.check.json',
sourceType: 'module',
},
plugins: ['import', 'jsdoc', 'react', 'react-hooks', 'sort-keys-fix'],
root: true,
rules: {
// Can disagree with @typescript-eslint/member-ordering.
'@typescript-eslint/adjacent-overload-signatures': 'off',
'@typescript-eslint/explicit-module-boundary-types': [
'error',
{ allowArgumentsExplicitlyTypedAsAny: true },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ args: 'after-used', ignoreRestSiblings: true },
],
'@typescript-eslint/prefer-optional-chain': ['error'],
'array-element-newline': ['error', 'consistent'],
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error', { after: true, before: true }],
'block-spacing': ['error', 'always'],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', { after: true, before: false }],
'eol-last': ['error', 'always'],
'eqeqeq': ['error', 'smart'],
'import/order': [
'error',
{
'alphabetize': { caseInsensitive: true, order: 'asc' },
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'indent': 'off',
'jsdoc/check-access': 1,
'jsdoc/check-alignment': 1,
'jsdoc/check-param-names': 1,
'jsdoc/check-property-names': 1,
'jsdoc/check-tag-names': 1,
'jsdoc/check-types': 1,
'jsdoc/check-values': 1,
'jsdoc/empty-tags': 1,
'jsdoc/implements-on-classes': 1,
'jsdoc/multiline-blocks': 1,
'jsdoc/no-multi-asterisks': 1,
'jsdoc/require-returns-check': 1,
'jsdoc/require-yields-check': 1,
'jsdoc/tag-lines': 1,
'jsdoc/valid-types': 1,
'jsx-quotes': ['error', 'prefer-double'],
'key-spacing': [
'error',
{
multiLine: {
afterColon: true,
beforeColon: false,
mode: 'strict',
},
singleLine: {
afterColon: true,
beforeColon: false,
},
},
],
'keyword-spacing': ['error'],
'no-console': ['error', { allow: ['error'] }],
'no-constant-binary-expression': 'error',
'no-duplicate-imports': 'error',
'no-empty': ['error', { allowEmptyCatch: false }],
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-restricted-imports': ['error', { patterns: ['..*'] }],
'no-throw-literal': 'error',
'no-trailing-spaces': ['error', {}],
'no-unused-vars': 'off',
'object-curly-spacing': ['error', 'always'],
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
'quote-props': ['error', 'consistent-as-needed'],
'quotes': ['error', 'single', { avoidEscape: true }],
'react/display-name': 'off',
'react/jsx-closing-bracket-location': [
'error',
{
nonEmpty: 'after-props',
selfClosing: 'tag-aligned',
},
],
'react/jsx-closing-tag-location': ['error'],
'react/jsx-curly-spacing': ['error', { children: false, when: 'never' }],
'react/jsx-equals-spacing': ['error', 'never'],
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-indent': ['error', 2],
'react/jsx-max-props-per-line': ['error', { when: 'multiline' }],
'react/jsx-newline': ['error', { prevent: true }],
'react/jsx-sort-props': [
'error',
{
callbacksLast: true,
ignoreCase: true,
},
],
'react/jsx-tag-spacing': [
'error',
{
afterOpening: 'never',
beforeClosing: 'never',
beforeSelfClosing: 'always',
closingSlash: 'never',
},
],
'react/jsx-uses-react': 'off',
'react/jsx-wrap-multilines': ['error', { assignment: false, declaration: false }],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/self-closing-comp': [
'error',
{
component: true,
html: true,
},
],
'react-hooks/exhaustive-deps': 'error',
'require-await': 'error',
'semi': ['error', 'always'],
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
'sort-keys-fix/sort-keys-fix': [
'error',
'asc',
{
caseSensitive: false,
natural: true,
},
],
'space-in-parens': ['error', 'never'],
'space-infix-ops': ['error', { int32Hint: true }],
},
settings: {
'import/resolver': { typescript: {} }, // This loads <rootdir>/tsconfig.json to eslint
'react': { version: 'detect' },
},
};