-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
176 lines (176 loc) · 6.68 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
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: [
'react-refresh',
'unused-imports',
'no-relative-import-paths',
'eslint-plugin-simple-import-sort',
'@typescript-eslint/eslint-plugin',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
'eslint-plugin-unicorn',
'eslint-plugin-import',
],
settings: {
react: {
version: 'detect',
},
},
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/no-unused-vars': 'warn',
'unused-imports/no-unused-imports': 'warn',
'default-case-last': 'error',
eqeqeq: 'error',
'import/no-empty-named-blocks': 'warn',
'import/no-named-default': 'warn',
'import/no-useless-path-segments': 'warn',
'import/no-webpack-loader-syntax': 'error',
'no-bitwise': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-constant-binary-expression': 'error',
'no-constant-condition': 'warn',
'no-constructor-return': 'error',
'no-control-regex': 'error',
'no-debugger': 'warn',
'no-div-regex': 'error',
'no-duplicate-case': 'error',
'no-empty-character-class': 'error',
'no-empty-pattern': 'warn',
'no-ex-assign': 'warn',
'no-extra-bind': 'warn',
'no-extra-boolean-cast': 'warn',
'no-extra-label': 'warn',
'no-global-assign': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'warn',
'no-label-var': 'error',
'no-misleading-character-class': 'error',
'no-new-wrappers': 'error',
'no-plusplus': 'error',
'no-regex-spaces': 'error',
'no-restricted-globals': ['error', 'event', 'name', 'length', 'closed'],
'no-restricted-imports': [
'error',
{
patterns: ['src/maskbook/*', '@/maskbook/*'],
},
],
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': 'warn',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'warn',
'no-unused-vars': 'off',
'no-useless-backreference': 'error',
'no-useless-call': 'warn',
'no-useless-catch': 'warn',
'no-useless-concat': 'warn',
'no-useless-escape': 'warn',
'object-shorthand': 'warn',
'prefer-const': 'warn',
'prefer-numeric-literals': 'warn',
'prefer-object-has-own': 'warn',
'prefer-regex-literals': 'warn',
radix: 'warn',
'spaced-comment': ['warn', 'always', { line: { markers: ['/'] } }],
'unused-imports/no-unused-imports': 'error',
'valid-typeof': 'error',
yoda: 'warn',
'react/jsx-no-comment-textnodes': 'warn',
'react/jsx-no-leaked-render': 'error',
'react/jsx-no-script-url': 'error',
'react/no-danger': 'error',
'react/no-danger-with-children': 'error',
'react/no-namespace': 'error',
'react/no-unstable-nested-components': 'error',
'react/void-dom-elements-no-children': 'error',
'react/no-invalid-html-attribute': 'warn',
'react/jsx-key': ['warn', { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
'react/jsx-no-constructed-context-values': 'warn',
'react/no-deprecated': 'error',
'react/no-find-dom-node': 'error',
'react/jsx-boolean-value': ['error', 'never'],
'react/self-closing-comp': ['error', { component: true, html: true }],
'@typescript-eslint/ban-types': [
'error',
{
types: {
'{}': false,
FC: {
message:
"To declare a component, you don't have to use FC to annotate it. To type something that accepts/is a React Component, use ComponentType<T>.",
fixWith: 'ComponentType',
},
'React.FC': {
message:
"To declare a component, you don't have to use React.FC to annotate it. To type something that accepts/is a React Component, use React.ComponentType<T>.",
fixWith: 'React.ComponentType',
},
},
extendDefaults: true,
},
],
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/consistent-type-assertions': ['warn', { assertionStyle: 'as' }],
'@typescript-eslint/dot-notation': 'warn',
'@typescript-eslint/no-array-constructor': 'warn',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'warn',
'@typescript-eslint/no-for-in-array': 'warn',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-loop-func': 'warn',
'@typescript-eslint/no-loss-of-precision': 'error',
'@typescript-eslint/no-meaningless-void-operator': 'warn',
'@typescript-eslint/no-mixed-enums': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/prefer-as-const': 'warn',
'@typescript-eslint/prefer-enum-initializers': 'warn',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-includes': 'warn',
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
'@typescript-eslint/prefer-return-this-type': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/no-misused-new': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'no-relative-import-paths/no-relative-import-paths': [
'warn',
{
prefix: '@',
rootDir: 'src',
},
],
},
parserOptions: {
ecmaVersion: 'latest',
project: './tsconfig.eslint.json',
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true,
},
}