-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
.eslintrc.json
356 lines (356 loc) · 14.5 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"plugins": [
"@typescript-eslint",
"compat",
"import",
"jsdoc",
"prettier",
"tsdoc",
"unicorn",
"regexp",
"vue"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:compat/recommended",
"plugin:import/typescript",
"plugin:jsdoc/recommended",
"plugin:regexp/recommended",
"plugin:vue/essential",
"prettier"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"process": "readonly",
"__dirname": "readonly",
"PREFIX": "readonly",
"MODE": "readonly",
"VERSION": "readonly",
"BRANCH": "readonly",
"LOADSCRIPT_EVENT_START": "readonly",
"LOADSCRIPT_EVENT_END": "readonly"
},
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": 2018,
"sourceType": "module",
"project": [
"./tsconfig.json",
"./build/tsconfig.json",
"./docs/.vuepress/tsconfig.json",
"./prebuild/tsconfig.json",
"./scripts/tsconfig.json",
"./src/tsconfig.userscript.json"
],
"extraFileExtensions": [".vue"]
},
"settings": {
"jsdoc": {
"mode": "typescript"
}
},
"rules": {
"@typescript-eslint/array-type": ["error"],
"@typescript-eslint/consistent-indexed-object-style": [ "error", "record"],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/consistent-type-imports": ["error"],
"@typescript-eslint/method-signature-style": ["error", "method"],
"@typescript-eslint/no-duplicate-enum-values": ["off"],
"@typescript-eslint/sort-type-constituents": ["error"],
"array-callback-return": ["error"],
"block-scoped-var": "warn",
"curly": ["error", "multi-or-nest", "consistent"],
"default-case-last": "error",
"guard-for-in": "error",
"import/order": ["error", {
"groups": [
["builtin"],
["external"],
["internal"],
["parent", "sibling"],
["index"],
["object"],
["type"]
],
"pathGroups": [
{
"pattern": "vue",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["vue"],
"newlines-between": "always"
}],
"jsdoc/check-syntax": ["error"],
"jsdoc/check-tag-names": ["error", {
"definedTags": ["alpha", "beta"]
}],
"jsdoc/no-types": ["error"],
"jsdoc/require-asterisk-prefix": ["error"],
"jsdoc/require-description": ["error"],
"jsdoc/require-description-complete-sentence": ["error"],
// TODO: add a @file JSDoc to all files and then enable this rule
// "jsdoc/require-file-overview": ["error"],
"jsdoc/require-hyphen-before-param-description": ["error"],
"jsdoc/require-param-type": ["off"],
"jsdoc/require-returns-type": ["off"],
"no-constant-binary-expression": "error",
"no-duplicate-imports": ["error", { "includeExports": true }],
"no-eval": "error",
"no-floating-decimal": "warn",
"no-implicit-coercion": ["error", {
"allow": ["!!"]
}],
"no-loop-func": "error",
"no-loss-of-precision": "error",
// "no-magic-numbers": ["warn", {
// "ignoreArrayIndexes": true,
// "ignoreDefaultValues": true,
// "enforceConst": true
// }],
"no-multi-str": "warn",
"no-new-native-nonconstructor": "error",
"no-param-reassign": "error",
"no-prototype-builtins": "off",
"no-self-compare": "error",
"no-sequences": "error",
"no-template-curly-in-string": "warn",
"no-unmodified-loop-condition": "error",
"no-unreachable-loop": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-expressions": "error",
"no-useless-concat": "warn",
"no-useless-rename": "error",
"no-useless-return": "warn",
"no-var": "error",
"object-shorthand": ["error", "always", { "avoidQuotes": true }],
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-regex-literals": ["error", {
"disallowRedundantWrapping": true
}],
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"prettier/prettier": "error",
"regexp/hexadecimal-escape": ["error", "never"],
"regexp/letter-case": ["error"],
"regexp/no-control-character": ["error"],
"regexp/no-empty-character-class": ["error"],
"regexp/no-extra-lookaround-assertions": ["error"],
"regexp/no-misleading-unicode-character": ["error"],
"regexp/no-missing-g-flag": ["error"],
"regexp/no-octal": ["error"],
"regexp/no-standalone-backslash": ["error"],
"regexp/prefer-escape-replacement-dollar-char": ["error"],
"regexp/prefer-lookaround": ["error"],
"regexp/prefer-named-backreference": ["error"],
"regexp/prefer-named-replacement": ["error"],
// "regexp/prefer-quantifier": ["error"], // Waiting for the option to enable for > 3 repetitions,
"regexp/prefer-result-array-groups": ["error"],
"regexp/prefer-regexp-test": ["error"],
"regexp/require-unicode-regexp": ["error"],
"regexp/sort-alternatives": ["error"],
"regexp/sort-character-class-elements": ["error"],
"regexp/unicode-escape": ["error", "unicodeEscape"],
"regexp/use-ignore-case": ["error"],
"semi": ["error", "always"],
"sort-imports": ["warn", {
"allowSeparatedGroups": true,
"ignoreCase": true,
"memberSyntaxSortOrder": ["none", "all", "single", "multiple"]
}],
"template-curly-spacing": "error",
"tsdoc/syntax": "warn",
"unicorn/consistent-destructuring": ["error"],
"unicorn/no-array-push-push": ["error"],
"unicorn/no-for-loop": ["error"],
"unicorn/no-unnecessary-await": ["error"],
"unicorn/no-unreadable-iife": ["error"],
"unicorn/no-useless-switch-case": ["error"],
"unicorn/no-zero-fractions": ["error"],
"unicorn/numeric-separators-style": ["error"],
"unicorn/prefer-add-event-listener": ["error"],
"unicorn/prefer-array-index-of": ["error"],
"unicorn/prefer-array-find": ["error", {"checkFromLast": true}],
"unicorn/prefer-array-flat": ["error"],
"unicorn/prefer-array-flat-map": ["error"],
"unicorn/prefer-array-some": ["error"],
"unicorn/prefer-at": ["error"],
"unicorn/prefer-dom-node-append": ["error"],
"unicorn/prefer-dom-node-remove": ["error"],
"unicorn/prefer-dom-node-text-content": ["error"],
"unicorn/prefer-keyboard-event-key": ["error"],
"unicorn/prefer-modern-dom-apis": ["error"],
"unicorn/prefer-modern-math-apis": ["error"],
"unicorn/prefer-native-coercion-functions": ["error"],
"unicorn/prefer-negative-index": ["error"],
"unicorn/prefer-object-from-entries": ["error"],
"unicorn/prefer-query-selector": ["off"],
"unicorn/switch-case-braces": ["error", "avoid"],
"vue/no-unused-refs": "warn",
"vue/prefer-true-attribute-shorthand": "warn",
"yoda": ["error", "never", {
"exceptRange": true
}]
},
"overrides": [
{
"files": ["./src/**/*"],
"rules": {
"no-console": "warn"
}
},
{
"files": ["*.md"],
"plugins": ["markdownlint"],
"parser": "eslint-plugin-markdownlint/parser",
// We will set all non-deprecated markdownlint rules explicitly to avoid unwanted behaviour
"rules": {
// Turn off prettier for markdown files as we cannot configure it enough
"prettier/prettier": ["off"],
// Heading levels should only increment by one level at a time
"markdownlint/md001": ["error"],
// Heading style
"markdownlint/md003": ["error", {
"style": "atx"
}],
// Unordered list style
"markdownlint/md004": ["error", {
"style": "asterisk"
}],
// Inconsistent indentation for list items at the same level
"markdownlint/md005": ["error"],
// Unordered list indentation
"markdownlint/md007": ["error", {
"indent": 4
}],
// Trailing spaces
"markdownlint/md009": ["error"],
// Hard tabs
"markdownlint/md010": ["error", {
"spaces_per_tab": 4
}],
// Reversed link syntax
"markdownlint/md011": ["error"],
// Multiple consecutive blank lines
"markdownlint/md012": ["error"],
// Line length
// "markdownlint/md013": ["error", {
// "line_length": 120
// }],
// Dollar signs used before commands without showing output
"markdownlint/md014": ["error"],
// No space after hash on atx style heading
"markdownlint/md018": ["error"],
// Multiple spaces after hash on atx style heading
"markdownlint/md019": ["error"],
// No space inside hashes on closed atx style heading
"markdownlint/md020": ["error"],
// Multiple spaces inside hashes on closed atx style heading
"markdownlint/md021": ["error"],
// Headings should be surrounded by blank lines
"markdownlint/md022": ["error", {
"lines_above": 1,
"lines_below": 0
}],
// Headings must start at the beginning of the line
"markdownlint/md023": ["error"],
// Multiple headings with the same content
"markdownlint/md024": ["error", {
"siblings_only": true
}],
// Multiple top-level headings in the same document
// turned off for now as we need to improve headings in docs
"markdownlint/md025": ["off"],
// "markdownlint/md025": ["error", {
// "level": 2
// }],
// Trailing punctuation in heading
"markdownlint/md026": ["error"],
// Multiple spaces after blockquote symbol
"markdownlint/md027": ["error"],
// Blank line inside blockquote
"markdownlint/md028": ["error"],
// Ordered list item prefix
"markdownlint/md029": ["error", {
"style": "ordered"
}],
// Spaces after list markers
"markdownlint/md030": ["error"],
// Fenced code blocks should be surrounded by blank lines
"markdownlint/md031": ["error"],
// Lists should be surrounded by blank lines
"markdownlint/md032": ["error"],
// Inline HTML
"markdownlint/md033": ["error", {
"allowed_elements": [
"discord",
"a"
] // These are Vue elements used in the docs
}],
// Bare URL used
"markdownlint/md034": ["error"],
// Horizontal rule style
"markdownlint/md035": ["error", {
"style": "***"
}],
// Emphasis used instead of a heading
"markdownlint/md036": ["error"],
// Spaces inside emphasis markers
"markdownlint/md037": ["error"],
// Spaces inside code span elements
"markdownlint/md038": ["error"],
// Spaces inside link text
"markdownlint/md039": ["error"],
// Fenced code blocks should have a language specified
"markdownlint/md040": ["error"],
// First line in a file should be a top-level heading
"markdownlint/md041": ["off"], // turned off because not usefull for module docs
// No empty links
"markdownlint/md042": ["error"],
// Proper names should have the correct capitalization
"markdownlint/md044": ["error", {
"names": [
"LSSM"
]
}],
// Images should have alternate text (alt text)
"markdownlint/md045": ["error"],
// Code block style
"markdownlint/md046": ["error", {
"style": "fenced"
}],
// Files should end with a single newline character
"markdownlint/md047": ["error"],
// Code fence style
"markdownlint/md048": ["error", {
"style": "backtick"
}],
// Emphasis style should be consistent
"markdownlint/md049": ["error", {
"style": "asterisk"
}],
// Strong style should be consistent
"markdownlint/md050": ["error", {
"style": "asterisk"
}]
// TODO: Wait for eslint-plugin-markdownlint to being updated (currently does not support these rules yet). See https://gitlab.com/pawelbbdrozd/eslint-plugin-markdownlint/-/issues/10 for details.
// Link fragments should be valid
// "markdownlint/md051": ["error"],
// Reference links and images should use a label that is defined
// "markdownlint/md052": ["error"],
// Link and image reference definitions should be needed
// "markdownlint/md053": ["error"]
}
}
]
}