@unshared/eslint-config 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +606 -635
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1347 -0
- package/dist/index.js.map +1 -0
- package/package.json +7 -3
package/dist/index.cjs
CHANGED
@@ -1,12 +1,368 @@
|
|
1
1
|
"use strict";
|
2
|
-
var vueParser = require("vue-eslint-parser"), tslint = require("typescript-eslint"), vuePlugin = require("eslint-plugin-vue"),
|
3
|
-
|
4
|
-
|
2
|
+
var vueParser = require("vue-eslint-parser"), tslint = require("typescript-eslint"), vueProcessorBlocks = require("eslint-processor-vue-blocks"), vuePlugin = require("eslint-plugin-vue"), eslintMergeProcessors = require("eslint-merge-processors"), node_process = require("node:process"), perfectionist = require("eslint-plugin-perfectionist"), toArray = require("@unshared/collection/toArray"), stylistic = require("@stylistic/eslint-plugin"), javascript = require("@eslint/js"), vitestPlugin = require("eslint-plugin-vitest"), unicornPlugin = require("eslint-plugin-unicorn"), eslintrc = require("@eslint/eslintrc"), nodePlugin = require("eslint-plugin-n"), jsonc = require("eslint-plugin-jsonc"), pluginJsdoc = require("eslint-plugin-jsdoc"), eslintCommentsPlugin = require("eslint-plugin-eslint-comments"), pluginAntfu = require("eslint-plugin-antfu");
|
3
|
+
function getConfigRules(config) {
|
4
|
+
const rules = toArray.toArray(config).flat().map((x) => x.rules);
|
5
|
+
return Object.assign({}, ...rules);
|
6
|
+
}
|
7
|
+
function typescript(options) {
|
5
8
|
return [
|
9
|
+
javascript.configs.recommended,
|
6
10
|
{
|
11
|
+
languageOptions: {
|
12
|
+
// @ts-expect-error: ignore
|
13
|
+
parser: tslint.parser,
|
14
|
+
parserOptions: {
|
15
|
+
ecmaVersion: "latest",
|
16
|
+
sourceType: "module",
|
17
|
+
project: toArray.toArray(options.tsConfigPaths ?? "./tsconfig.json"),
|
18
|
+
tsconfigRootDir: node_process.cwd()
|
19
|
+
}
|
20
|
+
},
|
21
|
+
plugins: {
|
22
|
+
"@typescript-eslint": tslint.plugin,
|
23
|
+
"@stylistic": stylistic,
|
24
|
+
perfectionist
|
25
|
+
},
|
7
26
|
files: [
|
8
|
-
"**/*.
|
27
|
+
"**/*.{ts,tsx,cts,mts}",
|
28
|
+
"**/*.{js,jsx,cjs,mjs}"
|
9
29
|
],
|
30
|
+
rules: {
|
31
|
+
/**
|
32
|
+
* Inherit all recommended rules from the `@eslint/js` plugin. This is the base
|
33
|
+
* configuration for JavaScript files.
|
34
|
+
*/
|
35
|
+
...getConfigRules(tslint.configs.recommendedTypeChecked),
|
36
|
+
...getConfigRules(tslint.configs.stylisticTypeChecked),
|
37
|
+
/**
|
38
|
+
* Age-old debate over how to style braces. This rule aims to reduce the
|
39
|
+
* cognitive load of reasoning about code by enforcing a consistent style.
|
40
|
+
*
|
41
|
+
* @see https://eslint.style/rules/default/brace-style
|
42
|
+
*/
|
43
|
+
"brace-style": "off",
|
44
|
+
"@typescript-eslint/brace-style": "off",
|
45
|
+
"@stylistic/brace-style": ["error", "stroustrup", {
|
46
|
+
allowSingleLine: !0
|
47
|
+
}],
|
48
|
+
/**
|
49
|
+
* Enforce an indent of 2 spaces. Aims to reduce visual noise and maintain
|
50
|
+
* readability of code when viewed on GitHub or GitLab.
|
51
|
+
*
|
52
|
+
* @see https://eslint.style/rules/default/no-tabs
|
53
|
+
* @see https://eslint.style/rules/default/indent
|
54
|
+
* @see https://eslint.style/rules/default/indent-binary-ops
|
55
|
+
*/
|
56
|
+
"no-tabs": "off",
|
57
|
+
indent: "off",
|
58
|
+
"indent-binary-ops": "off",
|
59
|
+
"@typescript-eslint/no-tabs": "off",
|
60
|
+
"@typescript-eslint/indent": "off",
|
61
|
+
"@typescript-eslint/indent-binary-ops": "off",
|
62
|
+
"@stylistic/no-tabs": "error",
|
63
|
+
"@stylistic/indent": ["error", 2],
|
64
|
+
"@stylistic/indent-binary-ops": ["error", 2],
|
65
|
+
/**
|
66
|
+
* Enforce no semi-colons. This rule aims to maintain consistency around the
|
67
|
+
* use or omission of trailing semicolons. Helps reduce the visual noise in
|
68
|
+
* the codebase. Also helps to prevent errors when refactoring and adding
|
69
|
+
* new lines.
|
70
|
+
*
|
71
|
+
* @see https://eslint.style/rules/default/semi
|
72
|
+
*/
|
73
|
+
semi: "off",
|
74
|
+
"@typescript-eslint/semi": "off",
|
75
|
+
"@stylistic/semi": ["error", "never"],
|
76
|
+
/**
|
77
|
+
* Enforce a consistent linebreak style and ensure no leading line breaks
|
78
|
+
* and a single trailing line break. This rule aims to maintain consistency
|
79
|
+
* around the use of line breaks in the codebase and reduce the amount of
|
80
|
+
* diff churn when making changes.
|
81
|
+
*
|
82
|
+
* @see https://eslint.style/rules/default/linebreak-style
|
83
|
+
*/
|
84
|
+
"eol-last": "off",
|
85
|
+
"no-multiple-empty-lines": "off",
|
86
|
+
"@stylistic/eol-last": ["error", "always"],
|
87
|
+
"@stylistic/no-multiple-empty-lines": ["error", {
|
88
|
+
max: 1,
|
89
|
+
maxBOF: 0,
|
90
|
+
maxEOF: 1
|
91
|
+
}],
|
92
|
+
/**
|
93
|
+
* Enforce a trailing comma after the last element or property in a multiline
|
94
|
+
* list of properties or elements. This rule improves the clarity of diffs
|
95
|
+
* when an item is added or removed from an object or array.
|
96
|
+
*
|
97
|
+
* @see https://eslint.style/rules/default/comma-dangle
|
98
|
+
* @see https://eslint.style/rules/default/comma-spacing
|
99
|
+
*/
|
100
|
+
"comma-dangle": "off",
|
101
|
+
"@typescript-eslint/comma-dangle": "off",
|
102
|
+
"@stylistic/comma-dangle": ["error", "always-multiline"],
|
103
|
+
/**
|
104
|
+
* This rule requires empty lines before and/or after comments. It is disabled
|
105
|
+
* however when in an object literal, array, or type literal.
|
106
|
+
*
|
107
|
+
* @see https://eslint.style/rules/default/lines-around-comment
|
108
|
+
*/
|
109
|
+
/**
|
110
|
+
* Normalize type declaration and definition. This reduces the cognitive load
|
111
|
+
* of reasoning about code by enforcing a consistent style.
|
112
|
+
*
|
113
|
+
* @see https://typescript-eslint.io/rules/consistent-indexed-object-style
|
114
|
+
*/
|
115
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
116
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
117
|
+
"@typescript-eslint/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
118
|
+
"@typescript-eslint/array-type": ["error", { default: "array-simple", readonly: "array-simple" }],
|
119
|
+
/**
|
120
|
+
* Enforce sequential declarations in the same block. This rule aims to
|
121
|
+
* enforce a top to bottom ordering of variable and type declarations.
|
122
|
+
* This reduces the likelihood of a developer skipping over a declaration
|
123
|
+
* when modifying code.
|
124
|
+
*
|
125
|
+
* @see https://typescript-eslint.io/rules/no-use-before-define
|
126
|
+
*/
|
127
|
+
"no-use-before-define": "off",
|
128
|
+
"@typescript-eslint/no-use-before-define": ["error", {
|
129
|
+
enums: !0,
|
130
|
+
classes: !1,
|
131
|
+
typedefs: !0,
|
132
|
+
variables: !0,
|
133
|
+
functions: !1,
|
134
|
+
ignoreTypeReferences: !0
|
135
|
+
}],
|
136
|
+
/**
|
137
|
+
* Enforce a consistent spacing around various places where spaces are optional.
|
138
|
+
* This rule aims to maintain consistency around the use of spaces in the codebase
|
139
|
+
* and reduce the amount of diff churn when making changes.
|
140
|
+
*
|
141
|
+
* @see https://eslint.style/rules/default/key-spacing
|
142
|
+
* @see https://eslint.style/rules/default/comma-spacing
|
143
|
+
* @see https://eslint.style/rules/default/block-spacing
|
144
|
+
* @see https://eslint.style/rules/default/arrow-spacing
|
145
|
+
* @see https://eslint.style/rules/default/object-curly-spacing
|
146
|
+
*/
|
147
|
+
"key-spacing": "off",
|
148
|
+
"comma-spacing": "off",
|
149
|
+
"block-spacing": "off",
|
150
|
+
"arrow-spacing": "off",
|
151
|
+
"spaced-comment": "off",
|
152
|
+
"no-multi-spaces": "off",
|
153
|
+
"space-before-blocks": "off",
|
154
|
+
"lines-around-comment": "off",
|
155
|
+
"object-curly-spacing": "off",
|
156
|
+
"array-bracket-spacing": "off",
|
157
|
+
"array-bracket-newline": "off",
|
158
|
+
"function-call-spacing": "off",
|
159
|
+
"generator-star-spacing": "off",
|
160
|
+
"template-curly-spacing": "off",
|
161
|
+
"newline-per-chained-call": "off",
|
162
|
+
"computed-property-spacing": "off",
|
163
|
+
"lines-between-class-members": "off",
|
164
|
+
"@typescript-eslint/comma-spacing": "off",
|
165
|
+
"@typescript-eslint/object-curly-spacing": "off",
|
166
|
+
"@typescript-eslint/type-annotation-spacing": "off",
|
167
|
+
"@typescript-eslint/lines-around-comment": "off",
|
168
|
+
"@stylistic/key-spacing": ["error", { afterColon: !0, beforeColon: !1 }],
|
169
|
+
"@stylistic/comma-spacing": ["error", { after: !0, before: !1 }],
|
170
|
+
"@stylistic/arrow-spacing": ["error", { before: !0, after: !0 }],
|
171
|
+
"@stylistic/type-generic-spacing": "error",
|
172
|
+
"@stylistic/type-named-tuple-spacing": "error",
|
173
|
+
"@stylistic/block-spacing": ["error", "always"],
|
174
|
+
"@stylistic/no-multi-spaces": "error",
|
175
|
+
"@stylistic/keyword-spacing": ["error", { before: !0, after: !0 }],
|
176
|
+
"@stylistic/space-before-blocks": ["error", "always"],
|
177
|
+
"@stylistic/object-curly-spacing": ["error", "always"],
|
178
|
+
"@stylistic/array-bracket-spacing": ["error", "never"],
|
179
|
+
"@stylistic/array-bracket-newline": ["error", "consistent"],
|
180
|
+
"@stylistic/function-call-spacing": ["error", "never"],
|
181
|
+
"@stylistic/template-curly-spacing": ["error", "never"],
|
182
|
+
"@stylistic/generator-star-spacing": ["error", { before: !0, after: !0 }],
|
183
|
+
"@stylistic/computed-property-spacing": ["error", "never"],
|
184
|
+
"@stylistic/multiline-ternary": ["error", "always-multiline"],
|
185
|
+
"@stylistic/lines-around-comment": ["error", {
|
186
|
+
beforeBlockComment: !0,
|
187
|
+
beforeLineComment: !0,
|
188
|
+
ignorePattern: "^(?! ?---|\\*)",
|
189
|
+
applyDefaultIgnorePatterns: !0,
|
190
|
+
afterHashbangComment: !0
|
191
|
+
}],
|
192
|
+
"@stylistic/spaced-comment": ["error", "always", {
|
193
|
+
block: { markers: ["!"], exceptions: ["*"], balanced: !0 },
|
194
|
+
line: { markers: ["/"], exceptions: ["/", "#"] }
|
195
|
+
}],
|
196
|
+
"@stylistic/lines-between-class-members": ["error", {
|
197
|
+
enforce: [{ blankLine: "always", prev: "method", next: "*" }]
|
198
|
+
}, {
|
199
|
+
exceptAfterSingleLine: !0
|
200
|
+
}],
|
201
|
+
"@stylistic/type-annotation-spacing": ["error", {
|
202
|
+
before: !1,
|
203
|
+
after: !0,
|
204
|
+
overrides: {
|
205
|
+
arrow: { before: !0, after: !0 },
|
206
|
+
colon: { before: !1, after: !0 },
|
207
|
+
variable: { before: !1, after: !0 },
|
208
|
+
property: { before: !1, after: !0 },
|
209
|
+
parameter: { before: !1, after: !0 },
|
210
|
+
returnType: { before: !1, after: !0 }
|
211
|
+
}
|
212
|
+
}],
|
213
|
+
/**
|
214
|
+
* Enforce the use of `@ts-expect-error` over `@ts-ignore` to silence TypeScript
|
215
|
+
* errors. This rule aims to ensure that TypeScript errors are never silenced
|
216
|
+
* without explanation or justification. When an error is fixed, the
|
217
|
+
* `@ts-expect-error` forces the developer to remove the comment.
|
218
|
+
*
|
219
|
+
* @see https://typescript-eslint.io/rules/prefer-ts-expect-error
|
220
|
+
* @see https://typescript-eslint.io/rules/ban-ts-comment
|
221
|
+
*/
|
222
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
223
|
+
"@typescript-eslint/ban-ts-comment": ["error", {
|
224
|
+
"ts-check": !1,
|
225
|
+
"ts-expect-error": "allow-with-description",
|
226
|
+
"ts-ignore": !1,
|
227
|
+
"ts-nocheck": !1
|
228
|
+
}],
|
229
|
+
/**
|
230
|
+
* Disallow dangling expressions and promises. This rule aims to prevent
|
231
|
+
* dangling promises and expressions that are not assigned to a variable.
|
232
|
+
* This can lead to bugs and unexpected behavior in the codebase.
|
233
|
+
*
|
234
|
+
* @see https://eslint.org/docs/rules/no-void
|
235
|
+
* @see https://typescript-eslint.io/rules/no-floating-promises
|
236
|
+
*/
|
237
|
+
"no-void": "off",
|
238
|
+
"no-unused-expressions": "off",
|
239
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
240
|
+
"@typescript-eslint/no-floating-promises": ["error", {
|
241
|
+
ignoreVoid: !0,
|
242
|
+
ignoreIIFE: !0
|
243
|
+
}],
|
244
|
+
/**
|
245
|
+
* Sort imports alphabetically and group them without newlines. This rule
|
246
|
+
* aims to maintain consistency around the order of imports in JavaScript
|
247
|
+
* files. Helps reduce the visual noise in the codebase.
|
248
|
+
*
|
249
|
+
* @see https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
|
250
|
+
*/
|
251
|
+
"sort-imports": "off",
|
252
|
+
"@typescript-eslint/sort-type-constituents": "off",
|
253
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
254
|
+
disallowTypeAnnotations: !1,
|
255
|
+
prefer: "no-type-imports"
|
256
|
+
}],
|
257
|
+
"perfectionist/sort-named-imports": ["error", { type: "natural" }],
|
258
|
+
"perfectionist/sort-imports": ["error", {
|
259
|
+
"newlines-between": "never",
|
260
|
+
order: "desc"
|
261
|
+
}],
|
262
|
+
/**
|
263
|
+
* Enforce no unused variables. Helps keep the codebase clean and reduces
|
264
|
+
* the chance of bugs from side-effects.
|
265
|
+
*
|
266
|
+
* @see https://typescript-eslint.io/rules/@typescript-eslint/no-unused-vars
|
267
|
+
*/
|
268
|
+
"no-redeclare": "off",
|
269
|
+
"no-unused-vars": "off",
|
270
|
+
"@typescript-eslint/no-redeclare": "error",
|
271
|
+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
272
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
273
|
+
"perfectionist/sort-intersection-types": ["error", { type: "natural" }],
|
274
|
+
"perfectionist/sort-union-types": ["error", {
|
275
|
+
type: "natural",
|
276
|
+
"nullable-last": !0
|
277
|
+
}],
|
278
|
+
"no-useless-constructor": "off",
|
279
|
+
"@typescript-eslint/ban-types": "off",
|
280
|
+
"@typescript-eslint/camelcase": "off",
|
281
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
282
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
283
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
284
|
+
"@typescript-eslint/no-empty-function": "off",
|
285
|
+
"@typescript-eslint/no-empty-interface": "off",
|
286
|
+
"@typescript-eslint/no-explicit-any": "off",
|
287
|
+
"@typescript-eslint/no-namespace": "off",
|
288
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
289
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
290
|
+
"array-callback-return": "error",
|
291
|
+
"arrow-body-style": ["error", "as-needed"],
|
292
|
+
"arrow-parens": ["error", "as-needed", { requireForBlockBody: !0 }],
|
293
|
+
"block-scoped-var": "error",
|
294
|
+
camelcase: "off",
|
295
|
+
"comma-style": ["error", "last"],
|
296
|
+
complexity: ["off", 11],
|
297
|
+
"consistent-return": "off",
|
298
|
+
curly: ["error", "multi-or-nest", "consistent"],
|
299
|
+
eqeqeq: ["error", "smart"],
|
300
|
+
"no-alert": "error",
|
301
|
+
"no-case-declarations": "error",
|
302
|
+
"no-cond-assign": ["error", "always"],
|
303
|
+
"no-confusing-arrow": "error",
|
304
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
305
|
+
"no-constant-condition": "error",
|
306
|
+
"no-debugger": "error",
|
307
|
+
"no-eval": "error",
|
308
|
+
"no-implied-eval": "error",
|
309
|
+
"no-multi-str": "error",
|
310
|
+
"no-param-reassign": "off",
|
311
|
+
"no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
|
312
|
+
"no-return-assign": "off",
|
313
|
+
"no-return-await": "off",
|
314
|
+
"no-trailing-spaces": "error",
|
315
|
+
"no-useless-escape": "off",
|
316
|
+
"no-var": "error",
|
317
|
+
"no-with": "error",
|
318
|
+
"object-shorthand": ["error", "always", { avoidQuotes: !0, ignoreConstructors: !1 }],
|
319
|
+
"one-var-declaration-per-line": "error",
|
320
|
+
"operator-linebreak": ["error", "before"],
|
321
|
+
"prefer-arrow-callback": ["error", { allowNamedFunctions: !1, allowUnboundThis: !0 }],
|
322
|
+
"prefer-const": ["error", { destructuring: "any", ignoreReadBeforeAssign: !0 }],
|
323
|
+
"prefer-rest-params": "error",
|
324
|
+
"prefer-spread": "error",
|
325
|
+
"prefer-template": "error",
|
326
|
+
"quote-props": ["error", "consistent-as-needed"],
|
327
|
+
quotes: ["error", "single"],
|
328
|
+
"require-await": "off",
|
329
|
+
"space-before-function-paren": ["error", "never"],
|
330
|
+
"vars-on-top": "error"
|
331
|
+
}
|
332
|
+
},
|
333
|
+
/**
|
334
|
+
* Ignore duplicate imports in declaration files as they are often used to re-export
|
335
|
+
* types from other packages into multiple namespaces. This is a common pattern
|
336
|
+
* in TypeScript declaration files.
|
337
|
+
*/
|
338
|
+
{
|
339
|
+
files: ["*.d.ts"],
|
340
|
+
rules: {
|
341
|
+
"@typescript-eslint/no-use-before-define": "off",
|
342
|
+
"import/no-duplicates": "off"
|
343
|
+
}
|
344
|
+
},
|
345
|
+
/**
|
346
|
+
* Allow console statements in scripts and CLI files since they are not part of the
|
347
|
+
* library / production code and are useful for debugging, logging, and testing.
|
348
|
+
*/
|
349
|
+
{
|
350
|
+
files: ["**/scripts/**/*", "cli.*"],
|
351
|
+
rules: {
|
352
|
+
"no-console": "off"
|
353
|
+
}
|
354
|
+
}
|
355
|
+
];
|
356
|
+
}
|
357
|
+
const VUE_RECOMMENDED_RULES = vuePlugin.configs?.["flat/recommended"].rules, VUE_BASE_RULES = vuePlugin.configs?.base.rules;
|
358
|
+
function vue(options) {
|
359
|
+
const TYPESCRIPT_CONFIG = typescript(options).at(1);
|
360
|
+
return [
|
361
|
+
{
|
362
|
+
plugins: {
|
363
|
+
vue: vuePlugin,
|
364
|
+
...TYPESCRIPT_CONFIG.plugins
|
365
|
+
},
|
10
366
|
languageOptions: {
|
11
367
|
globals: {
|
12
368
|
computed: "readonly",
|
@@ -26,18 +382,25 @@ function vue() {
|
|
26
382
|
},
|
27
383
|
parser: vueParser,
|
28
384
|
parserOptions: {
|
29
|
-
ecmaFeatures: { jsx: !1 },
|
30
|
-
ecmaVersion: "latest",
|
31
385
|
parser: tslint.parser,
|
32
|
-
|
386
|
+
extraFileExtensions: [".vue"],
|
387
|
+
...TYPESCRIPT_CONFIG.languageOptions.parserOptions
|
33
388
|
}
|
34
389
|
},
|
35
|
-
|
36
|
-
|
37
|
-
vue
|
38
|
-
|
390
|
+
processor: eslintMergeProcessors.mergeProcessors([
|
391
|
+
// @ts-expect-error: ignore
|
392
|
+
vuePlugin.processors[".vue"],
|
393
|
+
vueProcessorBlocks()
|
394
|
+
]),
|
395
|
+
files: [
|
396
|
+
"**/*.vue"
|
397
|
+
],
|
39
398
|
rules: {
|
399
|
+
...VUE_BASE_RULES,
|
40
400
|
...VUE_RECOMMENDED_RULES,
|
401
|
+
...TYPESCRIPT_CONFIG.rules,
|
402
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
403
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
41
404
|
/**
|
42
405
|
* Enforces consistent usage of type imports. This rule will enforce the use
|
43
406
|
* of `type` imports to make it easier for the Vue SFC compiler to analyze
|
@@ -51,23 +414,6 @@ function vue() {
|
|
51
414
|
fixStyle: "inline-type-imports",
|
52
415
|
prefer: "type-imports"
|
53
416
|
}],
|
54
|
-
"no-undef": "off",
|
55
|
-
/**
|
56
|
-
* Disable the `no-unused-vars` rule because as it may trigger false positives
|
57
|
-
* when using the Composition API.
|
58
|
-
*/
|
59
|
-
"no-unused-vars": "off",
|
60
|
-
/**
|
61
|
-
* Since we may use the auto-import feature of Nuxt / unplugin-autoimport,
|
62
|
-
* we may have access to global variables that are not known to ESLint.
|
63
|
-
*
|
64
|
-
* @see https://eslint.org/docs/latest/rules/no-undef
|
65
|
-
*/
|
66
|
-
semi: "off",
|
67
|
-
// extensions
|
68
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
69
|
-
"vue/arrow-spacing": ["error", { after: !0, before: !0 }],
|
70
|
-
"vue/block-lang": ["error", { script: { lang: "ts" } }],
|
71
417
|
/**
|
72
418
|
* Enforce the order of the top-level properties in the component. This rule
|
73
419
|
* helps to maintain consistency and readability by enforcing a predictable
|
@@ -83,16 +429,6 @@ function vue() {
|
|
83
429
|
"style"
|
84
430
|
]
|
85
431
|
}],
|
86
|
-
"vue/block-spacing": ["error", "always"],
|
87
|
-
// reactivity transform
|
88
|
-
"vue/block-tag-newline": ["error", {
|
89
|
-
multiline: "always",
|
90
|
-
singleline: "always"
|
91
|
-
}],
|
92
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: !0 }],
|
93
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
94
|
-
"vue/comma-spacing": ["error", { after: !0, before: !1 }],
|
95
|
-
"vue/comma-style": ["error", "last"],
|
96
432
|
/**
|
97
433
|
* Enforce use of the Composition API and TypeScript. This rule forbids the
|
98
434
|
* use of the Options API and JavaScript in Vue components for better
|
@@ -112,30 +448,6 @@ function vue() {
|
|
112
448
|
ignores: ["/\\./"],
|
113
449
|
registeredComponentsOnly: !1
|
114
450
|
}],
|
115
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
116
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
117
|
-
"vue/define-macros-order": ["error", {
|
118
|
-
order: ["defineProps", "defineEmits"]
|
119
|
-
}],
|
120
|
-
"vue/dot-location": ["error", "property"],
|
121
|
-
"vue/dot-notation": ["error", { allowKeywords: !0 }],
|
122
|
-
"vue/eqeqeq": ["error", "smart"],
|
123
|
-
"vue/first-attribute-linebreak": ["error", {
|
124
|
-
multiline: "below",
|
125
|
-
singleline: "beside"
|
126
|
-
}],
|
127
|
-
"vue/html-closing-bracket-newline": ["error", {
|
128
|
-
multiline: "never",
|
129
|
-
selfClosingTag: {
|
130
|
-
multiline: "always",
|
131
|
-
singleline: "never"
|
132
|
-
},
|
133
|
-
singleline: "never"
|
134
|
-
}],
|
135
|
-
"vue/html-comment-content-newline": ["error", {
|
136
|
-
multiline: "always",
|
137
|
-
singleline: "never"
|
138
|
-
}],
|
139
451
|
/**
|
140
452
|
* Enforce consistent spacing between HTML comments and their content.
|
141
453
|
*
|
@@ -151,6 +463,10 @@ function vue() {
|
|
151
463
|
* @see https://eslint.vuejs.org/rules/padding-line-between-tags.html
|
152
464
|
*/
|
153
465
|
"vue/html-comment-indent": ["error", 2],
|
466
|
+
"vue/padding-line-between-tags": ["error", [
|
467
|
+
{ blankLine: "consistent", next: "*", prev: "*" },
|
468
|
+
{ blankLine: "always", next: "*", prev: "comment" }
|
469
|
+
]],
|
154
470
|
/**
|
155
471
|
* Enforce consistent spacing and newlines in the template. This rule helps
|
156
472
|
* to maintain consistency and readability by enforcing a predictable
|
@@ -185,18 +501,6 @@ function vue() {
|
|
185
501
|
ignores: [],
|
186
502
|
ignoreWhenEmpty: !0
|
187
503
|
}],
|
188
|
-
"vue/no-constant-condition": "warn",
|
189
|
-
"vue/no-empty-pattern": "error",
|
190
|
-
"vue/no-extra-parens": ["error", "functions"],
|
191
|
-
"vue/no-irregular-whitespace": "error",
|
192
|
-
"vue/no-loss-of-precision": "error",
|
193
|
-
"vue/no-restricted-syntax": [
|
194
|
-
"error",
|
195
|
-
"DebuggerStatement",
|
196
|
-
"LabeledStatement",
|
197
|
-
"WithStatement"
|
198
|
-
],
|
199
|
-
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
200
504
|
/**
|
201
505
|
* Reports the destructuring or member expression of props passed to setup
|
202
506
|
* causing the value to lose reactivity. This rule helps to avoid common
|
@@ -205,9 +509,6 @@ function vue() {
|
|
205
509
|
* @see https://eslint.vuejs.org/rules/no-setup-props-reactivity-loss.html
|
206
510
|
*/
|
207
511
|
"vue/no-setup-props-reactivity-loss": "error",
|
208
|
-
"vue/no-sparse-arrays": "error",
|
209
|
-
"vue/no-unused-emit-declarations": "error",
|
210
|
-
"vue/no-use-v-else-with-v-for": "error",
|
211
512
|
/**
|
212
513
|
* Disallow v-if in v-for. This rule helps to avoid common pitfalls when
|
213
514
|
* using v-if and v-for together in the same element.
|
@@ -215,6 +516,26 @@ function vue() {
|
|
215
516
|
* @see https://eslint.vuejs.org/rules/no-use-v-if-with-v-for.html
|
216
517
|
*/
|
217
518
|
"vue/no-use-v-if-with-v-for": "error",
|
519
|
+
/**
|
520
|
+
* Enforce the declaration of emits in the setup function and warn on unused
|
521
|
+
* emits declarations. This rule helps reduce the risk stale code.
|
522
|
+
*
|
523
|
+
* @see https://eslint.vuejs.org/rules/require-explicit-emits.html
|
524
|
+
* @see https://eslint.vuejs.org/rules/no-unused-emit-declarations.html
|
525
|
+
*/
|
526
|
+
"vue/require-explicit-emits": "error",
|
527
|
+
/**
|
528
|
+
* Enforce the `@` shorthand over `v-on:` and only allow inline callbacks.
|
529
|
+
* This rule helps to maintain consistency and readability by enforcing a
|
530
|
+
* predictable order of the event handlers in the component.
|
531
|
+
*
|
532
|
+
* @see https://eslint.vuejs.org/rules/v-on-style.html
|
533
|
+
* @see https://eslint.vuejs.org/rules/v-on-handler-style.html
|
534
|
+
*/
|
535
|
+
"vue/v-on-style": ["error", "shorthand"],
|
536
|
+
"vue/no-sparse-arrays": "error",
|
537
|
+
"vue/no-unused-emit-declarations": "error",
|
538
|
+
"vue/no-use-v-else-with-v-for": "error",
|
218
539
|
"vue/no-useless-v-bind": "error",
|
219
540
|
"vue/no-v-html": "off",
|
220
541
|
"vue/no-v-text-v-html-on-component": "error",
|
@@ -230,38 +551,68 @@ function vue() {
|
|
230
551
|
],
|
231
552
|
"vue/operator-linebreak": ["error", "before"],
|
232
553
|
"vue/padding-line-between-blocks": ["error", "always"],
|
233
|
-
"vue/padding-line-between-tags": ["error", [
|
234
|
-
{ blankLine: "consistent", next: "*", prev: "*" }
|
235
|
-
]],
|
236
554
|
"vue/prefer-define-options": "error",
|
237
555
|
"vue/prefer-import-from-vue": "off",
|
238
556
|
"vue/prefer-separate-static-class": "error",
|
239
557
|
"vue/prefer-template": "error",
|
240
558
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
241
559
|
"vue/require-default-prop": "off",
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
"vue/
|
560
|
+
// reactivity transform
|
561
|
+
"vue/block-tag-newline": ["error", {
|
562
|
+
multiline: "always",
|
563
|
+
singleline: "always"
|
564
|
+
}],
|
565
|
+
// extensions
|
566
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
567
|
+
"vue/arrow-spacing": ["error", { after: !0, before: !0 }],
|
568
|
+
"vue/block-lang": ["error", { script: { lang: "ts" } }],
|
569
|
+
"vue/block-spacing": ["error", "always"],
|
570
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: !0 }],
|
571
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
572
|
+
"vue/comma-spacing": ["error", { after: !0, before: !1 }],
|
573
|
+
"vue/comma-style": ["error", "last"],
|
574
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
575
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
576
|
+
"vue/define-macros-order": ["error", {
|
577
|
+
order: ["defineProps", "defineEmits"]
|
578
|
+
}],
|
579
|
+
"vue/dot-location": ["error", "property"],
|
580
|
+
"vue/dot-notation": ["error", { allowKeywords: !0 }],
|
581
|
+
"vue/eqeqeq": ["error", "smart"],
|
582
|
+
"vue/first-attribute-linebreak": ["error", {
|
583
|
+
multiline: "below",
|
584
|
+
singleline: "beside"
|
585
|
+
}],
|
586
|
+
"vue/html-closing-bracket-newline": ["error", {
|
587
|
+
multiline: "never",
|
588
|
+
selfClosingTag: {
|
589
|
+
multiline: "always",
|
590
|
+
singleline: "never"
|
591
|
+
},
|
592
|
+
singleline: "never"
|
593
|
+
}],
|
594
|
+
"vue/html-comment-content-newline": ["error", {
|
595
|
+
multiline: "always",
|
596
|
+
singleline: "never"
|
597
|
+
}],
|
598
|
+
"vue/no-constant-condition": "warn",
|
599
|
+
"vue/no-empty-pattern": "error",
|
600
|
+
"vue/no-extra-parens": ["error", "functions"],
|
601
|
+
"vue/no-irregular-whitespace": "error",
|
602
|
+
"vue/no-loss-of-precision": "error",
|
603
|
+
"vue/no-restricted-syntax": [
|
604
|
+
"error",
|
605
|
+
"DebuggerStatement",
|
606
|
+
"LabeledStatement",
|
607
|
+
"WithStatement"
|
608
|
+
],
|
609
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
250
610
|
"vue/require-prop-types": "off",
|
251
611
|
"vue/space-in-parens": ["error", "never"],
|
252
612
|
"vue/space-infix-ops": "error",
|
253
613
|
"vue/space-unary-ops": ["error", { nonwords: !1, words: !0 }],
|
254
614
|
"vue/template-curly-spacing": "error",
|
255
|
-
"vue/v-on-handler-style": ["error", "inline"]
|
256
|
-
/**
|
257
|
-
* Enforce the `@` shorthand over `v-on:` and only allow inline callbacks.
|
258
|
-
* This rule helps to maintain consistency and readability by enforcing a
|
259
|
-
* predictable order of the event handlers in the component.
|
260
|
-
*
|
261
|
-
* @see https://eslint.vuejs.org/rules/v-on-style.html
|
262
|
-
* @see https://eslint.vuejs.org/rules/v-on-handler-style.html
|
263
|
-
*/
|
264
|
-
"vue/v-on-style": ["error", "shorthand"]
|
615
|
+
"vue/v-on-handler-style": ["error", "inline"]
|
265
616
|
}
|
266
617
|
}
|
267
618
|
];
|
@@ -269,12 +620,23 @@ function vue() {
|
|
269
620
|
function vitest() {
|
270
621
|
return [
|
271
622
|
{
|
623
|
+
plugins: {
|
624
|
+
vitest: vitestPlugin
|
625
|
+
},
|
272
626
|
files: [
|
273
627
|
"**/*.{ts,mts,cts,tsx,d.ts}",
|
274
628
|
"**/*.{js,mjs,cjs,jsx}"
|
275
629
|
],
|
276
|
-
|
277
|
-
vitest:
|
630
|
+
settings: {
|
631
|
+
vitest: {
|
632
|
+
typecheck: !0
|
633
|
+
}
|
634
|
+
},
|
635
|
+
languageOptions: {
|
636
|
+
globals: {
|
637
|
+
...vitestPlugin.environments.env.globals,
|
638
|
+
expectTypeOf: !0
|
639
|
+
}
|
278
640
|
},
|
279
641
|
rules: {
|
280
642
|
/**
|
@@ -306,413 +668,149 @@ function vitest() {
|
|
306
668
|
"vitest/no-conditional-in-test": "off",
|
307
669
|
"vitest/no-conditional-tests": "off",
|
308
670
|
/**
|
309
|
-
*
|
671
|
+
* Since we use in-source testing, we need to disable the rule as it may prevent
|
672
|
+
* us from using top level evaluation that are not part of the test suite.
|
310
673
|
*
|
311
674
|
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
312
675
|
*/
|
676
|
+
"vitest/require-hook": "off",
|
313
677
|
"vitest/no-hooks": "off",
|
314
678
|
/**
|
315
679
|
* Disable the rule that enforces the use of `expect.assertions` in tests.
|
316
|
-
* As much as this rule enforces a best-practice, it is not always necessary.
|
317
|
-
*
|
318
|
-
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
319
|
-
*/
|
320
|
-
"vitest/prefer-expect-assertions": "off",
|
321
|
-
/**
|
322
|
-
* Some functions may have a single test case, and it is not necessary
|
323
|
-
* to wrap them in a describe block.
|
324
|
-
*
|
325
|
-
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
326
|
-
*/
|
327
|
-
"vitest/require-top-level-describe": "off",
|
328
|
-
/**
|
329
|
-
* Enforce rule titles starts with 'should'. This is a convention
|
330
|
-
* to force the developer to write the test in a way that it reads
|
331
|
-
* like a sentence.
|
332
|
-
*
|
333
|
-
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
334
|
-
*/
|
335
|
-
"vitest/valid-title": ["error", {
|
336
|
-
ignoreTypeOfDescribeName: !0,
|
337
|
-
mustMatch: {
|
338
|
-
test: ["^should"]
|
339
|
-
}
|
340
|
-
}]
|
341
|
-
// /**
|
342
|
-
// * Allow runt
|
343
|
-
// */
|
344
|
-
// 'vitest/require-hook': 'off',
|
345
|
-
}
|
346
|
-
}
|
347
|
-
];
|
348
|
-
}
|
349
|
-
const UNICORN_RECOMMENDED_RULES = unicornPlugin.configs.recommended.rules;
|
350
|
-
function unicorn() {
|
351
|
-
return [
|
352
|
-
{
|
353
|
-
plugins: {
|
354
|
-
unicorn: unicornPlugin
|
355
|
-
},
|
356
|
-
rules: {
|
357
|
-
...UNICORN_RECOMMENDED_RULES,
|
358
|
-
/**
|
359
|
-
* Improve regexes by making them shorter, consistent, and safer. This rule
|
360
|
-
* aims to improve readability and consistency of regexes while also
|
361
|
-
* mitigating regex denial of service attacks by disallowing potentially
|
362
|
-
* catastrophic backtracking.
|
363
|
-
*
|
364
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
|
365
|
-
*/
|
366
|
-
"unicorn/better-regex": "error",
|
367
|
-
/**
|
368
|
-
* Enforce the catch clause parameter name to be named `error`. This rule
|
369
|
-
* aims to enforce a consistent parameter name in catch clauses. The name
|
370
|
-
* `error` is the most commonly used name for the parameter that is passed
|
371
|
-
* to the catch clause.
|
372
|
-
*
|
373
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md
|
374
|
-
*/
|
375
|
-
"unicorn/catch-error-name": ["error", {
|
376
|
-
name: "error"
|
377
|
-
}],
|
378
|
-
"unicorn/consistent-function-scoping": "off",
|
379
|
-
"unicorn/error-message": "error",
|
380
|
-
"unicorn/escape-case": "error",
|
381
|
-
/**
|
382
|
-
* Enforce the use of camelCase or PascalCase when naming folders, files and
|
383
|
-
* variables. This rule aims to enforce a consistent naming convention for
|
384
|
-
* filenames, directory names, and variable names.
|
385
|
-
*
|
386
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
387
|
-
*/
|
388
|
-
"unicorn/filename-case": ["error", {
|
389
|
-
cases: {
|
390
|
-
camelCase: !0,
|
391
|
-
pascalCase: !0
|
392
|
-
},
|
393
|
-
ignore: [
|
394
|
-
"^[A-Z]+(.md)?$"
|
395
|
-
]
|
396
|
-
}],
|
397
|
-
/**
|
398
|
-
* Disable the recommended import style rules. We want to be able to use both
|
399
|
-
* named and default imports in our codebase.
|
400
|
-
*
|
401
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
|
402
|
-
*/
|
403
|
-
"unicorn/import-style": "off",
|
404
|
-
"unicorn/no-array-callback-reference": "off",
|
405
|
-
"unicorn/no-array-for-each": "off",
|
406
|
-
"unicorn/no-array-instanceof": "error",
|
407
|
-
"unicorn/no-new-buffer": "error",
|
408
|
-
"unicorn/no-static-only-class": "off",
|
409
|
-
/**
|
410
|
-
* Disallow unsafe regular expressions. Regular expressions can be unsafe
|
411
|
-
* when they are too complex and can cause catastrophic backtracking. This
|
412
|
-
* rule disallows regular expressions that can lead to catastrophic
|
413
|
-
*
|
414
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-regex.md
|
415
|
-
*/
|
416
|
-
"unicorn/no-unsafe-regex": "error",
|
417
|
-
"unicorn/number-literal-case": "error",
|
418
|
-
/**
|
419
|
-
* Enforces a convention of grouping digits using numeric separators.
|
420
|
-
* Long numbers can become really hard to read, so cutting it into groups
|
421
|
-
* of digits, separated with a _, is important to keep your code clear.
|
422
|
-
*
|
423
|
-
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
424
|
-
*/
|
425
|
-
"unicorn/numeric-separators-style": ["error", {
|
426
|
-
onlyIfContainsSeparator: !0
|
427
|
-
}],
|
428
|
-
"unicorn/prefer-code-point": "off",
|
429
|
-
"unicorn/prefer-exponentiation-operator": "error",
|
430
|
-
"unicorn/prefer-includes": "error",
|
431
|
-
"unicorn/prefer-module": "off",
|
432
|
-
"unicorn/prefer-starts-ends-with": "error",
|
433
|
-
"unicorn/prefer-switch": "off",
|
434
|
-
"unicorn/prefer-text-content": "error",
|
435
|
-
"unicorn/prefer-type-error": "error",
|
436
|
-
"unicorn/prevent-abbreviations": ["error", {
|
437
|
-
allowList: {
|
438
|
-
args: !0,
|
439
|
-
dir: !0,
|
440
|
-
fn: !0,
|
441
|
-
i: !0,
|
442
|
-
j: !0,
|
443
|
-
k: !0,
|
444
|
-
props: !0,
|
445
|
-
Props: !0,
|
446
|
-
ref: !0,
|
447
|
-
v: !0,
|
448
|
-
x: !0,
|
449
|
-
y: !0,
|
450
|
-
z: !0
|
451
|
-
}
|
452
|
-
}],
|
453
|
-
"unicorn/throw-new-error": "error"
|
454
|
-
}
|
455
|
-
}
|
456
|
-
];
|
457
|
-
}
|
458
|
-
const { recommendedTypeChecked, stylisticTypeChecked } = tslint.configs, TSLING_DEFAULT_RULES = [recommendedTypeChecked, stylisticTypeChecked].flat().map((x) => x.rules).reduce((accumulator, x) => ({ ...accumulator, ...x }), {});
|
459
|
-
function typescript() {
|
460
|
-
return [
|
461
|
-
{
|
462
|
-
files: [
|
463
|
-
"**/*.ts",
|
464
|
-
"**/*.tsx"
|
465
|
-
],
|
466
|
-
languageOptions: {
|
467
|
-
// @ts-expect-error: ignore
|
468
|
-
parser: tslint.parser,
|
469
|
-
parserOptions: {
|
470
|
-
project: [
|
471
|
-
"./tsconfig.json",
|
472
|
-
"./packages/*/tsconfig.json"
|
473
|
-
]
|
474
|
-
}
|
475
|
-
},
|
476
|
-
plugins: {
|
477
|
-
"@typescript-eslint": tslint.plugin
|
478
|
-
},
|
479
|
-
rules: {
|
480
|
-
...TSLING_DEFAULT_RULES,
|
481
|
-
/**
|
482
|
-
* Enforce consistent Array types. This rule aims to standardize the usage of
|
483
|
-
* `Array<T>` over `T[]`, and `ReadonlyArray<T>` over `readonly T[]`. Allows
|
484
|
-
* for reduced cognitive load when reading code that uses arrays. Exceptions
|
485
|
-
* are allowed for primitive or simple types.
|
486
|
-
*
|
487
|
-
* @see https://typescript-eslint.io/rules/array-type
|
488
|
-
*/
|
489
|
-
"@typescript-eslint/array-type": ["error", {
|
490
|
-
default: "array-simple",
|
491
|
-
readonly: "array-simple"
|
492
|
-
}],
|
493
|
-
"@typescript-eslint/ban-ts-comment": ["error", {
|
494
|
-
"ts-check": !1,
|
495
|
-
"ts-expect-error": "allow-with-description",
|
496
|
-
"ts-ignore": !1,
|
497
|
-
"ts-nocheck": !1
|
498
|
-
}],
|
499
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
500
|
-
"@typescript-eslint/ban-types": "off",
|
501
|
-
"@typescript-eslint/brace-style": ["error", "stroustrup", {
|
502
|
-
allowSingleLine: !0
|
503
|
-
}],
|
504
|
-
"@typescript-eslint/camelcase": "off",
|
505
|
-
/**
|
506
|
-
* Enforce a trailing comma after the last element or property in a multiline
|
507
|
-
* list of properties or elements. This rule improves the clarity of diffs
|
508
|
-
* when an item is added or removed from an object or array.
|
509
|
-
*
|
510
|
-
* @see https://typescript-eslint.io/rules/comma-dangle
|
511
|
-
*/
|
512
|
-
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
|
513
|
-
"@typescript-eslint/comma-spacing": ["error"],
|
514
|
-
/**
|
515
|
-
* Enforce `Record<K, T>` instead of `{ [K]: T }`. This rule aims to standardize
|
516
|
-
* the declaration of Record types and helps prevent bugs caused by typos.
|
517
|
-
*
|
518
|
-
* @see https://typescript-eslint.io/rules/consistent-indexed-object-style
|
519
|
-
*/
|
520
|
-
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
521
|
-
/**
|
522
|
-
* Enforces `interface` usage over `type` usage. This allows for better consistency
|
523
|
-
* and identification of objects that can be augmented while favoring separation
|
524
|
-
* between interfaces describing objects and types describing primitives and/or unions.
|
525
|
-
*
|
526
|
-
* @see https://typescript-eslint.io/rules/consistent-type-definitions
|
527
|
-
*/
|
528
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
529
|
-
/**
|
530
|
-
* Enforces consistent usage of type imports. This rule will disallow the use of
|
531
|
-
* `import type` or `import { type }` to reduce the cognitive load of reasoning
|
532
|
-
* about imports. Typically, the bundler will know which imports are types and
|
533
|
-
* strip them out.
|
534
|
-
*
|
535
|
-
* @see https://typescript-eslint.io/rules/consistent-type-imports
|
536
|
-
*/
|
537
|
-
"@typescript-eslint/consistent-type-imports": ["error", {
|
538
|
-
disallowTypeAnnotations: !1,
|
539
|
-
prefer: "no-type-imports"
|
540
|
-
}],
|
541
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
542
|
-
"@typescript-eslint/explicit-member-accessibility": "off",
|
543
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
544
|
-
/**
|
545
|
-
* Enforce an indent of 2 spaces. Aims to reduce visual noise and maintain
|
546
|
-
* readability of code when viewed on GitHub or GitLab.
|
547
|
-
*
|
548
|
-
* @see https://typescript-eslint.io/rules/indent
|
549
|
-
*/
|
550
|
-
"@typescript-eslint/indent": ["error", 2],
|
551
|
-
/**
|
552
|
-
* Enforce no comma/semi-columns in interfaces. This rule aims to maintain
|
553
|
-
* consistency around the use or omission of trailing semicolons. Helps
|
554
|
-
* reduce the visual noise in the codebase. Also helps to prevent errors
|
555
|
-
* when refactoring and adding new lines.
|
556
|
-
*
|
557
|
-
* @see https://typescript-eslint.io/rules/member-delimiter-style
|
558
|
-
*/
|
559
|
-
"@typescript-eslint/member-delimiter-style": ["error", {
|
560
|
-
multiline: { delimiter: "none" }
|
561
|
-
}],
|
562
|
-
"@typescript-eslint/no-empty-function": "off",
|
563
|
-
"@typescript-eslint/no-empty-interface": "off",
|
564
|
-
"@typescript-eslint/no-explicit-any": "off",
|
565
|
-
"@typescript-eslint/no-namespace": "off",
|
566
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
567
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
568
|
-
"@typescript-eslint/no-redeclare": "error",
|
569
|
-
"@typescript-eslint/no-unused-expressions": "error",
|
570
|
-
"@typescript-eslint/no-unused-vars": ["error", {
|
571
|
-
argsIgnorePattern: "^_"
|
572
|
-
}],
|
573
|
-
"@typescript-eslint/no-use-before-define": ["error", {
|
574
|
-
classes: !1,
|
575
|
-
functions: !1,
|
576
|
-
variables: !0
|
577
|
-
}],
|
578
|
-
/**
|
579
|
-
* Enforce consistent spacing inside braces. This rule aims to reduce the
|
580
|
-
* cognitive load of reasoning about code by enforcing a consistent style.
|
581
|
-
*
|
582
|
-
* @see https://typescript-eslint.io/rules/object-curly-spacing
|
583
|
-
*/
|
584
|
-
"@typescript-eslint/object-curly-spacing": ["error", "always"],
|
585
|
-
/**
|
586
|
-
* Enforce the use of `@ts-expect-error` over `@ts-ignore` to silence TypeScript
|
587
|
-
* errors. This rule aims to ensure that TypeScript errors are never silenced
|
588
|
-
* without explanation or justification. When an error is fixed, the
|
589
|
-
* `@ts-expect-error` forces the developer to remove the comment.
|
590
|
-
*
|
591
|
-
* @see https://typescript-eslint.io/rules/prefer-ts-expect-error
|
592
|
-
* @see https://typescript-eslint.io/rules/ban-ts-comment
|
593
|
-
*/
|
594
|
-
"@typescript-eslint/prefer-ts-expect-error": "error",
|
595
|
-
"@typescript-eslint/semi": ["error", "never"],
|
596
|
-
/**
|
597
|
-
* Disable this rule as it may conflict with the `perfectionist/sort-imports` rule.
|
598
|
-
*
|
599
|
-
* @see https://typescript-eslint.io/rules/sort-type-constituents
|
600
|
-
*/
|
601
|
-
"@typescript-eslint/sort-type-constituents": "off",
|
602
|
-
/**
|
603
|
-
* Enforce spacing around the `:` in type annotations. This rule aims to
|
604
|
-
* maintain consistency and reduce visual noise in the codebase.
|
605
|
-
*
|
606
|
-
* @see https://typescript-eslint.io/rules/type-annotation-spacing
|
607
|
-
*/
|
608
|
-
"@typescript-eslint/type-annotation-spacing": ["error", {}],
|
609
|
-
/**
|
610
|
-
* Age-old debate over how to style braces. This rule aims to reduce the
|
611
|
-
* cognitive load of reasoning about code by enforcing a consistent style.
|
612
|
-
*
|
613
|
-
* @see https://typescript-eslint.io/rules/brace-style
|
614
|
-
*/
|
615
|
-
"brace-style": "off",
|
616
|
-
"comma-dangle": "off",
|
617
|
-
/**
|
618
|
-
* Enforce standard comma-spacing. Normalizes the codebase and reduces
|
619
|
-
* cognitive load when reasoning about code.
|
620
|
-
*
|
621
|
-
* @see https://typescript-eslint.io/rules/comma-spacing
|
622
|
-
*/
|
623
|
-
"comma-spacing": "off",
|
624
|
-
"import/named": "off",
|
625
|
-
indent: "off",
|
626
|
-
/**
|
627
|
-
* In JavaScript, it’s possible to redeclare the same variable name using var.
|
628
|
-
* This can lead to confusion as to where the variable is actually declared and initialized.
|
629
|
-
*
|
630
|
-
* @see https://typescript-eslint.io/rules/no-redeclare
|
631
|
-
*/
|
632
|
-
"no-redeclare": "off",
|
633
|
-
/**
|
634
|
-
* Enforce no unused expressions. This rule aims to prevent dead code and
|
635
|
-
* reduce the likelihood of bugs.
|
636
|
-
*
|
637
|
-
* @see https://typescript-eslint.io/rules/no-unused-expressions
|
638
|
-
*/
|
639
|
-
"no-unused-expressions": "off",
|
640
|
-
/**
|
641
|
-
* Enforce no unused variables. Helps keep the codebase clean and reduces
|
642
|
-
* the chance of bugs from side-effects.
|
680
|
+
* As much as this rule enforces a best-practice, it is not always necessary.
|
643
681
|
*
|
644
|
-
* @see https://
|
682
|
+
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
645
683
|
*/
|
646
|
-
"
|
684
|
+
"vitest/prefer-expect-assertions": "off",
|
647
685
|
/**
|
648
|
-
*
|
649
|
-
*
|
650
|
-
* This reduces the likelihood of a developer skipping over a declaration
|
651
|
-
* when modifying code.
|
686
|
+
* Some functions may have a single test case, and it is not necessary
|
687
|
+
* to wrap them in a describe block.
|
652
688
|
*
|
653
|
-
* @see https://
|
689
|
+
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
654
690
|
*/
|
655
|
-
"
|
656
|
-
"no-useless-constructor": "off",
|
657
|
-
"object-curly-spacing": "off",
|
691
|
+
"vitest/require-top-level-describe": "off",
|
658
692
|
/**
|
659
|
-
* Enforce
|
660
|
-
*
|
661
|
-
*
|
662
|
-
* new lines.
|
693
|
+
* Enforce rule titles starts with 'should'. This is a convention
|
694
|
+
* to force the developer to write the test in a way that it reads
|
695
|
+
* like a sentence.
|
663
696
|
*
|
664
|
-
* @see https://
|
697
|
+
* @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
665
698
|
*/
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
* in TypeScript declaration files.
|
673
|
-
*/
|
674
|
-
{
|
675
|
-
files: ["*.d.ts"],
|
676
|
-
rules: {
|
677
|
-
"@typescript-eslint/no-use-before-define": "off",
|
678
|
-
"import/no-duplicates": "off"
|
679
|
-
}
|
680
|
-
},
|
681
|
-
/**
|
682
|
-
* Allow console statements in scripts and CLI files since they are not part of the
|
683
|
-
* library / production code and are useful for debugging, logging, and testing.
|
684
|
-
*/
|
685
|
-
{
|
686
|
-
files: ["**/scripts/**/*", "cli.*"],
|
687
|
-
rules: {
|
688
|
-
"no-console": "off"
|
699
|
+
"vitest/valid-title": ["error", {
|
700
|
+
ignoreTypeOfDescribeName: !0,
|
701
|
+
mustMatch: {
|
702
|
+
test: ["^should"]
|
703
|
+
}
|
704
|
+
}]
|
689
705
|
}
|
690
706
|
}
|
691
707
|
];
|
692
708
|
}
|
693
|
-
|
709
|
+
const UNICORN_RECOMMENDED_RULES = unicornPlugin.configs.recommended.rules;
|
710
|
+
function unicorn() {
|
694
711
|
return [
|
695
712
|
{
|
696
713
|
plugins: {
|
697
|
-
|
714
|
+
unicorn: unicornPlugin
|
698
715
|
},
|
699
716
|
rules: {
|
717
|
+
...UNICORN_RECOMMENDED_RULES,
|
700
718
|
/**
|
701
|
-
*
|
702
|
-
*
|
719
|
+
* Improve regexes by making them shorter, consistent, and safer. This rule
|
720
|
+
* aims to improve readability and consistency of regexes while also
|
721
|
+
* mitigating regex denial of service attacks by disallowing potentially
|
722
|
+
* catastrophic backtracking.
|
703
723
|
*
|
704
|
-
* @see https://
|
724
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
|
705
725
|
*/
|
706
|
-
"
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
726
|
+
"unicorn/better-regex": "error",
|
727
|
+
/**
|
728
|
+
* Enforce the catch clause parameter name to be named `error`. This rule
|
729
|
+
* aims to enforce a consistent parameter name in catch clauses. The name
|
730
|
+
* `error` is the most commonly used name for the parameter that is passed
|
731
|
+
* to the catch clause.
|
732
|
+
*
|
733
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md
|
734
|
+
*/
|
735
|
+
"unicorn/catch-error-name": ["error", {
|
736
|
+
name: "error"
|
737
|
+
}],
|
738
|
+
/**
|
739
|
+
* Enforce the use of camelCase or PascalCase when naming folders, files and
|
740
|
+
* variables. This rule aims to enforce a consistent naming convention for
|
741
|
+
* filenames, directory names, and variable names.
|
742
|
+
*
|
743
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
744
|
+
*/
|
745
|
+
"unicorn/filename-case": ["error", {
|
746
|
+
cases: {
|
747
|
+
camelCase: !0,
|
748
|
+
pascalCase: !0
|
749
|
+
},
|
750
|
+
ignore: [
|
751
|
+
"^[A-Z]+(.md)?$"
|
752
|
+
]
|
753
|
+
}],
|
754
|
+
/**
|
755
|
+
* Disable the recommended import style rules. We want to be able to use both
|
756
|
+
* named and default imports in our codebase.
|
757
|
+
*
|
758
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/import-style.md
|
759
|
+
*/
|
760
|
+
"unicorn/import-style": "off",
|
761
|
+
/**
|
762
|
+
* Disallow unsafe regular expressions. Regular expressions can be unsafe
|
763
|
+
* when they are too complex and can cause catastrophic backtracking. This
|
764
|
+
* rule disallows regular expressions that can lead to catastrophic
|
765
|
+
*
|
766
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-regex.md
|
767
|
+
*/
|
768
|
+
"unicorn/no-unsafe-regex": "error",
|
769
|
+
/**
|
770
|
+
* Enforces a convention of grouping digits using numeric separators.
|
771
|
+
* Long numbers can become really hard to read, so cutting it into groups
|
772
|
+
* of digits, separated with a _, is important to keep your code clear.
|
773
|
+
*
|
774
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
775
|
+
*/
|
776
|
+
"unicorn/numeric-separators-style": ["error", {
|
777
|
+
onlyIfContainsSeparator: !0
|
778
|
+
}],
|
779
|
+
"unicorn/number-literal-case": "error",
|
780
|
+
"unicorn/consistent-function-scoping": "off",
|
781
|
+
"unicorn/error-message": "error",
|
782
|
+
"unicorn/escape-case": "error",
|
783
|
+
"unicorn/no-array-callback-reference": "off",
|
784
|
+
"unicorn/no-array-for-each": "off",
|
785
|
+
"unicorn/no-array-instanceof": "error",
|
786
|
+
"unicorn/no-new-buffer": "error",
|
787
|
+
"unicorn/no-static-only-class": "off",
|
788
|
+
"unicorn/prefer-code-point": "off",
|
789
|
+
"unicorn/prefer-exponentiation-operator": "error",
|
790
|
+
"unicorn/prefer-includes": "error",
|
791
|
+
"unicorn/prefer-module": "off",
|
792
|
+
"unicorn/prefer-starts-ends-with": "error",
|
793
|
+
"unicorn/prefer-switch": "off",
|
794
|
+
"unicorn/prefer-text-content": "error",
|
795
|
+
"unicorn/prefer-type-error": "error",
|
796
|
+
"unicorn/prevent-abbreviations": ["error", {
|
797
|
+
allowList: {
|
798
|
+
args: !0,
|
799
|
+
dir: !0,
|
800
|
+
fn: !0,
|
801
|
+
i: !0,
|
802
|
+
j: !0,
|
803
|
+
k: !0,
|
804
|
+
props: !0,
|
805
|
+
Props: !0,
|
806
|
+
ref: !0,
|
807
|
+
v: !0,
|
808
|
+
x: !0,
|
809
|
+
y: !0,
|
810
|
+
z: !0
|
811
|
+
}
|
812
|
+
}],
|
813
|
+
"unicorn/throw-new-error": "error"
|
716
814
|
}
|
717
815
|
}
|
718
816
|
];
|
@@ -745,12 +843,12 @@ function sonarjs() {
|
|
745
843
|
"sonarjs/no-duplicate-string": ["error", {
|
746
844
|
threshold: 10
|
747
845
|
}],
|
748
|
-
"sonarjs/no-empty-collection": "off",
|
749
|
-
"sonarjs/no-extra-arguments": "off",
|
750
|
-
"sonarjs/no-gratuitous-expressions": "off",
|
751
846
|
/**
|
752
847
|
* Those rules are crashing ESLint at startup, so they are disabled for now.
|
753
848
|
*/
|
849
|
+
"sonarjs/no-empty-collection": "off",
|
850
|
+
"sonarjs/no-extra-arguments": "off",
|
851
|
+
"sonarjs/no-gratuitous-expressions": "off",
|
754
852
|
"sonarjs/no-one-iteration-loop": "off",
|
755
853
|
"sonarjs/no-redundant-jump": "off",
|
756
854
|
"sonarjs/no-unused-collection": "off",
|
@@ -758,39 +856,6 @@ function sonarjs() {
|
|
758
856
|
}
|
759
857
|
});
|
760
858
|
}
|
761
|
-
function perfectionist() {
|
762
|
-
return new eslintrc.FlatCompat().config({
|
763
|
-
extends: [
|
764
|
-
"plugin:perfectionist/recommended-natural"
|
765
|
-
],
|
766
|
-
plugins: [
|
767
|
-
"perfectionist"
|
768
|
-
],
|
769
|
-
rules: {
|
770
|
-
/**
|
771
|
-
* Sort imports alphabetically and group them without newlines. This rule
|
772
|
-
* aims to maintain consistency around the order of imports in JavaScript
|
773
|
-
* files. Helps reduce the visual noise in the codebase.
|
774
|
-
*
|
775
|
-
* @see https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
|
776
|
-
*/
|
777
|
-
"perfectionist/sort-imports": ["error", {
|
778
|
-
"newlines-between": "never",
|
779
|
-
order: "desc"
|
780
|
-
}],
|
781
|
-
/**
|
782
|
-
* Sort objects alphabetically. This rule aims to maintain consistency around
|
783
|
-
* the order of object properties in JavaScript files. Helps reduce the visual
|
784
|
-
* noise in the codebase.
|
785
|
-
*
|
786
|
-
* @see https://eslint-plugin-perfectionist.azat.io/rules/sort-objects
|
787
|
-
*/
|
788
|
-
"perfectionist/sort-objects": ["error", {
|
789
|
-
"partition-by-comment": "--- **"
|
790
|
-
}]
|
791
|
-
}
|
792
|
-
});
|
793
|
-
}
|
794
859
|
function node() {
|
795
860
|
return [
|
796
861
|
{
|
@@ -815,7 +880,16 @@ function node() {
|
|
815
880
|
*/
|
816
881
|
"n/no-missing-import": "off",
|
817
882
|
"n/no-missing-require": "off",
|
818
|
-
|
883
|
+
/**
|
884
|
+
* Enfore the use of the asyncrounous version of the `fs` and `dns` APIs.
|
885
|
+
*
|
886
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-sync.md
|
887
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-promises/fs.md
|
888
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-promises/dns.md
|
889
|
+
*/
|
890
|
+
"n/no-sync": "off",
|
891
|
+
"n/prefer-promises/fs": "error",
|
892
|
+
"n/prefer-promises/dns": "error",
|
819
893
|
/**
|
820
894
|
* Allow the use of features up to Node.js version 20. This will allow
|
821
895
|
* the use of newer ECMAScript features and Node.js APIs.
|
@@ -823,6 +897,7 @@ function node() {
|
|
823
897
|
* @see https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules
|
824
898
|
*/
|
825
899
|
"n/no-unsupported-features/es-syntax": "error",
|
900
|
+
"n/no-unsupported-features/es-builtins": "error",
|
826
901
|
"n/no-unsupported-features/node-builtins": "error",
|
827
902
|
/**
|
828
903
|
* Prepend the `node:` prefix to all Node.js core modules. This helps
|
@@ -1067,9 +1142,9 @@ function jsdoc() {
|
|
1067
1142
|
pluginJsdoc.configs["flat/recommended-typescript-flavor-error"],
|
1068
1143
|
{
|
1069
1144
|
files: [
|
1070
|
-
"**/*.
|
1071
|
-
"**/*.
|
1072
|
-
"**/*.
|
1145
|
+
"**/*.{ts,mts,cts,tsx,d.ts}",
|
1146
|
+
"**/*.{js,mjs,cjs,jsx}",
|
1147
|
+
"**/*.vue"
|
1073
1148
|
],
|
1074
1149
|
rules: {
|
1075
1150
|
/**
|
@@ -1090,6 +1165,8 @@ function jsdoc() {
|
|
1090
1165
|
*
|
1091
1166
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.README/rules/check-tag-names.md
|
1092
1167
|
*/
|
1168
|
+
"jsdoc/require-jsdoc": "off",
|
1169
|
+
"jsdoc/require-param-type": "off",
|
1093
1170
|
"jsdoc/check-tag-names": ["error", {
|
1094
1171
|
definedTags: [
|
1095
1172
|
"category"
|
@@ -1099,7 +1176,7 @@ function jsdoc() {
|
|
1099
1176
|
* Checks for multi-line-style comments which fail to meet the criteria of a jsdoc block,
|
1100
1177
|
* namely that it should begin with two and only two asterisks.
|
1101
1178
|
*
|
1102
|
-
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md
|
1179
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md
|
1103
1180
|
*/
|
1104
1181
|
"jsdoc/no-bad-blocks": "error",
|
1105
1182
|
/**
|
@@ -1107,128 +1184,26 @@ function jsdoc() {
|
|
1107
1184
|
* is sometimes forgotten and has no real purpose. This rule aims to enforce
|
1108
1185
|
* that no hyphen is used.
|
1109
1186
|
*
|
1110
|
-
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-hyphen-before-param-description
|
1187
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-hyphen-before-param-description
|
1111
1188
|
*/
|
1112
1189
|
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
|
1113
|
-
"jsdoc/require-jsdoc": "off",
|
1114
|
-
"jsdoc/require-param-type": "off",
|
1115
1190
|
/**
|
1116
1191
|
* Since we are using TypeScript, we don't need to enforce types in JSDoc.
|
1117
1192
|
*
|
1118
|
-
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main
|
1193
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-type.md
|
1119
1194
|
*/
|
1120
1195
|
"jsdoc/require-returns-type": "off",
|
1121
1196
|
/**
|
1122
1197
|
* Enforce a new-line between the JSDoc summary and tags. Aims to improve
|
1123
1198
|
* readability by separating the summary and tags.
|
1124
1199
|
*
|
1125
|
-
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md
|
1200
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md
|
1126
1201
|
*/
|
1127
1202
|
"jsdoc/tag-lines": ["error", "any", { startLines: 1 }]
|
1128
1203
|
}
|
1129
1204
|
}
|
1130
1205
|
];
|
1131
1206
|
}
|
1132
|
-
function javascript() {
|
1133
|
-
return [
|
1134
|
-
{
|
1135
|
-
rules: {
|
1136
|
-
/**
|
1137
|
-
* Inherit all recommended rules from the `@eslint/js` plugin. This is the base
|
1138
|
-
* configuration for JavaScript files.
|
1139
|
-
*/
|
1140
|
-
...javascriptPlugin.configs.recommended.rules,
|
1141
|
-
"array-bracket-spacing": ["error", "never"],
|
1142
|
-
"array-callback-return": "error",
|
1143
|
-
"arrow-body-style": ["error", "as-needed"],
|
1144
|
-
"arrow-parens": ["error", "as-needed", { requireForBlockBody: !0 }],
|
1145
|
-
"block-scoped-var": "error",
|
1146
|
-
"block-spacing": ["error", "always"],
|
1147
|
-
"brace-style": ["error", "stroustrup", { allowSingleLine: !0 }],
|
1148
|
-
camelcase: "off",
|
1149
|
-
"comma-dangle": ["error", "always-multiline"],
|
1150
|
-
"comma-spacing": ["error", { after: !0, before: !1 }],
|
1151
|
-
"comma-style": ["error", "last"],
|
1152
|
-
complexity: ["off", 11],
|
1153
|
-
"consistent-return": "off",
|
1154
|
-
curly: ["error", "multi-or-nest", "consistent"],
|
1155
|
-
"eol-last": "error",
|
1156
|
-
eqeqeq: ["error", "smart"],
|
1157
|
-
"func-call-spacing": ["off", "never"],
|
1158
|
-
"generator-star-spacing": "off",
|
1159
|
-
indent: ["error", 2, { outerIIFEBody: 1, SwitchCase: 1, VariableDeclarator: 1 }],
|
1160
|
-
"key-spacing": ["error", { afterColon: !0, beforeColon: !1 }],
|
1161
|
-
"n/no-callback-literal": "off",
|
1162
|
-
"no-alert": "error",
|
1163
|
-
"no-case-declarations": "error",
|
1164
|
-
"no-cond-assign": ["error", "always"],
|
1165
|
-
"no-confusing-arrow": "error",
|
1166
|
-
"no-console": ["warn", { allow: ["warn", "error"] }],
|
1167
|
-
"no-constant-condition": "error",
|
1168
|
-
"no-debugger": "error",
|
1169
|
-
"no-eval": "error",
|
1170
|
-
"no-implied-eval": "error",
|
1171
|
-
"no-multi-spaces": "error",
|
1172
|
-
"no-multi-str": "error",
|
1173
|
-
/**
|
1174
|
-
* Enforce a consistent linebreak style. Reduces merge conflicts and makes the code
|
1175
|
-
* more consistent between different iterations of the same file.
|
1176
|
-
*
|
1177
|
-
* @see https://eslint.org/docs/rules/linebreak-style
|
1178
|
-
*/
|
1179
|
-
"no-multiple-empty-lines": ["error", {
|
1180
|
-
max: 1,
|
1181
|
-
maxBOF: 0,
|
1182
|
-
maxEOF: 1
|
1183
|
-
}],
|
1184
|
-
"no-param-reassign": "off",
|
1185
|
-
"no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
|
1186
|
-
"no-return-assign": "off",
|
1187
|
-
"no-return-await": "off",
|
1188
|
-
"no-trailing-spaces": "error",
|
1189
|
-
"no-unused-vars": "warn",
|
1190
|
-
"no-use-before-define": ["error", { classes: !1, functions: !1, variables: !0 }],
|
1191
|
-
"no-useless-escape": "off",
|
1192
|
-
"no-var": "error",
|
1193
|
-
/**
|
1194
|
-
* Allow `void` operator. It's useful to discard the result of an expression, especially
|
1195
|
-
* when calling asynchronous functions that return a promise.
|
1196
|
-
*
|
1197
|
-
* @see https://eslint.org/docs/rules/no-void
|
1198
|
-
*/
|
1199
|
-
"no-void": "off",
|
1200
|
-
"no-with": "error",
|
1201
|
-
"object-curly-spacing": ["error", "always"],
|
1202
|
-
"object-shorthand": ["error", "always", { avoidQuotes: !0, ignoreConstructors: !1 }],
|
1203
|
-
"one-var-declaration-per-line": "error",
|
1204
|
-
"operator-linebreak": ["error", "before"],
|
1205
|
-
"prefer-arrow-callback": ["error", { allowNamedFunctions: !1, allowUnboundThis: !0 }],
|
1206
|
-
"prefer-const": ["error", { destructuring: "any", ignoreReadBeforeAssign: !0 }],
|
1207
|
-
"prefer-rest-params": "error",
|
1208
|
-
"prefer-spread": "error",
|
1209
|
-
"prefer-template": "error",
|
1210
|
-
"quote-props": ["error", "consistent-as-needed"],
|
1211
|
-
quotes: ["error", "single"],
|
1212
|
-
"require-await": "off",
|
1213
|
-
semi: ["error", "never"],
|
1214
|
-
"space-before-function-paren": ["error", "never"],
|
1215
|
-
"spaced-comment": ["error", "always", {
|
1216
|
-
block: {
|
1217
|
-
balanced: !0,
|
1218
|
-
exceptions: ["*"],
|
1219
|
-
markers: ["!"]
|
1220
|
-
},
|
1221
|
-
line: {
|
1222
|
-
exceptions: ["/", "#"],
|
1223
|
-
markers: ["/"]
|
1224
|
-
}
|
1225
|
-
}],
|
1226
|
-
"template-curly-spacing": "error",
|
1227
|
-
"vars-on-top": "error"
|
1228
|
-
}
|
1229
|
-
}
|
1230
|
-
];
|
1231
|
-
}
|
1232
1207
|
function eslintComments() {
|
1233
1208
|
return [
|
1234
1209
|
{
|
@@ -1314,23 +1289,20 @@ function antfu() {
|
|
1314
1289
|
}
|
1315
1290
|
];
|
1316
1291
|
}
|
1317
|
-
function all() {
|
1292
|
+
function all(options = {}) {
|
1318
1293
|
return [
|
1319
1294
|
...antfu(),
|
1320
1295
|
...eslintComments(),
|
1321
|
-
...javascript(),
|
1322
1296
|
...jsdoc(),
|
1323
1297
|
...configJson(),
|
1324
1298
|
...jsonPackage(),
|
1325
1299
|
...jsonTsconfig(),
|
1326
1300
|
...node(),
|
1327
|
-
...perfectionist(),
|
1328
1301
|
...sonarjs(),
|
1329
|
-
...
|
1330
|
-
...typescript(),
|
1302
|
+
...typescript(options),
|
1331
1303
|
...unicorn(),
|
1332
1304
|
...vitest(),
|
1333
|
-
...vue(),
|
1305
|
+
...vue(options),
|
1334
1306
|
// ...promise(),
|
1335
1307
|
// ...markdown(),
|
1336
1308
|
{
|
@@ -1353,6 +1325,5 @@ function all() {
|
|
1353
1325
|
}
|
1354
1326
|
];
|
1355
1327
|
}
|
1356
|
-
|
1357
|
-
module.exports = index;
|
1328
|
+
module.exports = all;
|
1358
1329
|
//# sourceMappingURL=index.cjs.map
|