@vinicunca/eslint-config 1.10.0 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1529 -0
- package/package.json +76 -21
- package/index.js +0 -5
package/dist/index.js
ADDED
|
@@ -0,0 +1,1529 @@
|
|
|
1
|
+
// src/base.ts
|
|
2
|
+
import process2 from "process";
|
|
3
|
+
import { isPackageExists } from "local-pkg";
|
|
4
|
+
|
|
5
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
|
|
6
|
+
function isBoolean(data) {
|
|
7
|
+
return typeof data === "boolean";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/globs.ts
|
|
11
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
12
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
13
|
+
var GLOB_EXCLUDE = [
|
|
14
|
+
"**/node_modules",
|
|
15
|
+
"**/dist",
|
|
16
|
+
"**/package-lock.json",
|
|
17
|
+
"**/yarn.lock",
|
|
18
|
+
"**/pnpm-lock.yaml",
|
|
19
|
+
"**/output",
|
|
20
|
+
"**/coverage",
|
|
21
|
+
"**/temp",
|
|
22
|
+
"**/.vitepress/cache",
|
|
23
|
+
"**/.nuxt",
|
|
24
|
+
"**/.vercel",
|
|
25
|
+
"**/.changeset",
|
|
26
|
+
"**/.idea",
|
|
27
|
+
"**/.output",
|
|
28
|
+
"**/.vite-inspect",
|
|
29
|
+
"**/CHANGELOG*.md",
|
|
30
|
+
"**/*.min.*",
|
|
31
|
+
"**/LICENSE*",
|
|
32
|
+
"**/__snapshots__",
|
|
33
|
+
"**/auto-import?(s).d.ts",
|
|
34
|
+
"**/components.d.ts"
|
|
35
|
+
];
|
|
36
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
37
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
38
|
+
var GLOB_TESTS = [
|
|
39
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
40
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
41
|
+
`**/*.test.${GLOB_SRC_EXT}`
|
|
42
|
+
];
|
|
43
|
+
var GLOB_VUE = "**/*.vue";
|
|
44
|
+
var GLOB_JSON = "**/*.json";
|
|
45
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
46
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
47
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
48
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
49
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
50
|
+
|
|
51
|
+
// src/configs/ignores.ts
|
|
52
|
+
var ignores = [
|
|
53
|
+
{ ignores: GLOB_EXCLUDE }
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
// src/utils.ts
|
|
57
|
+
function combineConfigs(...configs) {
|
|
58
|
+
return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
|
|
59
|
+
}
|
|
60
|
+
function renameRules(rules, from, to) {
|
|
61
|
+
return Object.fromEntries(
|
|
62
|
+
Object.entries(rules).map(([key, value]) => {
|
|
63
|
+
if (key.startsWith(from)) {
|
|
64
|
+
return [to + key.slice(from.length), value];
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
return [key, value];
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/flags.ts
|
|
73
|
+
var ERROR = "error";
|
|
74
|
+
var OFF = "off";
|
|
75
|
+
var WARN = "warn";
|
|
76
|
+
var CONSISTENT = "consistent";
|
|
77
|
+
var NEVER = "never";
|
|
78
|
+
var ALWAYS = "always";
|
|
79
|
+
|
|
80
|
+
// src/plugins.ts
|
|
81
|
+
import { default as default2 } from "@stylistic/eslint-plugin-js";
|
|
82
|
+
import { default as default3 } from "@stylistic/eslint-plugin-ts";
|
|
83
|
+
import { default as default4 } from "@typescript-eslint/eslint-plugin";
|
|
84
|
+
import { default as default5 } from "@typescript-eslint/parser";
|
|
85
|
+
import { default as default6 } from "eslint-plugin-eslint-comments";
|
|
86
|
+
import { default as default7 } from "eslint-plugin-i";
|
|
87
|
+
import { default as default8 } from "eslint-plugin-jsdoc";
|
|
88
|
+
import { default as default9 } from "eslint-plugin-jsonc";
|
|
89
|
+
import { default as default10 } from "eslint-plugin-markdown";
|
|
90
|
+
import { default as default11 } from "eslint-plugin-n";
|
|
91
|
+
import { default as default12 } from "eslint-plugin-no-only-tests";
|
|
92
|
+
import { default as default13 } from "eslint-plugin-unicorn";
|
|
93
|
+
import { default as default14 } from "eslint-plugin-unused-imports";
|
|
94
|
+
import { default as default15 } from "eslint-plugin-react";
|
|
95
|
+
import { default as default16 } from "eslint-plugin-react-hooks";
|
|
96
|
+
import { default as default17 } from "eslint-plugin-vue";
|
|
97
|
+
import { default as default18 } from "eslint-plugin-yml";
|
|
98
|
+
import { default as default19 } from "jsonc-eslint-parser";
|
|
99
|
+
import { default as default20 } from "vue-eslint-parser";
|
|
100
|
+
import { default as default21 } from "yaml-eslint-parser";
|
|
101
|
+
|
|
102
|
+
// src/configs/comments.ts
|
|
103
|
+
var comments = [
|
|
104
|
+
{
|
|
105
|
+
plugins: {
|
|
106
|
+
"eslint-comments": default6
|
|
107
|
+
},
|
|
108
|
+
rules: {
|
|
109
|
+
...default6.configs.recommended.rules,
|
|
110
|
+
"eslint-comments/disable-enable-pair": OFF
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
// src/configs/imports.ts
|
|
116
|
+
var imports = [
|
|
117
|
+
{
|
|
118
|
+
plugins: {
|
|
119
|
+
import: default7
|
|
120
|
+
},
|
|
121
|
+
rules: {
|
|
122
|
+
"import/export": ERROR,
|
|
123
|
+
"import/first": ERROR,
|
|
124
|
+
"import/newline-after-import": [ERROR, { considerComments: true, count: 1 }],
|
|
125
|
+
"import/no-duplicates": ERROR,
|
|
126
|
+
"import/no-mutable-exports": ERROR,
|
|
127
|
+
"import/no-named-default": ERROR,
|
|
128
|
+
"import/no-self-import": ERROR,
|
|
129
|
+
"import/no-webpack-loader-syntax": ERROR,
|
|
130
|
+
"import/order": ERROR
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
// src/configs/javascript.ts
|
|
136
|
+
import globals from "globals";
|
|
137
|
+
var rulesProblems = {
|
|
138
|
+
"array-callback-return": [ERROR, { checkForEach: true }],
|
|
139
|
+
"constructor-super": ERROR,
|
|
140
|
+
"for-direction": ERROR,
|
|
141
|
+
"no-async-promise-executor": ERROR,
|
|
142
|
+
"no-await-in-loop": ERROR,
|
|
143
|
+
"no-class-assign": ERROR,
|
|
144
|
+
"no-compare-neg-zero": ERROR,
|
|
145
|
+
"no-cond-assign": [ERROR, "always"],
|
|
146
|
+
"no-const-assign": ERROR,
|
|
147
|
+
"no-constant-binary-expression": ERROR,
|
|
148
|
+
"no-constant-condition": [ERROR, { checkLoops: false }],
|
|
149
|
+
"no-constructor-return": ERROR,
|
|
150
|
+
"no-control-regex": ERROR,
|
|
151
|
+
"no-debugger": ERROR,
|
|
152
|
+
"no-dupe-args": ERROR,
|
|
153
|
+
"no-dupe-class-members": ERROR,
|
|
154
|
+
"no-dupe-else-if": ERROR,
|
|
155
|
+
"no-dupe-keys": ERROR,
|
|
156
|
+
"no-duplicate-case": ERROR,
|
|
157
|
+
"no-empty-character-class": ERROR,
|
|
158
|
+
"no-empty-pattern": ERROR,
|
|
159
|
+
"no-ex-assign": ERROR,
|
|
160
|
+
"no-fallthrough": ERROR,
|
|
161
|
+
"no-func-assign": ERROR,
|
|
162
|
+
"no-import-assign": ERROR,
|
|
163
|
+
"no-invalid-regexp": ERROR,
|
|
164
|
+
"no-irregular-whitespace": ERROR,
|
|
165
|
+
"no-loss-of-precision": ERROR,
|
|
166
|
+
"no-misleading-character-class": ERROR,
|
|
167
|
+
"no-new-symbol": ERROR,
|
|
168
|
+
"no-obj-calls": ERROR,
|
|
169
|
+
"no-promise-executor-return": ERROR,
|
|
170
|
+
"no-prototype-builtins": ERROR,
|
|
171
|
+
"no-self-assign": [ERROR, { props: true }],
|
|
172
|
+
"no-self-compare": ERROR,
|
|
173
|
+
"no-sparse-arrays": ERROR,
|
|
174
|
+
"no-template-curly-in-string": ERROR,
|
|
175
|
+
"no-this-before-super": ERROR,
|
|
176
|
+
"no-undef": ERROR,
|
|
177
|
+
"no-unexpected-multiline": ERROR,
|
|
178
|
+
"no-unmodified-loop-condition": ERROR,
|
|
179
|
+
"no-unreachable": ERROR,
|
|
180
|
+
"no-unreachable-loop": ERROR,
|
|
181
|
+
"no-unsafe-finally": ERROR,
|
|
182
|
+
"no-unsafe-negation": ERROR,
|
|
183
|
+
"no-unused-vars": [ERROR, {
|
|
184
|
+
args: "none",
|
|
185
|
+
caughtErrors: "none",
|
|
186
|
+
ignoreRestSiblings: true,
|
|
187
|
+
vars: "all"
|
|
188
|
+
}],
|
|
189
|
+
"no-use-before-define": [ERROR, {
|
|
190
|
+
functions: false,
|
|
191
|
+
classes: false,
|
|
192
|
+
variables: true
|
|
193
|
+
}],
|
|
194
|
+
"no-useless-backreference": ERROR,
|
|
195
|
+
"use-isnan": [ERROR, {
|
|
196
|
+
enforceForSwitchCase: true,
|
|
197
|
+
enforceForIndexOf: true
|
|
198
|
+
}],
|
|
199
|
+
"valid-typeof": [ERROR, { requireStringLiterals: true }]
|
|
200
|
+
};
|
|
201
|
+
var rulesSuggestions = {
|
|
202
|
+
"accessor-pairs": [ERROR, { setWithoutGet: true, enforceForClassMembers: true }],
|
|
203
|
+
"block-scoped-var": ERROR,
|
|
204
|
+
"camelcase": [ERROR, {
|
|
205
|
+
allow: ["^UNSAFE_"],
|
|
206
|
+
properties: "never",
|
|
207
|
+
ignoreGlobals: true
|
|
208
|
+
}],
|
|
209
|
+
"curly": [ERROR, "all"],
|
|
210
|
+
"default-case-last": ERROR,
|
|
211
|
+
"dot-notation": [ERROR, { allowKeywords: true }],
|
|
212
|
+
"eqeqeq": [ERROR, "smart"],
|
|
213
|
+
"new-cap": [ERROR, { capIsNew: false, properties: true }],
|
|
214
|
+
"no-alert": WARN,
|
|
215
|
+
"no-array-constructor": ERROR,
|
|
216
|
+
"no-caller": ERROR,
|
|
217
|
+
"no-case-declarations": ERROR,
|
|
218
|
+
"no-console": [ERROR, { allow: [WARN, ERROR] }],
|
|
219
|
+
"no-delete-var": ERROR,
|
|
220
|
+
"no-empty": [ERROR, { allowEmptyCatch: true }],
|
|
221
|
+
"no-eval": ERROR,
|
|
222
|
+
"no-extend-native": ERROR,
|
|
223
|
+
"no-extra-bind": ERROR,
|
|
224
|
+
"no-extra-boolean-cast": ERROR,
|
|
225
|
+
"no-floating-decimal": ERROR,
|
|
226
|
+
"no-global-assign": ERROR,
|
|
227
|
+
"no-implied-eval": ERROR,
|
|
228
|
+
"no-invalid-this": ERROR,
|
|
229
|
+
"no-iterator": ERROR,
|
|
230
|
+
"no-labels": [ERROR],
|
|
231
|
+
"no-lone-blocks": ERROR,
|
|
232
|
+
"no-mixed-operators": [ERROR, {
|
|
233
|
+
groups: [
|
|
234
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
235
|
+
["&&", "||"],
|
|
236
|
+
["in", "instanceof"]
|
|
237
|
+
],
|
|
238
|
+
allowSamePrecedence: true
|
|
239
|
+
}],
|
|
240
|
+
"no-multi-str": ERROR,
|
|
241
|
+
"no-nested-ternary": ERROR,
|
|
242
|
+
"no-new": ERROR,
|
|
243
|
+
"no-new-func": ERROR,
|
|
244
|
+
"no-object-constructor": ERROR,
|
|
245
|
+
"no-new-wrappers": ERROR,
|
|
246
|
+
"no-octal": ERROR,
|
|
247
|
+
"no-octal-escape": ERROR,
|
|
248
|
+
"no-proto": ERROR,
|
|
249
|
+
"no-redeclare": [ERROR, { builtinGlobals: false }],
|
|
250
|
+
"no-regex-spaces": ERROR,
|
|
251
|
+
"no-restricted-globals": [
|
|
252
|
+
ERROR,
|
|
253
|
+
{ name: "global", message: "Use `globalThis` instead." },
|
|
254
|
+
{ name: "self", message: "Use `globalThis` instead." }
|
|
255
|
+
],
|
|
256
|
+
"no-restricted-properties": [
|
|
257
|
+
ERROR,
|
|
258
|
+
{ property: "__proto__", message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead." },
|
|
259
|
+
{ property: "__defineGetter__", message: "Use `Object.defineProperty` instead." },
|
|
260
|
+
{ property: "__defineSetter__", message: "Use `Object.defineProperty` instead." },
|
|
261
|
+
{ property: "__lookupGetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." },
|
|
262
|
+
{ property: "__lookupSetter__", message: "Use `Object.getOwnPropertyDescriptor` instead." }
|
|
263
|
+
],
|
|
264
|
+
"no-restricted-syntax": [
|
|
265
|
+
ERROR,
|
|
266
|
+
"DebuggerStatement",
|
|
267
|
+
"ForInStatement",
|
|
268
|
+
"LabeledStatement",
|
|
269
|
+
"WithStatement"
|
|
270
|
+
],
|
|
271
|
+
"no-return-assign": [ERROR, "always"],
|
|
272
|
+
"no-sequences": ERROR,
|
|
273
|
+
"no-shadow-restricted-names": ERROR,
|
|
274
|
+
"no-throw-literal": ERROR,
|
|
275
|
+
"no-undef-init": ERROR,
|
|
276
|
+
"no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
|
|
277
|
+
"no-unused-expressions": [ERROR, {
|
|
278
|
+
allowShortCircuit: true,
|
|
279
|
+
allowTernary: true,
|
|
280
|
+
allowTaggedTemplates: true
|
|
281
|
+
}],
|
|
282
|
+
"no-useless-call": ERROR,
|
|
283
|
+
"no-useless-catch": ERROR,
|
|
284
|
+
"no-useless-computed-key": ERROR,
|
|
285
|
+
"no-useless-constructor": ERROR,
|
|
286
|
+
"no-useless-rename": ERROR,
|
|
287
|
+
"no-useless-return": ERROR,
|
|
288
|
+
"no-var": ERROR,
|
|
289
|
+
"no-void": ERROR,
|
|
290
|
+
"no-with": ERROR,
|
|
291
|
+
"object-shorthand": [ERROR, "always", {
|
|
292
|
+
ignoreConstructors: false,
|
|
293
|
+
avoidQuotes: true
|
|
294
|
+
}],
|
|
295
|
+
"one-var": [ERROR, { initialized: "never" }],
|
|
296
|
+
"prefer-arrow-callback": [ERROR],
|
|
297
|
+
"prefer-const": [ERROR, {
|
|
298
|
+
destructuring: "all",
|
|
299
|
+
ignoreReadBeforeAssign: true
|
|
300
|
+
}],
|
|
301
|
+
"prefer-exponentiation-operator": ERROR,
|
|
302
|
+
"prefer-promise-reject-errors": ERROR,
|
|
303
|
+
"prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
|
|
304
|
+
"prefer-rest-params": ERROR,
|
|
305
|
+
"prefer-spread": ERROR,
|
|
306
|
+
"prefer-template": ERROR,
|
|
307
|
+
"quote-props": [ERROR, "consistent-as-needed"],
|
|
308
|
+
"sort-imports": [
|
|
309
|
+
ERROR,
|
|
310
|
+
{
|
|
311
|
+
ignoreCase: false,
|
|
312
|
+
ignoreDeclarationSort: true,
|
|
313
|
+
ignoreMemberSort: false,
|
|
314
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
315
|
+
allowSeparatedGroups: false
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"symbol-description": ERROR,
|
|
319
|
+
"vars-on-top": ERROR,
|
|
320
|
+
"yoda": [ERROR, "never"]
|
|
321
|
+
};
|
|
322
|
+
var rulesLayout = {
|
|
323
|
+
"arrow-parens": [ERROR, ALWAYS],
|
|
324
|
+
"eol-last": ERROR,
|
|
325
|
+
"max-statements-per-line": [ERROR, { max: 1 }],
|
|
326
|
+
"new-parens": ERROR,
|
|
327
|
+
"no-extra-parens": [ERROR, "functions"],
|
|
328
|
+
"quotes": [ERROR, "single"],
|
|
329
|
+
"semi": [ERROR, ALWAYS],
|
|
330
|
+
"wrap-iife": [ERROR, "any", { functionPrototypeMethods: true }],
|
|
331
|
+
"unicode-bom": [ERROR, NEVER]
|
|
332
|
+
};
|
|
333
|
+
function javascript(options = {}) {
|
|
334
|
+
const rulesUnusedImports = {
|
|
335
|
+
"unused-imports/no-unused-imports": options.isInEditor ? OFF : ERROR,
|
|
336
|
+
"unused-imports/no-unused-vars": [
|
|
337
|
+
WARN,
|
|
338
|
+
{
|
|
339
|
+
vars: "all",
|
|
340
|
+
varsIgnorePattern: "^_",
|
|
341
|
+
args: "after-used",
|
|
342
|
+
argsIgnorePattern: "^_",
|
|
343
|
+
ignoreRestSiblings: true
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
};
|
|
347
|
+
return [
|
|
348
|
+
{
|
|
349
|
+
languageOptions: {
|
|
350
|
+
ecmaVersion: 2022,
|
|
351
|
+
globals: {
|
|
352
|
+
...globals.es2021,
|
|
353
|
+
...globals.node,
|
|
354
|
+
document: "readonly",
|
|
355
|
+
navigator: "readonly",
|
|
356
|
+
window: "readonly"
|
|
357
|
+
},
|
|
358
|
+
parserOptions: {
|
|
359
|
+
ecmaFeatures: { jsx: true },
|
|
360
|
+
ecmaVersion: 2022,
|
|
361
|
+
sourceType: "module"
|
|
362
|
+
},
|
|
363
|
+
sourceType: "module"
|
|
364
|
+
},
|
|
365
|
+
plugins: {
|
|
366
|
+
// 'antfu': pluginAntfu,
|
|
367
|
+
"unused-imports": default14
|
|
368
|
+
},
|
|
369
|
+
rules: {
|
|
370
|
+
...rulesProblems,
|
|
371
|
+
...rulesSuggestions,
|
|
372
|
+
...rulesLayout,
|
|
373
|
+
...rulesUnusedImports
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
files: ["scripts/**/*.*", "cli.*"],
|
|
378
|
+
rules: {
|
|
379
|
+
"no-console": OFF
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// src/configs/jsdoc.ts
|
|
386
|
+
var jsdoc = [
|
|
387
|
+
{
|
|
388
|
+
plugins: {
|
|
389
|
+
jsdoc: default8
|
|
390
|
+
},
|
|
391
|
+
rules: {
|
|
392
|
+
...default8.configs["flat/recommended-typescript"].rules,
|
|
393
|
+
"jsdoc/check-tag-names": OFF,
|
|
394
|
+
"jsdoc/check-values": OFF,
|
|
395
|
+
"jsdoc/no-undefined-types": OFF,
|
|
396
|
+
"jsdoc/require-jsdoc": OFF,
|
|
397
|
+
"jsdoc/require-param": OFF,
|
|
398
|
+
"jsdoc/require-param-description": OFF,
|
|
399
|
+
"jsdoc/require-param-type": OFF,
|
|
400
|
+
"jsdoc/require-returns": OFF,
|
|
401
|
+
"jsdoc/require-returns-type": OFF,
|
|
402
|
+
"jsdoc/require-throws": OFF,
|
|
403
|
+
"jsdoc/require-yields": OFF,
|
|
404
|
+
"jsdoc/tag-lines": OFF
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
];
|
|
408
|
+
|
|
409
|
+
// src/configs/jsonc.ts
|
|
410
|
+
var jsonc = [
|
|
411
|
+
{
|
|
412
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
413
|
+
languageOptions: {
|
|
414
|
+
parser: default19
|
|
415
|
+
},
|
|
416
|
+
plugins: {
|
|
417
|
+
jsonc: default9
|
|
418
|
+
},
|
|
419
|
+
rules: {
|
|
420
|
+
...default9.configs["recommended-with-jsonc"].rules,
|
|
421
|
+
"jsonc/array-bracket-spacing": [ERROR, NEVER],
|
|
422
|
+
"jsonc/comma-dangle": [ERROR, NEVER],
|
|
423
|
+
"jsonc/comma-style": [ERROR, "last"],
|
|
424
|
+
"jsonc/indent": [ERROR, 2],
|
|
425
|
+
"jsonc/key-spacing": [ERROR, { afterColon: true, beforeColon: false }],
|
|
426
|
+
"jsonc/no-octal-escape": ERROR,
|
|
427
|
+
"jsonc/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
428
|
+
"jsonc/object-curly-spacing": [ERROR, "always"],
|
|
429
|
+
"jsonc/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }]
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
];
|
|
433
|
+
|
|
434
|
+
// src/configs/markdown.ts
|
|
435
|
+
function markdown(options = {}) {
|
|
436
|
+
const {
|
|
437
|
+
componentExts = []
|
|
438
|
+
} = options;
|
|
439
|
+
return [
|
|
440
|
+
{
|
|
441
|
+
files: [GLOB_MARKDOWN],
|
|
442
|
+
plugins: {
|
|
443
|
+
markdown: default10
|
|
444
|
+
},
|
|
445
|
+
processor: "markdown/markdown"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
files: [
|
|
449
|
+
GLOB_MARKDOWN_CODE,
|
|
450
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
451
|
+
],
|
|
452
|
+
languageOptions: {
|
|
453
|
+
parserOptions: {
|
|
454
|
+
ecmaFeatures: {
|
|
455
|
+
impliedStrict: true
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
plugins: {
|
|
460
|
+
ts: default4
|
|
461
|
+
},
|
|
462
|
+
rules: {
|
|
463
|
+
...default10.configs.recommended.overrides[1].rules,
|
|
464
|
+
// 'antfu/no-cjs-exports': OFF,
|
|
465
|
+
// 'antfu/no-ts-export-equal': OFF,
|
|
466
|
+
"import/no-unresolved": OFF,
|
|
467
|
+
"no-alert": OFF,
|
|
468
|
+
"no-console": OFF,
|
|
469
|
+
"no-restricted-imports": OFF,
|
|
470
|
+
"no-undef": OFF,
|
|
471
|
+
"no-unused-expressions": OFF,
|
|
472
|
+
"no-unused-vars": OFF,
|
|
473
|
+
"node/prefer-global/process": OFF,
|
|
474
|
+
"ts/comma-dangle": OFF,
|
|
475
|
+
"ts/consistent-type-imports": OFF,
|
|
476
|
+
"ts/no-namespace": OFF,
|
|
477
|
+
"ts/no-redeclare": OFF,
|
|
478
|
+
"ts/no-require-imports": OFF,
|
|
479
|
+
"ts/no-unused-vars": OFF,
|
|
480
|
+
"ts/no-use-before-define": OFF,
|
|
481
|
+
"ts/no-var-requires": OFF,
|
|
482
|
+
"unused-imports/no-unused-imports": OFF,
|
|
483
|
+
"unused-imports/no-unused-vars": OFF
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// src/configs/node.ts
|
|
490
|
+
var node = [
|
|
491
|
+
{
|
|
492
|
+
plugins: {
|
|
493
|
+
node: default11
|
|
494
|
+
},
|
|
495
|
+
rules: {
|
|
496
|
+
"node/handle-callback-err": [ERROR, "^(err|error)$"],
|
|
497
|
+
"node/no-callback-literal": OFF,
|
|
498
|
+
"node/no-deprecated-api": ERROR,
|
|
499
|
+
"node/no-exports-assign": ERROR,
|
|
500
|
+
"node/no-new-require": ERROR,
|
|
501
|
+
"node/no-path-concat": ERROR,
|
|
502
|
+
"node/prefer-global/buffer": [ERROR, "never"],
|
|
503
|
+
"node/prefer-global/process": [ERROR, "never"],
|
|
504
|
+
"node/process-exit-as-throw": ERROR
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
];
|
|
508
|
+
|
|
509
|
+
// src/configs/react.ts
|
|
510
|
+
var react = [
|
|
511
|
+
{
|
|
512
|
+
plugins: {
|
|
513
|
+
"react": default15,
|
|
514
|
+
"react-hooks": default16
|
|
515
|
+
},
|
|
516
|
+
settings: {
|
|
517
|
+
react: {
|
|
518
|
+
version: "detect"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
rules: {
|
|
522
|
+
...default15.configs.recommended.rules,
|
|
523
|
+
...default16.configs.recommended.rules,
|
|
524
|
+
// Specify whether double or single quotes should be used in JSX attributes
|
|
525
|
+
// https://eslint.org/docs/rules/jsx-quotes
|
|
526
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
527
|
+
// Enforce boolean attributes notation in JSX
|
|
528
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
529
|
+
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
530
|
+
// Validate closing bracket location in JSX
|
|
531
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
532
|
+
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
533
|
+
// Validate closing tag location in JSX
|
|
534
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
|
|
535
|
+
"react/jsx-closing-tag-location": "error",
|
|
536
|
+
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
|
537
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
538
|
+
"react/jsx-curly-spacing": ["error", {
|
|
539
|
+
when: "always",
|
|
540
|
+
spacing: {
|
|
541
|
+
objectLiterals: "never"
|
|
542
|
+
},
|
|
543
|
+
children: true
|
|
544
|
+
}],
|
|
545
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
546
|
+
"react/react-in-jsx-scope": "off",
|
|
547
|
+
// Validate props indentation in JSX
|
|
548
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
549
|
+
"react/jsx-indent-props": ["error", 2],
|
|
550
|
+
// Validate JSX has key prop when in array or iterator
|
|
551
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
552
|
+
// Turned off because it has too many false positives
|
|
553
|
+
"react/jsx-key": "off",
|
|
554
|
+
// Limit maximum of props on a single line in JSX
|
|
555
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
556
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
557
|
+
// Prevent duplicate props in JSX
|
|
558
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
559
|
+
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
|
|
560
|
+
// Prevent usage of unwrapped JSX strings
|
|
561
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
562
|
+
"react/jsx-no-literals": ["off", { noStrings: true }],
|
|
563
|
+
// Disallow undeclared variables in JSX
|
|
564
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
565
|
+
"react/jsx-no-undef": "error",
|
|
566
|
+
// Enforce PascalCase for user-defined JSX components
|
|
567
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
568
|
+
"react/jsx-pascal-case": ["error", {
|
|
569
|
+
allowAllCaps: true,
|
|
570
|
+
ignore: []
|
|
571
|
+
}],
|
|
572
|
+
// Enforce props alphabetical sorting
|
|
573
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
574
|
+
"react/jsx-sort-props": ["off", {
|
|
575
|
+
ignoreCase: true,
|
|
576
|
+
callbacksLast: false,
|
|
577
|
+
shorthandFirst: false,
|
|
578
|
+
shorthandLast: false,
|
|
579
|
+
noSortAlphabetically: false,
|
|
580
|
+
reservedFirst: true
|
|
581
|
+
}],
|
|
582
|
+
// Enforce defaultProps declarations alphabetical sorting
|
|
583
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
|
|
584
|
+
"react/jsx-sort-default-props": ["off", {
|
|
585
|
+
ignoreCase: true
|
|
586
|
+
}],
|
|
587
|
+
// Prevent usage of dangerous JSX properties
|
|
588
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
589
|
+
"react/no-danger": "warn",
|
|
590
|
+
// Prevent extra closing tags for components without children
|
|
591
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
592
|
+
"react/self-closing-comp": "error",
|
|
593
|
+
// Prevent missing parentheses around multilines JSX
|
|
594
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
|
|
595
|
+
"react/jsx-wrap-multilines": ["error", {
|
|
596
|
+
declaration: "parens-new-line",
|
|
597
|
+
assignment: "parens-new-line",
|
|
598
|
+
return: "parens-new-line",
|
|
599
|
+
arrow: "parens-new-line",
|
|
600
|
+
condition: "parens-new-line",
|
|
601
|
+
logical: "parens-new-line",
|
|
602
|
+
prop: "parens-new-line"
|
|
603
|
+
}],
|
|
604
|
+
// Require that the first prop in a JSX element be on a new line when the element is multiline
|
|
605
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
606
|
+
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
607
|
+
// Enforce spacing around jsx equals signs
|
|
608
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
609
|
+
"react/jsx-equals-spacing": ["error", "never"],
|
|
610
|
+
// Enforce JSX indentation
|
|
611
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
612
|
+
"react/jsx-indent": ["error", 2],
|
|
613
|
+
// Require style prop value be an object or var
|
|
614
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
615
|
+
"react/style-prop-object": "error",
|
|
616
|
+
// Validate whitespace in and around the JSX opening and closing brackets
|
|
617
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
|
|
618
|
+
"react/jsx-tag-spacing": ["error", {
|
|
619
|
+
closingSlash: "never",
|
|
620
|
+
beforeSelfClosing: "always",
|
|
621
|
+
afterOpening: "never",
|
|
622
|
+
beforeClosing: "never"
|
|
623
|
+
}],
|
|
624
|
+
// Enforces consistent naming for boolean props
|
|
625
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
|
|
626
|
+
"react/boolean-prop-naming": ["off", {
|
|
627
|
+
propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
|
|
628
|
+
rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
|
|
629
|
+
message: ""
|
|
630
|
+
}],
|
|
631
|
+
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
632
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
633
|
+
"react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
|
|
634
|
+
// One JSX Element Per Line
|
|
635
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
|
|
636
|
+
"react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
|
|
637
|
+
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
638
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
|
|
639
|
+
"react/destructuring-assignment": ["error", "always"],
|
|
640
|
+
// Ensures inline tags are not rendered without spaces between them
|
|
641
|
+
"react/jsx-child-element-spacing": "off",
|
|
642
|
+
// Validate JSX maximum depth
|
|
643
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
|
|
644
|
+
"react/jsx-max-depth": "off",
|
|
645
|
+
// Disallow multiple spaces between inline JSX props
|
|
646
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
|
|
647
|
+
"react/jsx-props-no-multi-spaces": "error",
|
|
648
|
+
// Enforce linebreaks in curly braces in JSX attributes and expressions.
|
|
649
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
650
|
+
"react/jsx-curly-newline": ["error", {
|
|
651
|
+
multiline: "consistent",
|
|
652
|
+
singleline: "consistent"
|
|
653
|
+
}],
|
|
654
|
+
// Enforce a new line after jsx elements and expressions
|
|
655
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-newline.md
|
|
656
|
+
"react/jsx-newline": "error"
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
|
|
661
|
+
// src/configs/sort-package-json.ts
|
|
662
|
+
var sortPackageJson = [
|
|
663
|
+
{
|
|
664
|
+
files: ["**/package.json"],
|
|
665
|
+
rules: {
|
|
666
|
+
"jsonc/sort-array-values": [
|
|
667
|
+
ERROR,
|
|
668
|
+
{
|
|
669
|
+
order: { type: "asc" },
|
|
670
|
+
pathPattern: "^files$"
|
|
671
|
+
}
|
|
672
|
+
],
|
|
673
|
+
"jsonc/sort-keys": [
|
|
674
|
+
ERROR,
|
|
675
|
+
{
|
|
676
|
+
order: [
|
|
677
|
+
"publisher",
|
|
678
|
+
"name",
|
|
679
|
+
"displayName",
|
|
680
|
+
"type",
|
|
681
|
+
"version",
|
|
682
|
+
"private",
|
|
683
|
+
"packageManager",
|
|
684
|
+
"description",
|
|
685
|
+
"author",
|
|
686
|
+
"license",
|
|
687
|
+
"funding",
|
|
688
|
+
"homepage",
|
|
689
|
+
"repository",
|
|
690
|
+
"bugs",
|
|
691
|
+
"keywords",
|
|
692
|
+
"categories",
|
|
693
|
+
"sideEffects",
|
|
694
|
+
"exports",
|
|
695
|
+
"main",
|
|
696
|
+
"module",
|
|
697
|
+
"unpkg",
|
|
698
|
+
"jsdelivr",
|
|
699
|
+
"types",
|
|
700
|
+
"typesVersions",
|
|
701
|
+
"bin",
|
|
702
|
+
"icon",
|
|
703
|
+
"files",
|
|
704
|
+
"engines",
|
|
705
|
+
"activationEvents",
|
|
706
|
+
"contributes",
|
|
707
|
+
"scripts",
|
|
708
|
+
"peerDependencies",
|
|
709
|
+
"peerDependenciesMeta",
|
|
710
|
+
"dependencies",
|
|
711
|
+
"optionalDependencies",
|
|
712
|
+
"devDependencies",
|
|
713
|
+
"pnpm",
|
|
714
|
+
"overrides",
|
|
715
|
+
"resolutions",
|
|
716
|
+
"husky",
|
|
717
|
+
"simple-git-hooks",
|
|
718
|
+
"lint-staged",
|
|
719
|
+
"eslintConfig"
|
|
720
|
+
],
|
|
721
|
+
pathPattern: "^$"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
order: { type: "asc" },
|
|
725
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
order: { type: "asc" },
|
|
729
|
+
pathPattern: "^resolutions$"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
order: { type: "asc" },
|
|
733
|
+
pathPattern: "^pnpm.overrides$"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
order: [
|
|
737
|
+
"types",
|
|
738
|
+
"import",
|
|
739
|
+
"require",
|
|
740
|
+
"default"
|
|
741
|
+
],
|
|
742
|
+
pathPattern: "^exports.*$"
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
];
|
|
748
|
+
var sortTsconfig = [
|
|
749
|
+
{
|
|
750
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
751
|
+
rules: {
|
|
752
|
+
"jsonc/sort-keys": [
|
|
753
|
+
ERROR,
|
|
754
|
+
{
|
|
755
|
+
order: [
|
|
756
|
+
"extends",
|
|
757
|
+
"compilerOptions",
|
|
758
|
+
"references",
|
|
759
|
+
"files",
|
|
760
|
+
"include",
|
|
761
|
+
"exclude"
|
|
762
|
+
],
|
|
763
|
+
pathPattern: "^$"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
order: [
|
|
767
|
+
/* Projects */
|
|
768
|
+
"incremental",
|
|
769
|
+
"composite",
|
|
770
|
+
"tsBuildInfoFile",
|
|
771
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
772
|
+
"disableSolutionSearching",
|
|
773
|
+
"disableReferencedProjectLoad",
|
|
774
|
+
/* Language and Environment */
|
|
775
|
+
"target",
|
|
776
|
+
"lib",
|
|
777
|
+
"jsx",
|
|
778
|
+
"experimentalDecorators",
|
|
779
|
+
"emitDecoratorMetadata",
|
|
780
|
+
"jsxFactory",
|
|
781
|
+
"jsxFragmentFactory",
|
|
782
|
+
"jsxImportSource",
|
|
783
|
+
"reactNamespace",
|
|
784
|
+
"noLib",
|
|
785
|
+
"useDefineForClassFields",
|
|
786
|
+
"moduleDetection",
|
|
787
|
+
/* Modules */
|
|
788
|
+
"module",
|
|
789
|
+
"rootDir",
|
|
790
|
+
"moduleResolution",
|
|
791
|
+
"baseUrl",
|
|
792
|
+
"paths",
|
|
793
|
+
"rootDirs",
|
|
794
|
+
"typeRoots",
|
|
795
|
+
"types",
|
|
796
|
+
"allowUmdGlobalAccess",
|
|
797
|
+
"moduleSuffixes",
|
|
798
|
+
"allowImportingTsExtensions",
|
|
799
|
+
"resolvePackageJsonExports",
|
|
800
|
+
"resolvePackageJsonImports",
|
|
801
|
+
"customConditions",
|
|
802
|
+
"resolveJsonModule",
|
|
803
|
+
"allowArbitraryExtensions",
|
|
804
|
+
"noResolve",
|
|
805
|
+
/* JavaScript Support */
|
|
806
|
+
"allowJs",
|
|
807
|
+
"checkJs",
|
|
808
|
+
"maxNodeModuleJsDepth",
|
|
809
|
+
/* Emit */
|
|
810
|
+
"declaration",
|
|
811
|
+
"declarationMap",
|
|
812
|
+
"emitDeclarationOnly",
|
|
813
|
+
"sourceMap",
|
|
814
|
+
"inlineSourceMap",
|
|
815
|
+
"outFile",
|
|
816
|
+
"outDir",
|
|
817
|
+
"removeComments",
|
|
818
|
+
"noEmit",
|
|
819
|
+
"importHelpers",
|
|
820
|
+
"importsNotUsedAsValues",
|
|
821
|
+
"downlevelIteration",
|
|
822
|
+
"sourceRoot",
|
|
823
|
+
"mapRoot",
|
|
824
|
+
"inlineSources",
|
|
825
|
+
"emitBOM",
|
|
826
|
+
"newLine",
|
|
827
|
+
"stripInternal",
|
|
828
|
+
"noEmitHelpers",
|
|
829
|
+
"noEmitOnError",
|
|
830
|
+
"preserveConstEnums",
|
|
831
|
+
"declarationDir",
|
|
832
|
+
"preserveValueImports",
|
|
833
|
+
/* Interop Constraints */
|
|
834
|
+
"isolatedModules",
|
|
835
|
+
"verbatimModuleSyntax",
|
|
836
|
+
"allowSyntheticDefaultImports",
|
|
837
|
+
"esModuleInterop",
|
|
838
|
+
"preserveSymlinks",
|
|
839
|
+
"forceConsistentCasingInFileNames",
|
|
840
|
+
/* Type Checking */
|
|
841
|
+
"strict",
|
|
842
|
+
"strictBindCallApply",
|
|
843
|
+
"strictFunctionTypes",
|
|
844
|
+
"strictNullChecks",
|
|
845
|
+
"strictPropertyInitialization",
|
|
846
|
+
"allowUnreachableCode",
|
|
847
|
+
"allowUnusedLabels",
|
|
848
|
+
"alwaysStrict",
|
|
849
|
+
"exactOptionalPropertyTypes",
|
|
850
|
+
"noFallthroughCasesInSwitch",
|
|
851
|
+
"noImplicitAny",
|
|
852
|
+
"noImplicitOverride",
|
|
853
|
+
"noImplicitReturns",
|
|
854
|
+
"noImplicitThis",
|
|
855
|
+
"noPropertyAccessFromIndexSignature",
|
|
856
|
+
"noUncheckedIndexedAccess",
|
|
857
|
+
"noUnusedLocals",
|
|
858
|
+
"noUnusedParameters",
|
|
859
|
+
"useUnknownInCatchVariables",
|
|
860
|
+
/* Completeness */
|
|
861
|
+
"skipDefaultLibCheck",
|
|
862
|
+
"skipLibCheck"
|
|
863
|
+
],
|
|
864
|
+
pathPattern: "^compilerOptions$"
|
|
865
|
+
}
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
];
|
|
870
|
+
|
|
871
|
+
// src/configs/stylistic.ts
|
|
872
|
+
import { packages } from "@eslint-stylistic/metadata";
|
|
873
|
+
var tsPackage = packages.find((i) => i.shortId === "ts");
|
|
874
|
+
var javascriptStylistic = [
|
|
875
|
+
{
|
|
876
|
+
plugins: {
|
|
877
|
+
style: default2
|
|
878
|
+
},
|
|
879
|
+
rules: {
|
|
880
|
+
"comma-dangle": [ERROR, "always-multiline"],
|
|
881
|
+
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
882
|
+
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
883
|
+
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
884
|
+
"style/arrow-spacing": [ERROR, { before: true, after: true }],
|
|
885
|
+
"style/block-spacing": [ERROR, ALWAYS],
|
|
886
|
+
"style/brace-style": [ERROR],
|
|
887
|
+
"style/comma-spacing": [ERROR, { before: false, after: true }],
|
|
888
|
+
"style/comma-style": [ERROR, "last"],
|
|
889
|
+
"style/computed-property-spacing": [ERROR, NEVER, { enforceForClassMembers: true }],
|
|
890
|
+
"style/dot-location": [ERROR, "property"],
|
|
891
|
+
"style/func-call-spacing": [ERROR, NEVER],
|
|
892
|
+
"style/indent": [ERROR, 2, {
|
|
893
|
+
SwitchCase: 1,
|
|
894
|
+
VariableDeclarator: 1,
|
|
895
|
+
outerIIFEBody: 1,
|
|
896
|
+
MemberExpression: 1,
|
|
897
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
898
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
|
899
|
+
CallExpression: { arguments: 1 },
|
|
900
|
+
ArrayExpression: 1,
|
|
901
|
+
ObjectExpression: 1,
|
|
902
|
+
ImportDeclaration: 1,
|
|
903
|
+
flatTernaryExpressions: false,
|
|
904
|
+
ignoreComments: false,
|
|
905
|
+
ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
|
|
906
|
+
offsetTernaryExpressions: true
|
|
907
|
+
}],
|
|
908
|
+
"style/key-spacing": [ERROR, { beforeColon: false, afterColon: true }],
|
|
909
|
+
"style/keyword-spacing": [ERROR, { before: true, after: true }],
|
|
910
|
+
"style/lines-between-class-members": [ERROR, ALWAYS, { exceptAfterSingleLine: true }],
|
|
911
|
+
"style/multiline-ternary": [ERROR, "always-multiline"],
|
|
912
|
+
"style/no-mixed-spaces-and-tabs": ERROR,
|
|
913
|
+
"style/no-multi-spaces": ERROR,
|
|
914
|
+
"style/no-multiple-empty-lines": [ERROR, { max: 1, maxBOF: 0, maxEOF: 1 }],
|
|
915
|
+
"style/no-tabs": ERROR,
|
|
916
|
+
"style/no-trailing-spaces": ERROR,
|
|
917
|
+
"style/no-whitespace-before-property": ERROR,
|
|
918
|
+
"style/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
|
|
919
|
+
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
920
|
+
"style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
921
|
+
"style/operator-linebreak": [ERROR, "before"],
|
|
922
|
+
"style/padded-blocks": [ERROR, { blocks: NEVER, switches: NEVER, classes: NEVER }],
|
|
923
|
+
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
924
|
+
"style/semi-spacing": [ERROR, { before: false, after: true }],
|
|
925
|
+
"style/space-before-blocks": [ERROR, ALWAYS],
|
|
926
|
+
"style/space-before-function-paren": [ERROR, {
|
|
927
|
+
anonymous: NEVER,
|
|
928
|
+
named: NEVER,
|
|
929
|
+
asyncArrow: ALWAYS
|
|
930
|
+
}],
|
|
931
|
+
"style/space-in-parens": [ERROR, NEVER],
|
|
932
|
+
"style/space-infix-ops": ERROR,
|
|
933
|
+
"style/space-unary-ops": [ERROR, { words: true, nonwords: false }],
|
|
934
|
+
"style/spaced-comment": [ERROR, "always", {
|
|
935
|
+
line: {
|
|
936
|
+
markers: ["/"],
|
|
937
|
+
exceptions: ["/", "#"]
|
|
938
|
+
},
|
|
939
|
+
block: {
|
|
940
|
+
markers: ["!"],
|
|
941
|
+
exceptions: ["*"],
|
|
942
|
+
balanced: true
|
|
943
|
+
}
|
|
944
|
+
}],
|
|
945
|
+
"style/template-curly-spacing": ERROR,
|
|
946
|
+
"style/template-tag-spacing": [ERROR, NEVER],
|
|
947
|
+
"style/yield-star-spacing": [ERROR, "both"]
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
];
|
|
951
|
+
var typescriptStylistic = [
|
|
952
|
+
{
|
|
953
|
+
plugins: {
|
|
954
|
+
"style-ts": default3,
|
|
955
|
+
"ts": default4
|
|
956
|
+
},
|
|
957
|
+
rules: {
|
|
958
|
+
...stylisticJsToTS(javascriptStylistic[0].rules),
|
|
959
|
+
"comma-dangle": OFF,
|
|
960
|
+
"ts/comma-dangle": [ERROR, "always-multiline"],
|
|
961
|
+
"quotes": OFF,
|
|
962
|
+
"ts/quotes": [ERROR, "single"],
|
|
963
|
+
"semi": OFF,
|
|
964
|
+
"ts/semi": [ERROR, ALWAYS],
|
|
965
|
+
"style-ts/member-delimiter-style": [ERROR],
|
|
966
|
+
"style-ts/type-annotation-spacing": [ERROR, {}]
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
];
|
|
970
|
+
function stylisticJsToTS(input) {
|
|
971
|
+
return {
|
|
972
|
+
// turn off all stylistic rules from style
|
|
973
|
+
...Object.fromEntries(
|
|
974
|
+
Object.entries(input).map(([key]) => {
|
|
975
|
+
if (!key.startsWith("style/")) {
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
;
|
|
979
|
+
const basename = key.replace("style/", "");
|
|
980
|
+
if (tsPackage.rules.find((i) => i.name === basename)) {
|
|
981
|
+
return [key, OFF];
|
|
982
|
+
}
|
|
983
|
+
;
|
|
984
|
+
return null;
|
|
985
|
+
}).filter(Boolean)
|
|
986
|
+
),
|
|
987
|
+
// rename all stylistic rules from style to style/ts
|
|
988
|
+
...Object.fromEntries(
|
|
989
|
+
Object.entries(input).map(([key, value]) => {
|
|
990
|
+
if (!key.startsWith("style/")) {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
;
|
|
994
|
+
const basename = key.replace("style/", "");
|
|
995
|
+
return tsPackage.rules.find((i) => i.name === basename) ? [`style-ts/${basename}`, value] : null;
|
|
996
|
+
}).filter(Boolean)
|
|
997
|
+
)
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/configs/test.ts
|
|
1002
|
+
function test(options = {}) {
|
|
1003
|
+
return [
|
|
1004
|
+
{
|
|
1005
|
+
files: GLOB_TESTS,
|
|
1006
|
+
plugins: {
|
|
1007
|
+
"no-only-tests": default12
|
|
1008
|
+
},
|
|
1009
|
+
rules: {
|
|
1010
|
+
"no-only-tests/no-only-tests": options.isInEditor ? OFF : ERROR
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
];
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// src/configs/typescript.ts
|
|
1017
|
+
import process from "process";
|
|
1018
|
+
function typescript(options) {
|
|
1019
|
+
const {
|
|
1020
|
+
componentExts = []
|
|
1021
|
+
} = options ?? {};
|
|
1022
|
+
return [
|
|
1023
|
+
{
|
|
1024
|
+
files: [
|
|
1025
|
+
GLOB_TS,
|
|
1026
|
+
GLOB_TSX,
|
|
1027
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1028
|
+
],
|
|
1029
|
+
languageOptions: {
|
|
1030
|
+
parser: default5,
|
|
1031
|
+
parserOptions: {
|
|
1032
|
+
sourceType: "module"
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
plugins: {
|
|
1036
|
+
// antfu: pluginAntfu,
|
|
1037
|
+
import: default7,
|
|
1038
|
+
ts: default4
|
|
1039
|
+
},
|
|
1040
|
+
rules: {
|
|
1041
|
+
...renameRules(
|
|
1042
|
+
default4.configs["eslint-recommended"].overrides[0].rules,
|
|
1043
|
+
"@typescript-eslint/",
|
|
1044
|
+
"ts/"
|
|
1045
|
+
),
|
|
1046
|
+
...renameRules(
|
|
1047
|
+
default4.configs.strict.rules,
|
|
1048
|
+
"@typescript-eslint/",
|
|
1049
|
+
"ts/"
|
|
1050
|
+
),
|
|
1051
|
+
"no-dupe-class-members": OFF,
|
|
1052
|
+
"ts/no-dupe-class-members": ERROR,
|
|
1053
|
+
"no-extra-parens": OFF,
|
|
1054
|
+
"ts/no-extra-parens": [ERROR, "functions"],
|
|
1055
|
+
"no-invalid-this": OFF,
|
|
1056
|
+
"ts/no-invalid-this": ERROR,
|
|
1057
|
+
"no-loss-of-precision": OFF,
|
|
1058
|
+
"ts/no-loss-of-precision": ERROR,
|
|
1059
|
+
"no-redeclare": OFF,
|
|
1060
|
+
"ts/no-redeclare": ERROR,
|
|
1061
|
+
"no-use-before-define": OFF,
|
|
1062
|
+
"ts/no-use-before-define": [ERROR, { functions: false, classes: false, variables: true }],
|
|
1063
|
+
"no-useless-constructor": OFF,
|
|
1064
|
+
"ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
|
|
1065
|
+
"ts/ban-ts-ignore": OFF,
|
|
1066
|
+
"ts/consistent-indexed-object-style": OFF,
|
|
1067
|
+
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
1068
|
+
"ts/consistent-type-imports": [ERROR, { prefer: "type-imports", disallowTypeAnnotations: false }],
|
|
1069
|
+
"ts/explicit-function-return-type": OFF,
|
|
1070
|
+
"ts/explicit-member-accessibility": OFF,
|
|
1071
|
+
"ts/explicit-module-boundary-types": OFF,
|
|
1072
|
+
"ts/naming-convention": OFF,
|
|
1073
|
+
"ts/no-empty-function": OFF,
|
|
1074
|
+
"ts/no-empty-interface": OFF,
|
|
1075
|
+
"ts/no-explicit-any": OFF,
|
|
1076
|
+
"ts/no-invalid-void-type": OFF,
|
|
1077
|
+
"ts/no-non-null-assertion": OFF,
|
|
1078
|
+
"ts/no-require-imports": ERROR,
|
|
1079
|
+
"no-unused-vars": OFF,
|
|
1080
|
+
"ts/no-unused-vars": [ERROR, {
|
|
1081
|
+
argsIgnorePattern: "^_",
|
|
1082
|
+
destructuredArrayIgnorePattern: "^_",
|
|
1083
|
+
ignoreRestSiblings: true
|
|
1084
|
+
}],
|
|
1085
|
+
"ts/parameter-properties": OFF,
|
|
1086
|
+
"ts/prefer-ts-expect-error": ERROR,
|
|
1087
|
+
"ts/triple-slash-reference": OFF
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
files: ["**/*.d.ts"],
|
|
1092
|
+
rules: {
|
|
1093
|
+
"eslint-comments/no-unlimited-disable": OFF,
|
|
1094
|
+
"import/no-duplicates": OFF,
|
|
1095
|
+
"unused-imports/no-unused-vars": OFF
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1100
|
+
rules: {
|
|
1101
|
+
"no-unused-expressions": OFF
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1106
|
+
rules: {
|
|
1107
|
+
"ts/no-require-imports": OFF,
|
|
1108
|
+
"ts/no-var-requires": OFF
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
];
|
|
1112
|
+
}
|
|
1113
|
+
function typescriptWithLanguageServer(options) {
|
|
1114
|
+
const {
|
|
1115
|
+
componentExts = [],
|
|
1116
|
+
tsconfigPath,
|
|
1117
|
+
tsconfigRootDir = process.cwd()
|
|
1118
|
+
} = options;
|
|
1119
|
+
return [
|
|
1120
|
+
{
|
|
1121
|
+
files: [
|
|
1122
|
+
GLOB_TS,
|
|
1123
|
+
GLOB_TSX,
|
|
1124
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1125
|
+
],
|
|
1126
|
+
ignores: ["**/*.md/*.*"],
|
|
1127
|
+
languageOptions: {
|
|
1128
|
+
parser: default5,
|
|
1129
|
+
parserOptions: {
|
|
1130
|
+
project: [tsconfigPath],
|
|
1131
|
+
tsconfigRootDir
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
plugins: {
|
|
1135
|
+
ts: default4
|
|
1136
|
+
},
|
|
1137
|
+
rules: {
|
|
1138
|
+
"dot-notation": OFF,
|
|
1139
|
+
"ts/dot-notation": [ERROR, { allowKeywords: true }],
|
|
1140
|
+
"no-implied-eval": OFF,
|
|
1141
|
+
"ts/no-implied-eval": ERROR,
|
|
1142
|
+
"no-throw-literal": OFF,
|
|
1143
|
+
"ts/no-throw-literal": ERROR,
|
|
1144
|
+
"require-await": OFF,
|
|
1145
|
+
"ts/require-await": ERROR,
|
|
1146
|
+
"ts/await-thenable": ERROR,
|
|
1147
|
+
"ts/no-floating-promises": ERROR,
|
|
1148
|
+
"ts/no-for-in-array": ERROR,
|
|
1149
|
+
"ts/no-misused-promises": ERROR,
|
|
1150
|
+
"ts/no-unnecessary-type-assertion": ERROR,
|
|
1151
|
+
"ts/no-unsafe-argument": ERROR,
|
|
1152
|
+
"ts/no-unsafe-assignment": ERROR,
|
|
1153
|
+
"ts/no-unsafe-call": ERROR,
|
|
1154
|
+
"ts/no-unsafe-member-access": ERROR,
|
|
1155
|
+
"ts/no-unsafe-return": ERROR,
|
|
1156
|
+
"ts/restrict-plus-operands": ERROR,
|
|
1157
|
+
"ts/restrict-template-expressions": ERROR,
|
|
1158
|
+
"ts/unbound-method": ERROR
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
];
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
// src/configs/unicorn.ts
|
|
1165
|
+
var unicorn = [
|
|
1166
|
+
{
|
|
1167
|
+
plugins: {
|
|
1168
|
+
unicorn: default13
|
|
1169
|
+
},
|
|
1170
|
+
rules: {
|
|
1171
|
+
// Pass error message when throwing errors
|
|
1172
|
+
"unicorn/error-message": ERROR,
|
|
1173
|
+
// Uppercase regex escapes
|
|
1174
|
+
"unicorn/escape-case": ERROR,
|
|
1175
|
+
// Array.isArray instead of instanceof
|
|
1176
|
+
"unicorn/no-instanceof-array": ERROR,
|
|
1177
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1178
|
+
"unicorn/no-new-array": ERROR,
|
|
1179
|
+
// Prevent deprecated `new Buffer()`
|
|
1180
|
+
"unicorn/no-new-buffer": ERROR,
|
|
1181
|
+
// Keep regex literals safe!
|
|
1182
|
+
"unicorn/no-unsafe-regex": ERROR,
|
|
1183
|
+
// Lowercase number formatting for octal, hex, binary (0x1ERROR instead of 0X1ERROR)
|
|
1184
|
+
"unicorn/number-literal-case": ERROR,
|
|
1185
|
+
// includes over indexOf when checking for existence
|
|
1186
|
+
"unicorn/prefer-includes": ERROR,
|
|
1187
|
+
// Prefer using the node: protocol
|
|
1188
|
+
"unicorn/prefer-node-protocol": ERROR,
|
|
1189
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1190
|
+
"unicorn/prefer-number-properties": ERROR,
|
|
1191
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1192
|
+
"unicorn/prefer-string-starts-ends-with": ERROR,
|
|
1193
|
+
// textContent instead of innerText
|
|
1194
|
+
"unicorn/prefer-text-content": ERROR,
|
|
1195
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1196
|
+
"unicorn/prefer-type-error": ERROR,
|
|
1197
|
+
// Use new when throwing error
|
|
1198
|
+
"unicorn/throw-new-error": ERROR
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
];
|
|
1202
|
+
|
|
1203
|
+
// src/configs/vue.ts
|
|
1204
|
+
function vue(options = {}) {
|
|
1205
|
+
return [
|
|
1206
|
+
{
|
|
1207
|
+
files: [GLOB_VUE],
|
|
1208
|
+
languageOptions: {
|
|
1209
|
+
parser: default20,
|
|
1210
|
+
parserOptions: {
|
|
1211
|
+
ecmaFeatures: {
|
|
1212
|
+
jsx: true
|
|
1213
|
+
},
|
|
1214
|
+
extraFileExtensions: [".vue"],
|
|
1215
|
+
parser: options.typescript ? default5 : null,
|
|
1216
|
+
sourceType: "module"
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
plugins: {
|
|
1220
|
+
vue: default17
|
|
1221
|
+
},
|
|
1222
|
+
processor: default17.processors[".vue"],
|
|
1223
|
+
rules: {
|
|
1224
|
+
...default17.configs.base.rules,
|
|
1225
|
+
...default17.configs["vue3-essential"].rules,
|
|
1226
|
+
...default17.configs["vue3-strongly-recommended"].rules,
|
|
1227
|
+
...default17.configs["vue3-recommended"].rules,
|
|
1228
|
+
"vue/array-bracket-spacing": [
|
|
1229
|
+
ERROR,
|
|
1230
|
+
NEVER
|
|
1231
|
+
],
|
|
1232
|
+
"vue/arrow-spacing": [
|
|
1233
|
+
ERROR,
|
|
1234
|
+
{
|
|
1235
|
+
after: true,
|
|
1236
|
+
before: true
|
|
1237
|
+
}
|
|
1238
|
+
],
|
|
1239
|
+
"vue/block-order": [
|
|
1240
|
+
ERROR,
|
|
1241
|
+
{
|
|
1242
|
+
order: [
|
|
1243
|
+
"script",
|
|
1244
|
+
"template",
|
|
1245
|
+
"style"
|
|
1246
|
+
]
|
|
1247
|
+
}
|
|
1248
|
+
],
|
|
1249
|
+
"vue/block-spacing": [
|
|
1250
|
+
ERROR,
|
|
1251
|
+
ALWAYS
|
|
1252
|
+
],
|
|
1253
|
+
"vue/block-tag-newline": [
|
|
1254
|
+
ERROR,
|
|
1255
|
+
{
|
|
1256
|
+
multiline: ALWAYS,
|
|
1257
|
+
singleline: ALWAYS
|
|
1258
|
+
}
|
|
1259
|
+
],
|
|
1260
|
+
"vue/brace-style": [
|
|
1261
|
+
ERROR,
|
|
1262
|
+
"stroustrup",
|
|
1263
|
+
{ allowSingleLine: true }
|
|
1264
|
+
],
|
|
1265
|
+
"vue/comma-dangle": [
|
|
1266
|
+
ERROR,
|
|
1267
|
+
"always-multiline"
|
|
1268
|
+
],
|
|
1269
|
+
"vue/comma-spacing": [
|
|
1270
|
+
ERROR,
|
|
1271
|
+
{
|
|
1272
|
+
after: true,
|
|
1273
|
+
before: false
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
"vue/comma-style": [
|
|
1277
|
+
ERROR,
|
|
1278
|
+
"last"
|
|
1279
|
+
],
|
|
1280
|
+
"vue/component-name-in-template-casing": [
|
|
1281
|
+
ERROR,
|
|
1282
|
+
"PascalCase"
|
|
1283
|
+
],
|
|
1284
|
+
"vue/component-options-name-casing": [
|
|
1285
|
+
ERROR,
|
|
1286
|
+
"PascalCase"
|
|
1287
|
+
],
|
|
1288
|
+
"vue/custom-event-name-casing": [
|
|
1289
|
+
ERROR,
|
|
1290
|
+
"camelCase"
|
|
1291
|
+
],
|
|
1292
|
+
"vue/define-macros-order": [
|
|
1293
|
+
ERROR,
|
|
1294
|
+
{
|
|
1295
|
+
order: [
|
|
1296
|
+
"defineOptions",
|
|
1297
|
+
"defineProps",
|
|
1298
|
+
"defineEmits",
|
|
1299
|
+
"defineSlots"
|
|
1300
|
+
]
|
|
1301
|
+
}
|
|
1302
|
+
],
|
|
1303
|
+
"vue/dot-location": [
|
|
1304
|
+
ERROR,
|
|
1305
|
+
"property"
|
|
1306
|
+
],
|
|
1307
|
+
"vue/dot-notation": [
|
|
1308
|
+
ERROR,
|
|
1309
|
+
{ allowKeywords: true }
|
|
1310
|
+
],
|
|
1311
|
+
"vue/eqeqeq": [
|
|
1312
|
+
ERROR,
|
|
1313
|
+
"smart"
|
|
1314
|
+
],
|
|
1315
|
+
"vue/html-comment-content-spacing": [
|
|
1316
|
+
ERROR,
|
|
1317
|
+
ALWAYS,
|
|
1318
|
+
{
|
|
1319
|
+
exceptions: ["-"]
|
|
1320
|
+
}
|
|
1321
|
+
],
|
|
1322
|
+
"vue/key-spacing": [
|
|
1323
|
+
ERROR,
|
|
1324
|
+
{
|
|
1325
|
+
afterColon: true,
|
|
1326
|
+
beforeColon: false
|
|
1327
|
+
}
|
|
1328
|
+
],
|
|
1329
|
+
"vue/keyword-spacing": [
|
|
1330
|
+
ERROR,
|
|
1331
|
+
{
|
|
1332
|
+
after: true,
|
|
1333
|
+
before: true
|
|
1334
|
+
}
|
|
1335
|
+
],
|
|
1336
|
+
"vue/max-attributes-per-line": OFF,
|
|
1337
|
+
"vue/multi-word-component-names": OFF,
|
|
1338
|
+
"vue/no-constant-condition": WARN,
|
|
1339
|
+
"vue/no-dupe-keys": OFF,
|
|
1340
|
+
"vue/no-empty-pattern": ERROR,
|
|
1341
|
+
"vue/no-extra-parens": [
|
|
1342
|
+
ERROR,
|
|
1343
|
+
"functions"
|
|
1344
|
+
],
|
|
1345
|
+
"vue/no-irregular-whitespace": ERROR,
|
|
1346
|
+
"vue/no-loss-of-precision": ERROR,
|
|
1347
|
+
"vue/no-restricted-syntax": [
|
|
1348
|
+
ERROR,
|
|
1349
|
+
"DebuggerStatement",
|
|
1350
|
+
"LabeledStatement",
|
|
1351
|
+
"WithStatement"
|
|
1352
|
+
],
|
|
1353
|
+
"vue/no-restricted-v-bind": [
|
|
1354
|
+
ERROR,
|
|
1355
|
+
"/^v-/"
|
|
1356
|
+
],
|
|
1357
|
+
// reactivity transform
|
|
1358
|
+
"vue/no-setup-props-reactivity-loss": OFF,
|
|
1359
|
+
"vue/no-sparse-arrays": ERROR,
|
|
1360
|
+
"vue/no-unused-refs": ERROR,
|
|
1361
|
+
"vue/no-useless-v-bind": ERROR,
|
|
1362
|
+
"vue/no-v-html": OFF,
|
|
1363
|
+
"vue/no-v-text-v-html-on-component": "off",
|
|
1364
|
+
"vue/object-curly-newline": [ERROR, { multiline: true, consistent: true }],
|
|
1365
|
+
"vue/object-curly-spacing": [
|
|
1366
|
+
ERROR,
|
|
1367
|
+
ALWAYS
|
|
1368
|
+
],
|
|
1369
|
+
"vue/object-property-newline": [
|
|
1370
|
+
ERROR,
|
|
1371
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
1372
|
+
],
|
|
1373
|
+
"vue/object-shorthand": [
|
|
1374
|
+
ERROR,
|
|
1375
|
+
ALWAYS,
|
|
1376
|
+
{
|
|
1377
|
+
avoidQuotes: true,
|
|
1378
|
+
ignoreConstructors: false
|
|
1379
|
+
}
|
|
1380
|
+
],
|
|
1381
|
+
"vue/operator-linebreak": [
|
|
1382
|
+
ERROR,
|
|
1383
|
+
"before"
|
|
1384
|
+
],
|
|
1385
|
+
"vue/padding-line-between-blocks": [
|
|
1386
|
+
ERROR,
|
|
1387
|
+
ALWAYS
|
|
1388
|
+
],
|
|
1389
|
+
"vue/prefer-import-from-vue": OFF,
|
|
1390
|
+
"vue/prefer-separate-static-class": ERROR,
|
|
1391
|
+
"vue/prefer-template": ERROR,
|
|
1392
|
+
"vue/quote-props": [
|
|
1393
|
+
ERROR,
|
|
1394
|
+
"consistent-as-needed"
|
|
1395
|
+
],
|
|
1396
|
+
"vue/require-default-prop": OFF,
|
|
1397
|
+
"vue/require-prop-types": OFF,
|
|
1398
|
+
"vue/space-in-parens": [
|
|
1399
|
+
ERROR,
|
|
1400
|
+
NEVER
|
|
1401
|
+
],
|
|
1402
|
+
"vue/space-infix-ops": ERROR,
|
|
1403
|
+
"vue/space-unary-ops": [
|
|
1404
|
+
ERROR,
|
|
1405
|
+
{
|
|
1406
|
+
nonwords: false,
|
|
1407
|
+
words: true
|
|
1408
|
+
}
|
|
1409
|
+
],
|
|
1410
|
+
"vue/template-curly-spacing": ERROR
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
];
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// src/configs/yml.ts
|
|
1417
|
+
var yml = [
|
|
1418
|
+
{
|
|
1419
|
+
files: [GLOB_YAML],
|
|
1420
|
+
languageOptions: {
|
|
1421
|
+
parser: default21
|
|
1422
|
+
},
|
|
1423
|
+
plugins: {
|
|
1424
|
+
yml: default18
|
|
1425
|
+
},
|
|
1426
|
+
rules: {
|
|
1427
|
+
...default18.configs.standard.rules,
|
|
1428
|
+
"style/spaced-comment": OFF,
|
|
1429
|
+
"yml/no-empty-document": OFF,
|
|
1430
|
+
"yml/no-empty-mapping-value": OFF,
|
|
1431
|
+
"yml/quotes": [ERROR, { avoidEscape: false, prefer: "single" }]
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
];
|
|
1435
|
+
|
|
1436
|
+
// src/base.ts
|
|
1437
|
+
function vinicuncaESLint({ options = {}, userConfigs = [] }) {
|
|
1438
|
+
const isInEditor = options.isInEditor ?? !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI);
|
|
1439
|
+
const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
|
|
1440
|
+
const enableTypeScript = options.typescript ?? isPackageExists("typescript");
|
|
1441
|
+
const enableStylistic = options.stylistic ?? true;
|
|
1442
|
+
const configs = [
|
|
1443
|
+
ignores,
|
|
1444
|
+
javascript({ isInEditor }),
|
|
1445
|
+
comments,
|
|
1446
|
+
node,
|
|
1447
|
+
jsdoc,
|
|
1448
|
+
imports,
|
|
1449
|
+
unicorn
|
|
1450
|
+
];
|
|
1451
|
+
const componentExts = [];
|
|
1452
|
+
if (enableVue) {
|
|
1453
|
+
componentExts.push("vue");
|
|
1454
|
+
}
|
|
1455
|
+
if (enableStylistic) {
|
|
1456
|
+
configs.push(javascriptStylistic);
|
|
1457
|
+
}
|
|
1458
|
+
if (enableTypeScript) {
|
|
1459
|
+
configs.push(typescript({ componentExts }));
|
|
1460
|
+
if (!isBoolean(enableTypeScript)) {
|
|
1461
|
+
configs.push(typescriptWithLanguageServer({
|
|
1462
|
+
...enableTypeScript,
|
|
1463
|
+
componentExts
|
|
1464
|
+
}));
|
|
1465
|
+
}
|
|
1466
|
+
if (enableStylistic) {
|
|
1467
|
+
configs.push(typescriptStylistic);
|
|
1468
|
+
}
|
|
1469
|
+
;
|
|
1470
|
+
}
|
|
1471
|
+
if (options.test ?? true) {
|
|
1472
|
+
configs.push(test({ isInEditor }));
|
|
1473
|
+
}
|
|
1474
|
+
;
|
|
1475
|
+
if (enableVue) {
|
|
1476
|
+
configs.push(vue({ typescript: !!enableTypeScript }));
|
|
1477
|
+
}
|
|
1478
|
+
;
|
|
1479
|
+
if (options.jsonc ?? true) {
|
|
1480
|
+
configs.push(
|
|
1481
|
+
jsonc,
|
|
1482
|
+
sortPackageJson,
|
|
1483
|
+
sortTsconfig
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
if (options.yaml ?? true) {
|
|
1487
|
+
configs.push(yml);
|
|
1488
|
+
}
|
|
1489
|
+
;
|
|
1490
|
+
if (options.markdown ?? true) {
|
|
1491
|
+
configs.push(markdown({ componentExts }));
|
|
1492
|
+
}
|
|
1493
|
+
;
|
|
1494
|
+
if (options.react) {
|
|
1495
|
+
configs.push(react);
|
|
1496
|
+
}
|
|
1497
|
+
return combineConfigs(
|
|
1498
|
+
...configs,
|
|
1499
|
+
...userConfigs
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
// src/index.ts
|
|
1504
|
+
var src_default = vinicuncaESLint;
|
|
1505
|
+
export {
|
|
1506
|
+
combineConfigs,
|
|
1507
|
+
comments,
|
|
1508
|
+
src_default as default,
|
|
1509
|
+
ignores,
|
|
1510
|
+
imports,
|
|
1511
|
+
javascript,
|
|
1512
|
+
javascriptStylistic,
|
|
1513
|
+
jsdoc,
|
|
1514
|
+
jsonc,
|
|
1515
|
+
markdown,
|
|
1516
|
+
node,
|
|
1517
|
+
react,
|
|
1518
|
+
renameRules,
|
|
1519
|
+
sortPackageJson,
|
|
1520
|
+
sortTsconfig,
|
|
1521
|
+
test,
|
|
1522
|
+
typescript,
|
|
1523
|
+
typescriptStylistic,
|
|
1524
|
+
typescriptWithLanguageServer,
|
|
1525
|
+
unicorn,
|
|
1526
|
+
vinicuncaESLint,
|
|
1527
|
+
vue,
|
|
1528
|
+
yml
|
|
1529
|
+
};
|