-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
217 lines (217 loc) · 6.38 KB
/
.eslintrc.json
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
{
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["html", "@html-eslint"],
"overrides": [
{
"files": ["*.html"],
"parser": "@html-eslint/parser",
"extends": ["plugin:@html-eslint/recommended"],
"rules": {
"@html-eslint/indent": ["error", "tab"],
"@html-eslint/require-closing-tags": "off",
"@html-eslint/no-extra-spacing-attrs": "off"
}
}
],
"rules": {
"no-div-regex": "error",
"for-direction": "error",
"camelcase": "error",
"no-mixed-spaces-and-tabs": "off",
"no-const-assign": "error",
"no-case-declarations": "off",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-control-regex": "off",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-func-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-sparse-arrays": "error",
"no-unreachable-loop": "error",
"no-unsafe-negation": "error",
"no-unsafe-finally": "error",
"block-scoped-var": "error",
"no-unused-expressions": [
"error",
{
/**
* Short circuits are expressions that use the guard operator or the or operator. E.g.,
*
* condition && f();
*
* This is basically shorthand for:
*
* if (condition) f();
*/
"allowShortCircuit": true,
"allowTernary": true
}
],
"no-unused-labels": "error",
"use-isnan": "error",
"eqeqeq": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-eq-null": "error",
/**
* Empty catch blocks in try-catch statements are allowed.
*/
"no-empty": ["error", {"allowEmptyCatch": true}],
"array-callback-return": "error",
"constructor-super": "error",
"getter-return": "error",
"no-class-assign": "error",
"no-useless-computed-key": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-label-var": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-ex-assign": "error",
"no-fallthrough": "error",
"no-import-assign": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-new-symbol": "error",
"no-obj-calls": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
"no-prototype-builtins": "error",
"no-undef": "error",
"no-multi-str": "error",
"no-nested-ternary": "off",
/**
* This option may conflict with prettier. You can just disable it for that line or refactor your code.
*
* More info: https://github.com/prettier/eslint-config-prettier#no-unexpected-multiline
*/
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-optional-chaining": "error",
"valid-typeof": "error",
"default-case-last": "error",
"dot-notation": "error",
"func-name-matching": "error",
"func-style": "error",
"new-cap": "error",
"no-array-constructor": "error",
"no-return-assign": "error",
"no-sequences": "error",
"grouped-accessor-pairs": "error",
"no-bitwise": "error",
"no-else-return": "error",
"no-extra-boolean-cast": "error",
"no-extra-label": "error",
"no-global-assign": "error",
"no-invalid-this": "error",
"no-lone-blocks": "error",
"no-inner-declarations": "error",
/**
* eslint-config-prettier says that this option may conflict with prettier, but from my testing it seems fine.
*
* More info: https://github.com/prettier/eslint-config-prettier#no-mixed-operators
*/
"no-mixed-operators": [
"error",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": true
}
],
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-throw-literal": "error",
"no-this-before-super": "error",
"no-useless-call": "error",
"no-unmodified-loop-condition": "error",
"no-undef-init": "error",
"no-unneeded-ternary": "error",
"no-useless-catch": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-void": "error",
"operator-assignment": "error",
"prefer-arrow-callback": "error",
"prefer-object-spread": "error",
"prefer-regex-literals": "error",
"prefer-spread": "error",
"prefer-template": "error",
"accessor-pairs": "error",
"object-shorthand": "error",
"prefer-numeric-literals": "error",
"sort-imports": "error",
"sort-vars": "error",
"vars-on-top": "error",
"padding-line-between-statements": "error",
/**
* This rule may sometimes "conflict" with prettier, however it is easy to fix.
* For example prettier may find that an if statement followed by a function call is too long for a single line.
*
* if (someReallyLongConditionHere) aReallyLongFunctionNameHere();
*
* It would format it to be like this:
*
* if (someReallyLongConditionHere)
* aReallyLongFunctionNameHere();
*
* ESLint would find issues with this, but it can be prevented simply by adding curly brackets.
*
* if (someReallyLongConditionHere) {
* aReallyLongFunctionNameHere();
* }
*
* More info: https://github.com/prettier/eslint-config-prettier#curly
*/
"curly": ["error", "multi-line"],
/**
* Inline comments can't be longer than 80 characters.
*/
"no-inline-comments": ["error", {"ignorePattern": "^[\\s\\S]{0,60}$"}],
"handle-callback-err": "off",
"max-nested-callbacks": ["error", {"max": 4}],
"max-statements-per-line": ["error", {"max": 2}],
"no-console": "off",
"no-empty-function": "error",
"no-lonely-if": "error",
"no-var": "error",
"prefer-const": "error",
"spaced-comment": "error",
"yoda": "error",
"no-shadow": "error",
/**
* Specifically *variables* are ignored, as ESLint fails to recognise when, for example, they are used in a HTML event.
*
* This rules behaves as expected for other things, for example function parameters.
*/
"no-unused-vars": ["error", {"varsIgnorePattern": "."}],
"no-use-before-define": "error"
}
}