@so1ve/eslint-config 1.5.3 → 2.0.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/package.json +4 -4
- package/dist/index.cjs +0 -1706
package/dist/index.cjs
DELETED
|
@@ -1,1706 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var pluginComments = require('@eslint-community/eslint-plugin-eslint-comments');
|
|
4
|
-
var pluginHtml = require('@html-eslint/eslint-plugin');
|
|
5
|
-
var parserHtml = require('@html-eslint/parser');
|
|
6
|
-
var pluginSo1ve = require('@so1ve/eslint-plugin');
|
|
7
|
-
var pluginSortImports = require('@so1ve/eslint-plugin-sort-imports');
|
|
8
|
-
var pluginStylistic = require('@stylistic/eslint-plugin');
|
|
9
|
-
var eslintMdx = require('eslint-mdx');
|
|
10
|
-
var pluginArrayFunc = require('eslint-plugin-array-func');
|
|
11
|
-
var pluginEtc = require('eslint-plugin-etc');
|
|
12
|
-
var pluginHtmlJsSupport = require('eslint-plugin-html');
|
|
13
|
-
var pluginImport = require('eslint-plugin-i');
|
|
14
|
-
var pluginJestFormatting = require('eslint-plugin-jest-formatting');
|
|
15
|
-
var pluginJsonSchemaValidator = require('eslint-plugin-json-schema-validator');
|
|
16
|
-
var pluginJsonc = require('eslint-plugin-jsonc');
|
|
17
|
-
var pluginMdx = require('eslint-plugin-mdx');
|
|
18
|
-
var pluginNode = require('eslint-plugin-n');
|
|
19
|
-
var pluginNoAwaitInPromise = require('eslint-plugin-no-await-in-promise');
|
|
20
|
-
var pluginNoOnlyTests = require('eslint-plugin-no-only-tests');
|
|
21
|
-
var pluginOnlyError = require('eslint-plugin-only-error');
|
|
22
|
-
var pluginPromise = require('eslint-plugin-promise');
|
|
23
|
-
var pluginRegexp = require('eslint-plugin-regexp');
|
|
24
|
-
var pluginSolid = require('eslint-plugin-solid');
|
|
25
|
-
var pluginToml = require('eslint-plugin-toml');
|
|
26
|
-
var pluginUnicorn = require('eslint-plugin-unicorn');
|
|
27
|
-
var pluginUnusedImports = require('eslint-plugin-unused-imports');
|
|
28
|
-
var pluginVitest = require('eslint-plugin-vitest');
|
|
29
|
-
var pluginVue = require('eslint-plugin-vue');
|
|
30
|
-
var pluginYaml = require('eslint-plugin-yml');
|
|
31
|
-
var parserJsonc = require('jsonc-eslint-parser');
|
|
32
|
-
var parserToml = require('toml-eslint-parser');
|
|
33
|
-
var parserVue = require('vue-eslint-parser');
|
|
34
|
-
var parserYaml = require('yaml-eslint-parser');
|
|
35
|
-
var globals = require('globals');
|
|
36
|
-
var tseslint = require('typescript-eslint');
|
|
37
|
-
var fs = require('node:fs');
|
|
38
|
-
var gitignore = require('eslint-config-flat-gitignore');
|
|
39
|
-
var localPkg = require('local-pkg');
|
|
40
|
-
|
|
41
|
-
function _interopNamespaceDefault(e) {
|
|
42
|
-
var n = Object.create(null);
|
|
43
|
-
if (e) {
|
|
44
|
-
Object.keys(e).forEach(function (k) {
|
|
45
|
-
if (k !== 'default') {
|
|
46
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
47
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () { return e[k]; }
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
n.default = e;
|
|
55
|
-
return Object.freeze(n);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var pluginNoAwaitInPromise__namespace = /*#__PURE__*/_interopNamespaceDefault(pluginNoAwaitInPromise);
|
|
59
|
-
|
|
60
|
-
const comments = () => [
|
|
61
|
-
{
|
|
62
|
-
plugins: {
|
|
63
|
-
"eslint-comments": pluginComments
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
rules: {
|
|
68
|
-
"eslint-comments/no-aggregating-enable": "error",
|
|
69
|
-
"eslint-comments/no-duplicate-disable": "error",
|
|
70
|
-
"eslint-comments/no-unused-enable": "error",
|
|
71
|
-
"eslint-comments/disable-enable-pair": "off",
|
|
72
|
-
"eslint-comments/no-unlimited-disable": "off"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
78
|
-
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
79
|
-
const GLOB_JS = "**/*.?([cm])js";
|
|
80
|
-
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
81
|
-
const GLOB_TS = "**/*.?([cm])ts";
|
|
82
|
-
const GLOB_TSX = "**/*.?([cm])tsx";
|
|
83
|
-
const GLOB_DTS = "**/*.d.?([cm])tsx";
|
|
84
|
-
const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
85
|
-
const GLOB_CSS = "**/*.css";
|
|
86
|
-
const GLOB_LESS = "**/*.less";
|
|
87
|
-
const GLOB_SCSS = "**/*.scss";
|
|
88
|
-
const GLOB_JSON = "**/*.json";
|
|
89
|
-
const GLOB_JSON5 = "**/*.json5";
|
|
90
|
-
const GLOB_JSONC = "**/*.jsonc";
|
|
91
|
-
const GLOB_ESLINTRC = "**/.eslintrc";
|
|
92
|
-
const GLOB_MARKDOWN = "**/*.md?(x)";
|
|
93
|
-
const GLOB_VUE = "**/*.vue";
|
|
94
|
-
const GLOB_YAML = "**/*.y?(a)ml";
|
|
95
|
-
const GLOB_TOML = "**/*.toml";
|
|
96
|
-
const GLOB_HTML = "**/*.htm?(l)";
|
|
97
|
-
const GLOB_PACKAGEJSON = "**/package.json";
|
|
98
|
-
const GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
99
|
-
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
100
|
-
const GLOB_TESTS = [
|
|
101
|
-
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
102
|
-
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
103
|
-
`**/*.test.${GLOB_SRC_EXT}`,
|
|
104
|
-
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
105
|
-
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
106
|
-
];
|
|
107
|
-
const GLOB_ALL_SRC = [
|
|
108
|
-
GLOB_SRC,
|
|
109
|
-
GLOB_STYLE,
|
|
110
|
-
GLOB_JSON,
|
|
111
|
-
GLOB_JSON5,
|
|
112
|
-
GLOB_ESLINTRC,
|
|
113
|
-
GLOB_MARKDOWN,
|
|
114
|
-
GLOB_VUE,
|
|
115
|
-
GLOB_YAML,
|
|
116
|
-
GLOB_HTML
|
|
117
|
-
];
|
|
118
|
-
const GLOB_EXCLUDE = [
|
|
119
|
-
"**/node_modules",
|
|
120
|
-
"**/dist",
|
|
121
|
-
"**/out",
|
|
122
|
-
"**/output",
|
|
123
|
-
"**/package-lock.json",
|
|
124
|
-
"**/yarn.lock",
|
|
125
|
-
"**/pnpm-lock.yaml",
|
|
126
|
-
"**/bun.lockb",
|
|
127
|
-
"**/coverage",
|
|
128
|
-
"**/temp",
|
|
129
|
-
"**/.vitepress/cache",
|
|
130
|
-
"**/.nuxt",
|
|
131
|
-
"**/.nitro",
|
|
132
|
-
"**/.vercel",
|
|
133
|
-
"**/.netlify",
|
|
134
|
-
"**/.output",
|
|
135
|
-
"**/.vercel",
|
|
136
|
-
"**/.changeset",
|
|
137
|
-
"**/.idea",
|
|
138
|
-
"**/.vite-inspect",
|
|
139
|
-
"**/.yarn",
|
|
140
|
-
"**/CHANGELOG*.md",
|
|
141
|
-
"**/*.min.*",
|
|
142
|
-
"**/LICENSE*",
|
|
143
|
-
"**/__snapshots__",
|
|
144
|
-
"**/auto-import?(s).d.ts",
|
|
145
|
-
"**/components.d.ts",
|
|
146
|
-
// Volar
|
|
147
|
-
"**/*.vue.js",
|
|
148
|
-
"**/*.vue.jsx",
|
|
149
|
-
"**/*.vue.ts",
|
|
150
|
-
"**/*.vue.tsx"
|
|
151
|
-
];
|
|
152
|
-
|
|
153
|
-
const formatting = (options) => {
|
|
154
|
-
var _a, _b;
|
|
155
|
-
return [
|
|
156
|
-
{
|
|
157
|
-
plugins: {
|
|
158
|
-
style: pluginStylistic
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
rules: {
|
|
163
|
-
"curly": ["error", "all"],
|
|
164
|
-
"so1ve/no-useless-template-string": "error",
|
|
165
|
-
"so1ve/no-negated-comparison": "error",
|
|
166
|
-
"so1ve/no-import-promises-as": "error",
|
|
167
|
-
"so1ve/pad-after-last-import": "error",
|
|
168
|
-
"so1ve/function-style": "error",
|
|
169
|
-
"style/quote-props": ["error", "consistent-as-needed"],
|
|
170
|
-
"style/padding-line-between-statements": [
|
|
171
|
-
"error",
|
|
172
|
-
{ blankLine: "always", prev: "*", next: "return" }
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
((_a = options.jsonc) != null ? _a : true) && [
|
|
177
|
-
{
|
|
178
|
-
files: [GLOB_PACKAGEJSON],
|
|
179
|
-
rules: {
|
|
180
|
-
"jsonc/sort-keys": [
|
|
181
|
-
"error",
|
|
182
|
-
{
|
|
183
|
-
pathPattern: "^exports$",
|
|
184
|
-
order: { type: "asc" }
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
pathPattern: "^exports.*$",
|
|
188
|
-
order: ["types", "require", "import", "default"]
|
|
189
|
-
}
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
files: GLOB_TSCONFIG,
|
|
195
|
-
rules: {
|
|
196
|
-
"jsonc/sort-keys": [
|
|
197
|
-
"error",
|
|
198
|
-
{
|
|
199
|
-
order: [
|
|
200
|
-
"extends",
|
|
201
|
-
"compilerOptions",
|
|
202
|
-
"references",
|
|
203
|
-
"files",
|
|
204
|
-
"include",
|
|
205
|
-
"exclude"
|
|
206
|
-
],
|
|
207
|
-
pathPattern: "^$"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
order: [
|
|
211
|
-
/* Projects */
|
|
212
|
-
"incremental",
|
|
213
|
-
"composite",
|
|
214
|
-
"tsBuildInfoFile",
|
|
215
|
-
"disableSourceOfProjectReferenceRedirect",
|
|
216
|
-
"disableSolutionSearching",
|
|
217
|
-
"disableReferencedProjectLoad",
|
|
218
|
-
/* Language and Environment */
|
|
219
|
-
"target",
|
|
220
|
-
"jsx",
|
|
221
|
-
"jsxFactory",
|
|
222
|
-
"jsxFragmentFactory",
|
|
223
|
-
"jsxImportSource",
|
|
224
|
-
"lib",
|
|
225
|
-
"moduleDetection",
|
|
226
|
-
"noLib",
|
|
227
|
-
"reactNamespace",
|
|
228
|
-
"useDefineForClassFields",
|
|
229
|
-
"emitDecoratorMetadata",
|
|
230
|
-
"experimentalDecorators",
|
|
231
|
-
/* Modules */
|
|
232
|
-
"baseUrl",
|
|
233
|
-
"rootDir",
|
|
234
|
-
"rootDirs",
|
|
235
|
-
"customConditions",
|
|
236
|
-
"module",
|
|
237
|
-
"moduleResolution",
|
|
238
|
-
"moduleSuffixes",
|
|
239
|
-
"noResolve",
|
|
240
|
-
"resolveJsonModule",
|
|
241
|
-
"resolvePackageJsonExports",
|
|
242
|
-
"resolvePackageJsonImports",
|
|
243
|
-
"typeRoots",
|
|
244
|
-
"types",
|
|
245
|
-
"allowArbitraryExtensions",
|
|
246
|
-
"allowImportingTsExtensions",
|
|
247
|
-
"allowUmdGlobalAccess",
|
|
248
|
-
/* JavaScript Support */
|
|
249
|
-
"allowJs",
|
|
250
|
-
"checkJs",
|
|
251
|
-
"maxNodeModuleJsDepth",
|
|
252
|
-
/* Type Checking */
|
|
253
|
-
"strict",
|
|
254
|
-
"strictBindCallApply",
|
|
255
|
-
"strictFunctionTypes",
|
|
256
|
-
"strictNullChecks",
|
|
257
|
-
"strictPropertyInitialization",
|
|
258
|
-
"allowUnreachableCode",
|
|
259
|
-
"allowUnusedLabels",
|
|
260
|
-
"alwaysStrict",
|
|
261
|
-
"exactOptionalPropertyTypes",
|
|
262
|
-
"noFallthroughCasesInSwitch",
|
|
263
|
-
"noImplicitAny",
|
|
264
|
-
"noImplicitOverride",
|
|
265
|
-
"noImplicitReturns",
|
|
266
|
-
"noImplicitThis",
|
|
267
|
-
"noPropertyAccessFromIndexSignature",
|
|
268
|
-
"noUncheckedIndexedAccess",
|
|
269
|
-
"noUnusedLocals",
|
|
270
|
-
"noUnusedParameters",
|
|
271
|
-
"useUnknownInCatchVariables",
|
|
272
|
-
/* Emit */
|
|
273
|
-
"declaration",
|
|
274
|
-
"declarationDir",
|
|
275
|
-
"declarationMap",
|
|
276
|
-
"downlevelIteration",
|
|
277
|
-
"emitBOM",
|
|
278
|
-
"emitDeclarationOnly",
|
|
279
|
-
"importHelpers",
|
|
280
|
-
"importsNotUsedAsValues",
|
|
281
|
-
"inlineSourceMap",
|
|
282
|
-
"inlineSources",
|
|
283
|
-
"mapRoot",
|
|
284
|
-
"newLine",
|
|
285
|
-
"noEmit",
|
|
286
|
-
"noEmitHelpers",
|
|
287
|
-
"noEmitOnError",
|
|
288
|
-
"outDir",
|
|
289
|
-
"outFile",
|
|
290
|
-
"preserveConstEnums",
|
|
291
|
-
"preserveValueImports",
|
|
292
|
-
"removeComments",
|
|
293
|
-
"sourceMap",
|
|
294
|
-
"sourceRoot",
|
|
295
|
-
"stripInternal",
|
|
296
|
-
/* Interop Constraints */
|
|
297
|
-
"allowSyntheticDefaultImports",
|
|
298
|
-
"esModuleInterop",
|
|
299
|
-
"forceConsistentCasingInFileNames",
|
|
300
|
-
"isolatedModules",
|
|
301
|
-
"preserveSymlinks",
|
|
302
|
-
"verbatimModuleSyntax",
|
|
303
|
-
/* Completeness */
|
|
304
|
-
"skipDefaultLibCheck",
|
|
305
|
-
"skipLibCheck",
|
|
306
|
-
/* Alias */
|
|
307
|
-
"paths"
|
|
308
|
-
],
|
|
309
|
-
pathPattern: "^compilerOptions$"
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
((_b = options.test) != null ? _b : true) && {
|
|
316
|
-
files: GLOB_TESTS,
|
|
317
|
-
rules: {
|
|
318
|
-
"jest-formatting/padding-around-all": "error"
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
].flat().filter(Boolean);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const renameRules = (rules, from, to) => Object.fromEntries(
|
|
325
|
-
Object.entries(rules).map(([key, value]) => {
|
|
326
|
-
if (key.startsWith(from)) {
|
|
327
|
-
return [to + key.slice(from.length), value];
|
|
328
|
-
}
|
|
329
|
-
return [key, value];
|
|
330
|
-
})
|
|
331
|
-
);
|
|
332
|
-
const rulesOn = /* @__PURE__ */ new Set();
|
|
333
|
-
const rulesOff = /* @__PURE__ */ new Set();
|
|
334
|
-
function recordRulesStateConfigs(configs) {
|
|
335
|
-
var _a;
|
|
336
|
-
for (const config of configs) {
|
|
337
|
-
recordRulesState((_a = config.rules) != null ? _a : {});
|
|
338
|
-
}
|
|
339
|
-
return configs;
|
|
340
|
-
}
|
|
341
|
-
function recordRulesState(rules) {
|
|
342
|
-
for (const [key, value] of Object.entries(rules != null ? rules : {})) {
|
|
343
|
-
const firstValue = Array.isArray(value) ? value[0] : value;
|
|
344
|
-
if (firstValue == null) {
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
if (firstValue === "off" || firstValue === 0) {
|
|
348
|
-
rulesOff.add(key);
|
|
349
|
-
} else {
|
|
350
|
-
rulesOn.add(key);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return rules;
|
|
354
|
-
}
|
|
355
|
-
function warnUnnecessaryOffRules() {
|
|
356
|
-
const unnecessaryOffRules = [...rulesOff].filter((key) => !rulesOn.has(key));
|
|
357
|
-
for (const off of unnecessaryOffRules) {
|
|
358
|
-
console.warn(
|
|
359
|
-
`[eslint] rule \`${off}\` is never turned on, you can remove the rule from your config`
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const html = () => [
|
|
365
|
-
{
|
|
366
|
-
plugins: {
|
|
367
|
-
"html": pluginHtml,
|
|
368
|
-
"html-js-support": pluginHtmlJsSupport
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
languageOptions: {
|
|
373
|
-
parser: parserHtml
|
|
374
|
-
},
|
|
375
|
-
settings: {
|
|
376
|
-
"html/report-bad-indent": "off"
|
|
377
|
-
},
|
|
378
|
-
files: [GLOB_HTML],
|
|
379
|
-
rules: {
|
|
380
|
-
...renameRules(
|
|
381
|
-
pluginHtml.configs.recommended.rules,
|
|
382
|
-
"@html-eslint/",
|
|
383
|
-
"html/"
|
|
384
|
-
),
|
|
385
|
-
"html/indent": "off",
|
|
386
|
-
"html/no-trailing-spaces": "off",
|
|
387
|
-
"html/require-closing-tags": "off",
|
|
388
|
-
"html/no-extra-spacing-attrs": "off",
|
|
389
|
-
"html/quotes": "off"
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
];
|
|
393
|
-
|
|
394
|
-
const ignores = () => [{ ignores: GLOB_EXCLUDE }];
|
|
395
|
-
|
|
396
|
-
const imports = (options = {}) => [
|
|
397
|
-
{
|
|
398
|
-
plugins: {
|
|
399
|
-
import: pluginImport
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
settings: {
|
|
404
|
-
"import/parsers": {
|
|
405
|
-
espree: [".js", ".cjs", ".mjs", ".jsx"]
|
|
406
|
-
},
|
|
407
|
-
"import/resolver": {
|
|
408
|
-
...options.typescript ? {
|
|
409
|
-
node: {
|
|
410
|
-
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
411
|
-
},
|
|
412
|
-
typescript: {
|
|
413
|
-
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
414
|
-
}
|
|
415
|
-
} : {
|
|
416
|
-
node: { extensions: [".js", ".mjs"] }
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
},
|
|
420
|
-
rules: {
|
|
421
|
-
...pluginImport.configs.recommended.rules,
|
|
422
|
-
"import/first": "error",
|
|
423
|
-
"import/no-mutable-exports": "error",
|
|
424
|
-
"import/no-useless-path-segments": ["error", { noUselessIndex: true }],
|
|
425
|
-
"import/no-unresolved": "off",
|
|
426
|
-
"import/no-absolute-path": "off",
|
|
427
|
-
"import/namespace": "off",
|
|
428
|
-
// Disable this for better performance
|
|
429
|
-
"import/export": "error",
|
|
430
|
-
"import/no-duplicates": "error",
|
|
431
|
-
"import/no-named-default": "error",
|
|
432
|
-
"import/no-webpack-loader-syntax": "error",
|
|
433
|
-
"import/no-named-as-default-member": "off"
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
files: [GLOB_DTS],
|
|
438
|
-
rules: {
|
|
439
|
-
"import/no-duplicates": "off"
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
];
|
|
443
|
-
|
|
444
|
-
const javascript = ({
|
|
445
|
-
overrides
|
|
446
|
-
} = {}) => [
|
|
447
|
-
{
|
|
448
|
-
plugins: {
|
|
449
|
-
"so1ve": pluginSo1ve,
|
|
450
|
-
"unused-imports": pluginUnusedImports,
|
|
451
|
-
"sort-imports": pluginSortImports,
|
|
452
|
-
"array-func": pluginArrayFunc,
|
|
453
|
-
"json-schema-validator": pluginJsonSchemaValidator,
|
|
454
|
-
"regexp": pluginRegexp,
|
|
455
|
-
"no-await-in-promise": pluginNoAwaitInPromise__namespace
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
languageOptions: {
|
|
460
|
-
ecmaVersion: 2022,
|
|
461
|
-
globals: {
|
|
462
|
-
...globals.browser,
|
|
463
|
-
...globals.es2021,
|
|
464
|
-
...globals.node,
|
|
465
|
-
document: "readonly",
|
|
466
|
-
navigator: "readonly",
|
|
467
|
-
window: "readonly"
|
|
468
|
-
},
|
|
469
|
-
parserOptions: {
|
|
470
|
-
ecmaFeatures: {
|
|
471
|
-
jsx: true
|
|
472
|
-
},
|
|
473
|
-
ecmaVersion: 2022,
|
|
474
|
-
sourceType: "module"
|
|
475
|
-
},
|
|
476
|
-
sourceType: "module"
|
|
477
|
-
},
|
|
478
|
-
linterOptions: {
|
|
479
|
-
reportUnusedDisableDirectives: true
|
|
480
|
-
},
|
|
481
|
-
rules: {
|
|
482
|
-
// Common
|
|
483
|
-
"array-bracket-newline": "off",
|
|
484
|
-
"array-element-newline": "off",
|
|
485
|
-
"arrow-body-style": "off",
|
|
486
|
-
"arrow-parens": "off",
|
|
487
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
488
|
-
"function-call-argument-newline": "off",
|
|
489
|
-
"function-paren-newline": "off",
|
|
490
|
-
"generator-star": "off",
|
|
491
|
-
"implicit-arrow-linebreak": "off",
|
|
492
|
-
"indent": "off",
|
|
493
|
-
"indent-legacy": "off",
|
|
494
|
-
"jsx-quotes": "off",
|
|
495
|
-
"linebreak-style": "off",
|
|
496
|
-
"newline-per-chained-call": "off",
|
|
497
|
-
"no-arrow-condition": "off",
|
|
498
|
-
"no-comma-dangle": "off",
|
|
499
|
-
"no-confusing-arrow": "off",
|
|
500
|
-
"no-extra-semi": "off",
|
|
501
|
-
"no-reserved-keys": "off",
|
|
502
|
-
"no-spaced-func": "off",
|
|
503
|
-
"no-space-before-semi": "off",
|
|
504
|
-
"no-wrap-func": "off",
|
|
505
|
-
"nonblock-statement-body-position": "off",
|
|
506
|
-
"one-var-declaration-per-line": "off",
|
|
507
|
-
"switch-colon-spacing": "off",
|
|
508
|
-
"symbol-description": "off",
|
|
509
|
-
"wrap-regex": "off",
|
|
510
|
-
"unused-imports/no-unused-imports": "error",
|
|
511
|
-
"unused-imports/no-unused-vars": [
|
|
512
|
-
"error",
|
|
513
|
-
{
|
|
514
|
-
vars: "all",
|
|
515
|
-
varsIgnorePattern: "^_",
|
|
516
|
-
args: "after-used",
|
|
517
|
-
argsIgnorePattern: "^_"
|
|
518
|
-
}
|
|
519
|
-
],
|
|
520
|
-
"accessor-pairs": [
|
|
521
|
-
"error",
|
|
522
|
-
{ setWithoutGet: true, enforceForClassMembers: true }
|
|
523
|
-
],
|
|
524
|
-
"constructor-super": "error",
|
|
525
|
-
"default-case-last": "error",
|
|
526
|
-
"lines-between-class-members": [
|
|
527
|
-
"error",
|
|
528
|
-
"always",
|
|
529
|
-
{ exceptAfterSingleLine: true }
|
|
530
|
-
],
|
|
531
|
-
"new-cap": [
|
|
532
|
-
"error",
|
|
533
|
-
{ newIsCap: true, capIsNew: false, properties: true }
|
|
534
|
-
],
|
|
535
|
-
"no-array-constructor": "error",
|
|
536
|
-
"no-async-promise-executor": "error",
|
|
537
|
-
"no-caller": "error",
|
|
538
|
-
"no-class-assign": "error",
|
|
539
|
-
"no-compare-neg-zero": "error",
|
|
540
|
-
"no-const-assign": "error",
|
|
541
|
-
"no-control-regex": "error",
|
|
542
|
-
"no-delete-var": "error",
|
|
543
|
-
"no-dupe-args": "error",
|
|
544
|
-
"no-dupe-class-members": "error",
|
|
545
|
-
"no-dupe-keys": "error",
|
|
546
|
-
"no-duplicate-case": "error",
|
|
547
|
-
"no-useless-backreference": "error",
|
|
548
|
-
"no-useless-call": "error",
|
|
549
|
-
"no-useless-computed-key": "error",
|
|
550
|
-
"no-useless-constructor": "error",
|
|
551
|
-
"no-useless-rename": "error",
|
|
552
|
-
"no-useless-return": "error",
|
|
553
|
-
"no-void": "error",
|
|
554
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
555
|
-
"no-empty-character-class": "error",
|
|
556
|
-
"no-empty-pattern": "error",
|
|
557
|
-
"no-eval": "error",
|
|
558
|
-
"no-ex-assign": "error",
|
|
559
|
-
"no-extend-native": "error",
|
|
560
|
-
"no-extra-bind": "error",
|
|
561
|
-
"no-extra-boolean-cast": "error",
|
|
562
|
-
"no-extra-parens": ["error", "functions"],
|
|
563
|
-
"no-fallthrough": "error",
|
|
564
|
-
"no-func-assign": "error",
|
|
565
|
-
"no-global-assign": "error",
|
|
566
|
-
"no-implied-eval": "error",
|
|
567
|
-
"no-import-assign": "error",
|
|
568
|
-
"no-invalid-regexp": "error",
|
|
569
|
-
"no-irregular-whitespace": "error",
|
|
570
|
-
"no-iterator": "error",
|
|
571
|
-
"no-labels": ["error", { allowLoop: true, allowSwitch: false }],
|
|
572
|
-
"no-lone-blocks": "error",
|
|
573
|
-
"no-loss-of-precision": "error",
|
|
574
|
-
"no-misleading-character-class": "error",
|
|
575
|
-
"no-new-func": "error",
|
|
576
|
-
"no-new-object": "error",
|
|
577
|
-
"no-new-symbol": "error",
|
|
578
|
-
"no-new-wrappers": "error",
|
|
579
|
-
"no-prototype-builtins": "error",
|
|
580
|
-
"no-useless-catch": "error",
|
|
581
|
-
"no-param-reassign": "off",
|
|
582
|
-
"no-constant-condition": "error",
|
|
583
|
-
"no-debugger": "error",
|
|
584
|
-
"no-console": ["error", { allow: ["error", "warn", "table", "time"] }],
|
|
585
|
-
"no-cond-assign": ["error", "always"],
|
|
586
|
-
"no-restricted-syntax": [
|
|
587
|
-
"error",
|
|
588
|
-
"DebuggerStatement",
|
|
589
|
-
"LabeledStatement",
|
|
590
|
-
"WithStatement"
|
|
591
|
-
],
|
|
592
|
-
"no-restricted-globals": [
|
|
593
|
-
"error",
|
|
594
|
-
{ name: "global", message: "Use `globalThis` instead." },
|
|
595
|
-
{ name: "self", message: "Use `globalThis` instead." },
|
|
596
|
-
{ name: "isNaN", message: "Use `Number.isNaN` instead" },
|
|
597
|
-
{ name: "isFinite", message: "Use `Number.isFinite` instead" },
|
|
598
|
-
{ name: "parseFloat", message: "Use `Number.parseFloat` instead" },
|
|
599
|
-
{ name: "parseInt", message: "Use `Number.parseInt` instead" }
|
|
600
|
-
],
|
|
601
|
-
"no-restricted-properties": [
|
|
602
|
-
"error",
|
|
603
|
-
{
|
|
604
|
-
object: "globalThis",
|
|
605
|
-
property: "isNaN",
|
|
606
|
-
message: "Use `Number.isNaN` instead"
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
object: "globalThis",
|
|
610
|
-
property: "isFinite",
|
|
611
|
-
message: "Use `Number.isFinite` instead"
|
|
612
|
-
},
|
|
613
|
-
{
|
|
614
|
-
object: "globalThis",
|
|
615
|
-
property: "parseFloat",
|
|
616
|
-
message: "Use `Number.parseFloat` instead"
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
object: "globalThis",
|
|
620
|
-
property: "parseInt",
|
|
621
|
-
message: "Use `Number.parseInt` instead"
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
object: "window",
|
|
625
|
-
property: "isNaN",
|
|
626
|
-
message: "Use `Number.isNaN` instead"
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
object: "window",
|
|
630
|
-
property: "isFinite",
|
|
631
|
-
message: "Use `Number.isFinite` instead"
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
object: "window",
|
|
635
|
-
property: "parseFloat",
|
|
636
|
-
message: "Use `Number.parseFloat` instead"
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
object: "window",
|
|
640
|
-
property: "parseInt",
|
|
641
|
-
message: "Use `Number.parseInt` instead"
|
|
642
|
-
}
|
|
643
|
-
],
|
|
644
|
-
"no-obj-calls": "error",
|
|
645
|
-
"no-octal": "error",
|
|
646
|
-
"no-octal-escape": "error",
|
|
647
|
-
"no-proto": "error",
|
|
648
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
649
|
-
"no-regex-spaces": "error",
|
|
650
|
-
"no-self-assign": ["error", { props: true }],
|
|
651
|
-
"no-self-compare": "error",
|
|
652
|
-
"no-sequences": "error",
|
|
653
|
-
"no-shadow-restricted-names": "error",
|
|
654
|
-
"no-template-curly-in-string": "error",
|
|
655
|
-
"no-this-before-super": "error",
|
|
656
|
-
"no-throw-literal": "error",
|
|
657
|
-
"no-undef": "error",
|
|
658
|
-
"no-undef-init": "error",
|
|
659
|
-
"no-unexpected-multiline": "error",
|
|
660
|
-
"no-unmodified-loop-condition": "error",
|
|
661
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
662
|
-
"no-unreachable": "error",
|
|
663
|
-
"no-unreachable-loop": "error",
|
|
664
|
-
"no-unsafe-finally": "error",
|
|
665
|
-
"no-unsafe-negation": "error",
|
|
666
|
-
"no-return-await": "off",
|
|
667
|
-
// es6
|
|
668
|
-
"no-var": "error",
|
|
669
|
-
"prefer-const": [
|
|
670
|
-
"error",
|
|
671
|
-
{
|
|
672
|
-
destructuring: "all",
|
|
673
|
-
ignoreReadBeforeAssign: true
|
|
674
|
-
}
|
|
675
|
-
],
|
|
676
|
-
"prefer-arrow-callback": [
|
|
677
|
-
"error",
|
|
678
|
-
{
|
|
679
|
-
allowNamedFunctions: false,
|
|
680
|
-
allowUnboundThis: true
|
|
681
|
-
}
|
|
682
|
-
],
|
|
683
|
-
"one-var": ["error", "never"],
|
|
684
|
-
"object-shorthand": [
|
|
685
|
-
"error",
|
|
686
|
-
"always",
|
|
687
|
-
{
|
|
688
|
-
ignoreConstructors: false
|
|
689
|
-
}
|
|
690
|
-
],
|
|
691
|
-
"prefer-exponentiation-operator": "error",
|
|
692
|
-
"prefer-rest-params": "error",
|
|
693
|
-
"prefer-spread": "error",
|
|
694
|
-
"prefer-template": "error",
|
|
695
|
-
"prefer-promise-reject-errors": "error",
|
|
696
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
697
|
-
"yoda": ["error", "never"],
|
|
698
|
-
"spaced-comment": [
|
|
699
|
-
"error",
|
|
700
|
-
"always",
|
|
701
|
-
{
|
|
702
|
-
line: {
|
|
703
|
-
markers: ["/"],
|
|
704
|
-
exceptions: ["/", "#"]
|
|
705
|
-
},
|
|
706
|
-
block: {
|
|
707
|
-
markers: ["!"],
|
|
708
|
-
exceptions: ["*"],
|
|
709
|
-
balanced: true
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
],
|
|
713
|
-
// best-practice
|
|
714
|
-
"array-callback-return": "error",
|
|
715
|
-
"block-scoped-var": "error",
|
|
716
|
-
"no-unused-expressions": [
|
|
717
|
-
"error",
|
|
718
|
-
{
|
|
719
|
-
allowShortCircuit: true,
|
|
720
|
-
allowTernary: true,
|
|
721
|
-
allowTaggedTemplates: true
|
|
722
|
-
}
|
|
723
|
-
],
|
|
724
|
-
"no-unused-vars": [
|
|
725
|
-
"error",
|
|
726
|
-
{
|
|
727
|
-
args: "none",
|
|
728
|
-
caughtErrors: "none",
|
|
729
|
-
ignoreRestSiblings: true,
|
|
730
|
-
vars: "all"
|
|
731
|
-
}
|
|
732
|
-
],
|
|
733
|
-
"no-use-before-define": [
|
|
734
|
-
"error",
|
|
735
|
-
{ functions: false, classes: false, variables: true }
|
|
736
|
-
],
|
|
737
|
-
"consistent-return": "off",
|
|
738
|
-
"complexity": ["off", 11],
|
|
739
|
-
"eqeqeq": ["error", "smart"],
|
|
740
|
-
"no-alert": "error",
|
|
741
|
-
"no-case-declarations": "error",
|
|
742
|
-
"no-multi-str": "error",
|
|
743
|
-
"no-with": "error",
|
|
744
|
-
"no-invalid-this": "error",
|
|
745
|
-
"vars-on-top": "error",
|
|
746
|
-
"require-await": "off",
|
|
747
|
-
"use-isnan": [
|
|
748
|
-
"error",
|
|
749
|
-
{
|
|
750
|
-
enforceForSwitchCase: true,
|
|
751
|
-
enforceForIndexOf: true
|
|
752
|
-
}
|
|
753
|
-
],
|
|
754
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
755
|
-
// so1ve
|
|
756
|
-
"so1ve/import-dedupe": "error",
|
|
757
|
-
"so1ve/require-async-with-await": "error",
|
|
758
|
-
// Sort Imports
|
|
759
|
-
"sort-imports/imports": ["error"],
|
|
760
|
-
"sort-imports/exports": "error",
|
|
761
|
-
// array-func
|
|
762
|
-
"array-func/prefer-array-from": "off",
|
|
763
|
-
"array-func/prefer-flat": "off",
|
|
764
|
-
// Handled by unicorn
|
|
765
|
-
"array-func/from-map": "off",
|
|
766
|
-
// Conflicts with unicorn/prefer-spread
|
|
767
|
-
"array-func/no-unnecessary-this-arg": "error",
|
|
768
|
-
"array-func/avoid-reverse": "error",
|
|
769
|
-
"array-func/prefer-flat-map": "error",
|
|
770
|
-
// json-schema-validator
|
|
771
|
-
"json-schema-validator/no-invalid": "warn",
|
|
772
|
-
// regexp
|
|
773
|
-
"regexp/no-unused-capturing-group": "warn",
|
|
774
|
-
// no-await-in-promise
|
|
775
|
-
"no-await-in-promise/no-await-in-promise": "error",
|
|
776
|
-
...overrides
|
|
777
|
-
}
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
781
|
-
rules: {
|
|
782
|
-
"no-console": "off"
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
];
|
|
786
|
-
|
|
787
|
-
const jsonc = () => [
|
|
788
|
-
{
|
|
789
|
-
plugins: {
|
|
790
|
-
jsonc: pluginJsonc
|
|
791
|
-
}
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_ESLINTRC],
|
|
795
|
-
languageOptions: {
|
|
796
|
-
parser: parserJsonc
|
|
797
|
-
},
|
|
798
|
-
rules: {
|
|
799
|
-
...pluginJsonc.configs.base.overrides[0].rules,
|
|
800
|
-
...pluginJsonc.configs["recommended-with-jsonc"].rules,
|
|
801
|
-
"jsonc/no-octal-escape": "error",
|
|
802
|
-
"jsonc/quotes": "off",
|
|
803
|
-
"jsonc/quotes-props": "off"
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
];
|
|
807
|
-
|
|
808
|
-
const mdx = ({
|
|
809
|
-
componentExts = [],
|
|
810
|
-
overrides
|
|
811
|
-
} = {}) => [
|
|
812
|
-
{
|
|
813
|
-
...pluginMdx.flat,
|
|
814
|
-
processor: pluginMdx.createRemarkProcessor({
|
|
815
|
-
lintCodeBlocks: true,
|
|
816
|
-
languageMapper: {}
|
|
817
|
-
})
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
...pluginMdx.flatCodeBlocks,
|
|
821
|
-
files: [
|
|
822
|
-
...pluginMdx.flatCodeBlocks.files,
|
|
823
|
-
...componentExts.map((ext) => `${GLOB_MARKDOWN}/*.${ext}`)
|
|
824
|
-
],
|
|
825
|
-
rules: {
|
|
826
|
-
...pluginMdx.flatCodeBlocks.rules,
|
|
827
|
-
"html/require-doctype": "off",
|
|
828
|
-
"ts/no-redeclare": "off",
|
|
829
|
-
"ts/no-unused-vars": "off",
|
|
830
|
-
"ts/no-use-before-define": "off",
|
|
831
|
-
"ts/no-var-requires": "off",
|
|
832
|
-
"ts/consistent-type-imports": "off",
|
|
833
|
-
"ts/no-namespace": "off",
|
|
834
|
-
"ts/no-require-imports": "off",
|
|
835
|
-
"import/no-unresolved": "off",
|
|
836
|
-
"unused-imports/no-unused-imports": "off",
|
|
837
|
-
"unused-imports/no-unused-vars": "off",
|
|
838
|
-
"no-alert": "off",
|
|
839
|
-
"no-console": "off",
|
|
840
|
-
"no-restricted-imports": "off",
|
|
841
|
-
"no-undef": "off",
|
|
842
|
-
"no-unused-expressions": "off",
|
|
843
|
-
...overrides
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
];
|
|
847
|
-
|
|
848
|
-
const node = () => [
|
|
849
|
-
{
|
|
850
|
-
plugins: {
|
|
851
|
-
node: pluginNode
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
rules: {
|
|
856
|
-
"node/no-callback-literal": "off",
|
|
857
|
-
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
858
|
-
"node/no-deprecated-api": "error",
|
|
859
|
-
"node/no-exports-assign": "error",
|
|
860
|
-
"node/no-new-require": "error",
|
|
861
|
-
"node/no-path-concat": "error",
|
|
862
|
-
"node/process-exit-as-throw": "error"
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
];
|
|
866
|
-
|
|
867
|
-
const onlyError = () => [
|
|
868
|
-
{
|
|
869
|
-
plugins: {
|
|
870
|
-
"only-error": pluginOnlyError
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
];
|
|
874
|
-
|
|
875
|
-
const promise = () => [
|
|
876
|
-
{
|
|
877
|
-
plugins: {
|
|
878
|
-
promise: pluginPromise
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
{
|
|
882
|
-
rules: {
|
|
883
|
-
"promise/param-names": "error"
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
];
|
|
887
|
-
|
|
888
|
-
const solid = ({
|
|
889
|
-
overrides,
|
|
890
|
-
typescript
|
|
891
|
-
} = {}) => [
|
|
892
|
-
{
|
|
893
|
-
plugins: {
|
|
894
|
-
solid: pluginSolid
|
|
895
|
-
}
|
|
896
|
-
},
|
|
897
|
-
{
|
|
898
|
-
languageOptions: {
|
|
899
|
-
sourceType: "module",
|
|
900
|
-
parserOptions: {
|
|
901
|
-
ecmaFeatures: {
|
|
902
|
-
jsx: true
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
},
|
|
906
|
-
rules: {
|
|
907
|
-
...pluginSolid.configs.recommended.rules,
|
|
908
|
-
...typescript ? pluginSolid.configs.typescript.rules : {},
|
|
909
|
-
...overrides
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
];
|
|
913
|
-
|
|
914
|
-
const sortImports = () => [
|
|
915
|
-
{
|
|
916
|
-
plugins: {
|
|
917
|
-
"sort-imports": pluginSortImports
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
rules: {
|
|
922
|
-
"sort-imports/imports": "error",
|
|
923
|
-
"sort-imports/exports": "error"
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
];
|
|
927
|
-
|
|
928
|
-
const test = ({ overrides } = {}) => [
|
|
929
|
-
{
|
|
930
|
-
plugins: {
|
|
931
|
-
"no-only-tests": pluginNoOnlyTests,
|
|
932
|
-
"vitest": pluginVitest,
|
|
933
|
-
"jest-formatting": pluginJestFormatting
|
|
934
|
-
}
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
files: GLOB_TESTS,
|
|
938
|
-
rules: {
|
|
939
|
-
...pluginVitest.configs.recommended.rules,
|
|
940
|
-
"no-only-tests/no-only-tests": "error",
|
|
941
|
-
"vitest/expect-expect": "off",
|
|
942
|
-
"vitest/valid-title": "off",
|
|
943
|
-
"vitest/valid-describe-callback": "off",
|
|
944
|
-
"vitest/no-alias-methods": "error",
|
|
945
|
-
"vitest/no-interpolation-in-snapshots": "error",
|
|
946
|
-
"vitest/no-test-prefixes": "error",
|
|
947
|
-
"vitest/prefer-expect-resolves": "error",
|
|
948
|
-
"vitest/prefer-comparison-matcher": "error",
|
|
949
|
-
"vitest/prefer-mock-promise-shorthand": "error",
|
|
950
|
-
"vitest/prefer-spy-on": "error",
|
|
951
|
-
"vitest/prefer-to-be-falsy": "error",
|
|
952
|
-
"vitest/prefer-to-be-object": "error",
|
|
953
|
-
"vitest/prefer-to-be-truthy": "error",
|
|
954
|
-
"vitest/prefer-to-contain": "error",
|
|
955
|
-
"vitest/prefer-to-have-length": "error",
|
|
956
|
-
"vitest/prefer-todo": "error",
|
|
957
|
-
...overrides
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
];
|
|
961
|
-
|
|
962
|
-
const toml = ({ overrides } = {}) => [
|
|
963
|
-
{
|
|
964
|
-
plugins: {
|
|
965
|
-
toml: pluginToml
|
|
966
|
-
}
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
languageOptions: {
|
|
970
|
-
parser: parserToml
|
|
971
|
-
},
|
|
972
|
-
files: [GLOB_TOML],
|
|
973
|
-
rules: {
|
|
974
|
-
...pluginToml.configs.recommended.rules,
|
|
975
|
-
"no-irregular-whitespace": "off",
|
|
976
|
-
"spaced-comment": "off",
|
|
977
|
-
...overrides
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
];
|
|
981
|
-
|
|
982
|
-
function typescript({
|
|
983
|
-
componentExts = [],
|
|
984
|
-
parserOptions,
|
|
985
|
-
overrides
|
|
986
|
-
} = {}) {
|
|
987
|
-
const typeAwareRules = {
|
|
988
|
-
"etc/no-assign-mutated-array": "error",
|
|
989
|
-
"etc/no-deprecated": "warn",
|
|
990
|
-
"etc/no-internal": "error",
|
|
991
|
-
"no-throw-literal": "off",
|
|
992
|
-
"ts/no-throw-literal": "error",
|
|
993
|
-
"no-implied-eval": "off",
|
|
994
|
-
"ts/no-implied-eval": "error",
|
|
995
|
-
"dot-notation": "off",
|
|
996
|
-
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
997
|
-
"no-void": ["error", { allowAsStatement: true }],
|
|
998
|
-
"ts/await-thenable": "error",
|
|
999
|
-
"ts/no-for-in-array": "error",
|
|
1000
|
-
"ts/no-unnecessary-type-assertion": "error",
|
|
1001
|
-
"ts/restrict-template-expressions": [
|
|
1002
|
-
"error",
|
|
1003
|
-
{
|
|
1004
|
-
allowAny: true,
|
|
1005
|
-
allowNumber: true,
|
|
1006
|
-
allowBoolean: true
|
|
1007
|
-
}
|
|
1008
|
-
],
|
|
1009
|
-
"ts/array-type": ["error", { default: "array", readonly: "array" }],
|
|
1010
|
-
"ts/consistent-generic-constructors": "error",
|
|
1011
|
-
"ts/consistent-type-exports": "error",
|
|
1012
|
-
"ts/consistent-type-assertions": [
|
|
1013
|
-
"error",
|
|
1014
|
-
{ assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
|
|
1015
|
-
],
|
|
1016
|
-
"ts/prefer-nullish-coalescing": "error",
|
|
1017
|
-
"ts/prefer-optional-chain": "error",
|
|
1018
|
-
"ts/prefer-return-this-type": "error",
|
|
1019
|
-
"ts/no-unnecessary-type-arguments": "error",
|
|
1020
|
-
"ts/non-nullable-type-assertion-style": "error"
|
|
1021
|
-
};
|
|
1022
|
-
return [
|
|
1023
|
-
{
|
|
1024
|
-
// Install the plugins without globs, so they can be configured separately.
|
|
1025
|
-
plugins: {
|
|
1026
|
-
import: pluginImport,
|
|
1027
|
-
ts: tseslint.plugin,
|
|
1028
|
-
etc: pluginEtc
|
|
1029
|
-
}
|
|
1030
|
-
},
|
|
1031
|
-
{
|
|
1032
|
-
files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
1033
|
-
languageOptions: {
|
|
1034
|
-
parser: tseslint.parser,
|
|
1035
|
-
parserOptions: {
|
|
1036
|
-
sourceType: "module",
|
|
1037
|
-
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1038
|
-
...parserOptions
|
|
1039
|
-
}
|
|
1040
|
-
},
|
|
1041
|
-
settings: {
|
|
1042
|
-
"import/resolver": {
|
|
1043
|
-
node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
|
|
1044
|
-
typescript: {
|
|
1045
|
-
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
rules: {
|
|
1050
|
-
...renameRules(
|
|
1051
|
-
tseslint.configs.eslintRecommended.rules,
|
|
1052
|
-
"@typescript-eslint/",
|
|
1053
|
-
"ts/"
|
|
1054
|
-
),
|
|
1055
|
-
...renameRules(
|
|
1056
|
-
tseslint.configs.recommended.map((config) => config.rules).filter(Boolean).reduce((a, b) => ({ ...a, ...b }), {}),
|
|
1057
|
-
"@typescript-eslint/",
|
|
1058
|
-
"ts/"
|
|
1059
|
-
),
|
|
1060
|
-
"import/named": "off",
|
|
1061
|
-
// TS
|
|
1062
|
-
"ts/comma-dangle": "off",
|
|
1063
|
-
"ts/brace-style": "off",
|
|
1064
|
-
"ts/comma-spacing": "off",
|
|
1065
|
-
"ts/func-call-spacing": "off",
|
|
1066
|
-
"ts/indent": "off",
|
|
1067
|
-
"ts/keyword-spacing": "off",
|
|
1068
|
-
"ts/member-delimiter-style": "off",
|
|
1069
|
-
"ts/no-extra-parens": "off",
|
|
1070
|
-
"ts/no-extra-semi": "off",
|
|
1071
|
-
"ts/quotes": "off",
|
|
1072
|
-
"ts/semi": "off",
|
|
1073
|
-
"ts/space-before-function-paren": "off",
|
|
1074
|
-
"ts/type-annotation-spacing": "off",
|
|
1075
|
-
"ts/ban-ts-comment": [
|
|
1076
|
-
"error",
|
|
1077
|
-
{
|
|
1078
|
-
minimumDescriptionLength: 0
|
|
1079
|
-
}
|
|
1080
|
-
],
|
|
1081
|
-
"ts/ban-types": [
|
|
1082
|
-
"error",
|
|
1083
|
-
{
|
|
1084
|
-
extendDefaults: false,
|
|
1085
|
-
types: {
|
|
1086
|
-
String: {
|
|
1087
|
-
message: "Use `string` instead.",
|
|
1088
|
-
fixWith: "string"
|
|
1089
|
-
},
|
|
1090
|
-
Number: {
|
|
1091
|
-
message: "Use `number` instead.",
|
|
1092
|
-
fixWith: "number"
|
|
1093
|
-
},
|
|
1094
|
-
Boolean: {
|
|
1095
|
-
message: "Use `boolean` instead.",
|
|
1096
|
-
fixWith: "boolean"
|
|
1097
|
-
},
|
|
1098
|
-
Symbol: {
|
|
1099
|
-
message: "Use `symbol` instead.",
|
|
1100
|
-
fixWith: "symbol"
|
|
1101
|
-
},
|
|
1102
|
-
BigInt: {
|
|
1103
|
-
message: "Use `bigint` instead.",
|
|
1104
|
-
fixWith: "bigint"
|
|
1105
|
-
},
|
|
1106
|
-
Object: {
|
|
1107
|
-
message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1108
|
-
fixWith: "Record<PropertyKey, unknown>"
|
|
1109
|
-
},
|
|
1110
|
-
object: {
|
|
1111
|
-
message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1112
|
-
fixWith: "Record<PropertyKey, unknown>"
|
|
1113
|
-
},
|
|
1114
|
-
Function: {
|
|
1115
|
-
message: "Use `(...args: any[]) => any` instead.",
|
|
1116
|
-
fixWith: "(...args: any[]) => any"
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
],
|
|
1121
|
-
"ts/consistent-type-imports": [
|
|
1122
|
-
"error",
|
|
1123
|
-
{ prefer: "type-imports", disallowTypeAnnotations: false }
|
|
1124
|
-
],
|
|
1125
|
-
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1126
|
-
"ts/consistent-indexed-object-style": ["error", "record"],
|
|
1127
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1128
|
-
"ts/prefer-for-of": "error",
|
|
1129
|
-
"ts/no-duplicate-enum-values": "error",
|
|
1130
|
-
"ts/no-non-null-asserted-nullish-coalescing": "error",
|
|
1131
|
-
"ts/no-require-imports": "error",
|
|
1132
|
-
"ts/method-signature-style": ["error", "property"],
|
|
1133
|
-
"ts/explicit-member-accessibility": [
|
|
1134
|
-
"error",
|
|
1135
|
-
{
|
|
1136
|
-
accessibility: "explicit",
|
|
1137
|
-
overrides: {
|
|
1138
|
-
constructors: "no-public"
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
],
|
|
1142
|
-
// Override JS
|
|
1143
|
-
"no-useless-constructor": "off",
|
|
1144
|
-
"no-invalid-this": "off",
|
|
1145
|
-
"ts/no-invalid-this": "error",
|
|
1146
|
-
"no-redeclare": "off",
|
|
1147
|
-
"ts/no-redeclare": "error",
|
|
1148
|
-
"no-use-before-define": "off",
|
|
1149
|
-
"ts/no-use-before-define": [
|
|
1150
|
-
"error",
|
|
1151
|
-
{ functions: false, classes: false, variables: true }
|
|
1152
|
-
],
|
|
1153
|
-
"object-curly-spacing": "off",
|
|
1154
|
-
"space-before-blocks": "off",
|
|
1155
|
-
"ts/space-before-blocks": "off",
|
|
1156
|
-
"space-before-function-paren": "off",
|
|
1157
|
-
"no-dupe-class-members": "off",
|
|
1158
|
-
"ts/no-dupe-class-members": "error",
|
|
1159
|
-
"no-loss-of-precision": "off",
|
|
1160
|
-
"ts/no-loss-of-precision": "error",
|
|
1161
|
-
"lines-between-class-members": "off",
|
|
1162
|
-
"ts/lines-between-class-members": [
|
|
1163
|
-
"error",
|
|
1164
|
-
"always",
|
|
1165
|
-
{ exceptAfterSingleLine: true }
|
|
1166
|
-
],
|
|
1167
|
-
// so1ve
|
|
1168
|
-
"so1ve/no-inline-type-import": "error",
|
|
1169
|
-
// off
|
|
1170
|
-
"ts/camelcase": "off",
|
|
1171
|
-
"ts/explicit-function-return-type": "off",
|
|
1172
|
-
"ts/no-explicit-any": "off",
|
|
1173
|
-
"ts/no-parameter-properties": "off",
|
|
1174
|
-
"ts/no-empty-interface": "off",
|
|
1175
|
-
"ts/ban-ts-ignore": "off",
|
|
1176
|
-
"ts/no-empty-function": "off",
|
|
1177
|
-
"ts/no-non-null-assertion": "off",
|
|
1178
|
-
"ts/explicit-module-boundary-types": "off",
|
|
1179
|
-
"ts/triple-slash-reference": "off",
|
|
1180
|
-
// handled by unused-imports/no-unused-imports
|
|
1181
|
-
"ts/no-unused-vars": "off",
|
|
1182
|
-
...overrides
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
1187
|
-
ignores: [GLOB_MARKDOWN_CODE],
|
|
1188
|
-
languageOptions: {
|
|
1189
|
-
parser: tseslint.parser,
|
|
1190
|
-
parserOptions: {
|
|
1191
|
-
sourceType: "module",
|
|
1192
|
-
// EXPERIMENTAL_useProjectService: true,
|
|
1193
|
-
project: true,
|
|
1194
|
-
tsconfigRootDir: process.cwd()
|
|
1195
|
-
}
|
|
1196
|
-
},
|
|
1197
|
-
settings: {
|
|
1198
|
-
"import/resolver": {
|
|
1199
|
-
node: {
|
|
1200
|
-
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
1201
|
-
},
|
|
1202
|
-
typescript: {
|
|
1203
|
-
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
},
|
|
1207
|
-
rules: {
|
|
1208
|
-
...typeAwareRules
|
|
1209
|
-
}
|
|
1210
|
-
},
|
|
1211
|
-
{
|
|
1212
|
-
files: ["**/*.d.ts"],
|
|
1213
|
-
rules: {
|
|
1214
|
-
"eslint-comments/no-unlimited-disable": "off",
|
|
1215
|
-
"import/no-duplicates": "off",
|
|
1216
|
-
"unused-imports/no-unused-vars": "off"
|
|
1217
|
-
}
|
|
1218
|
-
},
|
|
1219
|
-
{
|
|
1220
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
1221
|
-
rules: {
|
|
1222
|
-
"ts/no-require-imports": "off",
|
|
1223
|
-
"ts/no-var-requires": "off"
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
];
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
const unicorn = () => [
|
|
1230
|
-
{
|
|
1231
|
-
plugins: {
|
|
1232
|
-
unicorn: pluginUnicorn
|
|
1233
|
-
},
|
|
1234
|
-
rules: {
|
|
1235
|
-
"unicorn/throw-new-error": "error",
|
|
1236
|
-
"unicorn/relative-url-style": ["error", "always"],
|
|
1237
|
-
"unicorn/switch-case-braces": "error",
|
|
1238
|
-
"unicorn/number-literal-case": "error",
|
|
1239
|
-
"unicorn/numeric-separators-style": "error",
|
|
1240
|
-
"unicorn/new-for-builtins": "error",
|
|
1241
|
-
"unicorn/error-message": "error",
|
|
1242
|
-
"unicorn/escape-case": "error",
|
|
1243
|
-
"unicorn/explicit-length-check": "error",
|
|
1244
|
-
"unicorn/no-instanceof-array": "error",
|
|
1245
|
-
"unicorn/no-new-buffer": "error",
|
|
1246
|
-
"unicorn/no-new-array": "error",
|
|
1247
|
-
"unicorn/no-array-for-each": "error",
|
|
1248
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
1249
|
-
"unicorn/no-for-loop": "error",
|
|
1250
|
-
"unicorn/no-lonely-if": "error",
|
|
1251
|
-
"unicorn/no-negated-condition": "error",
|
|
1252
|
-
"unicorn/no-useless-spread": "error",
|
|
1253
|
-
"unicorn/prefer-ternary": "error",
|
|
1254
|
-
"unicorn/prefer-query-selector": "error",
|
|
1255
|
-
"unicorn/prefer-modern-dom-apis": "error",
|
|
1256
|
-
"unicorn/prefer-modern-math-apis": "error",
|
|
1257
|
-
"unicorn/prefer-json-parse-buffer": "error",
|
|
1258
|
-
"unicorn/prefer-date-now": "error",
|
|
1259
|
-
"unicorn/prefer-array-some": "error",
|
|
1260
|
-
"unicorn/prefer-array-index-of": "error",
|
|
1261
|
-
"unicorn/prefer-array-flat": "error",
|
|
1262
|
-
"unicorn/prefer-array-find": "error",
|
|
1263
|
-
"unicorn/prefer-spread": "error",
|
|
1264
|
-
"unicorn/prefer-set-size": "error",
|
|
1265
|
-
"unicorn/prefer-string-slice": "error",
|
|
1266
|
-
"unicorn/prefer-includes": "error",
|
|
1267
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1268
|
-
"unicorn/prefer-text-content": "error",
|
|
1269
|
-
"unicorn/prefer-type-error": "error",
|
|
1270
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1271
|
-
"unicorn/prefer-negative-index": "error",
|
|
1272
|
-
"unicorn/prefer-regexp-test": "error",
|
|
1273
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1274
|
-
"unicorn/prefer-object-from-entries": "error",
|
|
1275
|
-
"unicorn/prefer-prototype-methods": "error"
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
];
|
|
1279
|
-
|
|
1280
|
-
const vue = ({
|
|
1281
|
-
overrides,
|
|
1282
|
-
typescript
|
|
1283
|
-
} = {}) => [
|
|
1284
|
-
{
|
|
1285
|
-
plugins: {
|
|
1286
|
-
vue: pluginVue
|
|
1287
|
-
}
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
files: [GLOB_VUE],
|
|
1291
|
-
languageOptions: {
|
|
1292
|
-
parser: parserVue,
|
|
1293
|
-
parserOptions: {
|
|
1294
|
-
ecmaFeatures: {
|
|
1295
|
-
jsx: true
|
|
1296
|
-
},
|
|
1297
|
-
extraFileExtensions: [".vue"],
|
|
1298
|
-
parser: typescript ? tseslint.parser : null,
|
|
1299
|
-
sourceType: "module"
|
|
1300
|
-
}
|
|
1301
|
-
},
|
|
1302
|
-
processor: pluginVue.processors[".vue"],
|
|
1303
|
-
rules: {
|
|
1304
|
-
...pluginVue.configs.base.rules,
|
|
1305
|
-
...pluginVue.configs["vue3-essential"].rules,
|
|
1306
|
-
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1307
|
-
...pluginVue.configs["vue3-recommended"].rules,
|
|
1308
|
-
"no-unused-vars": "off",
|
|
1309
|
-
"no-undef": "off",
|
|
1310
|
-
"ts/no-unused-vars": "off",
|
|
1311
|
-
"vue/no-v-html": "off",
|
|
1312
|
-
"vue/require-prop-types": "off",
|
|
1313
|
-
"vue/require-default-prop": "off",
|
|
1314
|
-
"vue/multi-word-component-names": "off",
|
|
1315
|
-
"vue/no-ref-object-reactivity-loss": "error",
|
|
1316
|
-
"vue/no-setup-props-reactivity-loss": "error",
|
|
1317
|
-
"vue/block-order": [
|
|
1318
|
-
"error",
|
|
1319
|
-
{
|
|
1320
|
-
order: ["script:not([setup])", "script[setup]", "template", "style"]
|
|
1321
|
-
}
|
|
1322
|
-
],
|
|
1323
|
-
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
1324
|
-
"vue/component-name-in-template-casing": [
|
|
1325
|
-
"error",
|
|
1326
|
-
"PascalCase",
|
|
1327
|
-
{ registeredComponentsOnly: false }
|
|
1328
|
-
],
|
|
1329
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1330
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1331
|
-
"vue/define-macros-order": [
|
|
1332
|
-
"error",
|
|
1333
|
-
{
|
|
1334
|
-
order: ["defineOptions", "defineEmits", "defineProps", "defineSlots"]
|
|
1335
|
-
}
|
|
1336
|
-
],
|
|
1337
|
-
"vue/html-comment-content-spacing": [
|
|
1338
|
-
"error",
|
|
1339
|
-
"always",
|
|
1340
|
-
{ exceptions: ["-"] }
|
|
1341
|
-
],
|
|
1342
|
-
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1343
|
-
"vue/no-useless-v-bind": ["error", { ignoreIncludesComment: true }],
|
|
1344
|
-
"vue/no-unused-refs": "error",
|
|
1345
|
-
"vue/no-v-text-v-html-on-component": "error",
|
|
1346
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1347
|
-
"vue/prefer-separate-static-class": "error",
|
|
1348
|
-
// extensions
|
|
1349
|
-
"vue/dot-location": ["error", "property"],
|
|
1350
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1351
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
1352
|
-
"vue/no-constant-condition": "error",
|
|
1353
|
-
"vue/no-empty-pattern": "error",
|
|
1354
|
-
"vue/no-irregular-whitespace": "error",
|
|
1355
|
-
"vue/no-loss-of-precision": "error",
|
|
1356
|
-
"vue/no-restricted-syntax": [
|
|
1357
|
-
"error",
|
|
1358
|
-
"DebuggerStatement",
|
|
1359
|
-
"LabeledStatement",
|
|
1360
|
-
"WithStatement"
|
|
1361
|
-
],
|
|
1362
|
-
"vue/no-sparse-arrays": "error",
|
|
1363
|
-
"vue/object-curly-newline": [
|
|
1364
|
-
"error",
|
|
1365
|
-
{ multiline: true, consistent: true }
|
|
1366
|
-
],
|
|
1367
|
-
"vue/object-property-newline": [
|
|
1368
|
-
"error",
|
|
1369
|
-
{ allowMultiplePropertiesPerLine: true }
|
|
1370
|
-
],
|
|
1371
|
-
"vue/object-shorthand": [
|
|
1372
|
-
"error",
|
|
1373
|
-
"always",
|
|
1374
|
-
{ ignoreConstructors: false, avoidQuotes: true }
|
|
1375
|
-
],
|
|
1376
|
-
"vue/prefer-template": "error",
|
|
1377
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1378
|
-
"vue/block-lang": [
|
|
1379
|
-
"error",
|
|
1380
|
-
{
|
|
1381
|
-
script: {
|
|
1382
|
-
lang: ["js", "ts"]
|
|
1383
|
-
},
|
|
1384
|
-
template: {
|
|
1385
|
-
lang: ["html", "jade", "pug", "ejs"]
|
|
1386
|
-
},
|
|
1387
|
-
style: {
|
|
1388
|
-
lang: ["css", "sass", "scss", "less", "stylus", "postcss"]
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
],
|
|
1392
|
-
"vue/require-macro-variable-name": [
|
|
1393
|
-
"error",
|
|
1394
|
-
{
|
|
1395
|
-
defineProps: "props",
|
|
1396
|
-
defineEmits: "emit",
|
|
1397
|
-
defineSlots: "slots",
|
|
1398
|
-
useSlots: "slots",
|
|
1399
|
-
useAttrs: "attrs"
|
|
1400
|
-
}
|
|
1401
|
-
],
|
|
1402
|
-
"vue/require-typed-ref": "error",
|
|
1403
|
-
"vue/no-static-inline-styles": ["error", { allowBinding: true }],
|
|
1404
|
-
"vue/no-console": [
|
|
1405
|
-
"error",
|
|
1406
|
-
{ allow: ["error", "warn", "table", "time"] }
|
|
1407
|
-
],
|
|
1408
|
-
"vue/camelcase": "error",
|
|
1409
|
-
"vue/v-for-delimiter-style": ["error", "in"],
|
|
1410
|
-
"vue/attributes-order": [
|
|
1411
|
-
"error",
|
|
1412
|
-
{
|
|
1413
|
-
order: [
|
|
1414
|
-
"DEFINITION",
|
|
1415
|
-
"LIST_RENDERING",
|
|
1416
|
-
"CONDITIONALS",
|
|
1417
|
-
"RENDER_MODIFIERS",
|
|
1418
|
-
"TWO_WAY_BINDING",
|
|
1419
|
-
"OTHER_DIRECTIVES",
|
|
1420
|
-
["UNIQUE", "SLOT"],
|
|
1421
|
-
"GLOBAL",
|
|
1422
|
-
"OTHER_ATTR",
|
|
1423
|
-
"EVENTS",
|
|
1424
|
-
"CONTENT"
|
|
1425
|
-
],
|
|
1426
|
-
alphabetical: true
|
|
1427
|
-
}
|
|
1428
|
-
],
|
|
1429
|
-
"vue/prefer-true-attribute-shorthand": "error",
|
|
1430
|
-
"vue/prefer-define-options": "error",
|
|
1431
|
-
"vue/html-comment-content-newline": [
|
|
1432
|
-
"error",
|
|
1433
|
-
{ singleline: "ignore", multiline: "always" }
|
|
1434
|
-
],
|
|
1435
|
-
"vue/html-comment-indent": ["error", "tab"],
|
|
1436
|
-
"vue/html-self-closing": [
|
|
1437
|
-
"error",
|
|
1438
|
-
{
|
|
1439
|
-
html: {
|
|
1440
|
-
void: "always",
|
|
1441
|
-
normal: "always",
|
|
1442
|
-
component: "always"
|
|
1443
|
-
},
|
|
1444
|
-
svg: "always",
|
|
1445
|
-
math: "always"
|
|
1446
|
-
}
|
|
1447
|
-
],
|
|
1448
|
-
"vue/no-useless-concat": "error",
|
|
1449
|
-
// off
|
|
1450
|
-
"vue/no-multiple-template-root": "off",
|
|
1451
|
-
"vue/multiline-html-element-content-newline": "off",
|
|
1452
|
-
"vue/singleline-html-element-content-newline": "off",
|
|
1453
|
-
"vue/no-extra-parens": "off",
|
|
1454
|
-
"vue/array-bracket-spacing": "off",
|
|
1455
|
-
"vue/arrow-spacing": "off",
|
|
1456
|
-
"vue/block-spacing": "off",
|
|
1457
|
-
"vue/brace-style": "off",
|
|
1458
|
-
"vue/comma-dangle": "off",
|
|
1459
|
-
"vue/comma-spacing": "off",
|
|
1460
|
-
"vue/comma-style": "off",
|
|
1461
|
-
"vue/operator-linebreak": "off",
|
|
1462
|
-
"vue/template-curly-spacing": "off",
|
|
1463
|
-
"vue/key-spacing": "off",
|
|
1464
|
-
"vue/keyword-spacing": "off",
|
|
1465
|
-
"vue/html-quotes": "off",
|
|
1466
|
-
"vue/html-indent": "off",
|
|
1467
|
-
"vue/no-multi-spaces": "off",
|
|
1468
|
-
"vue/max-attributes-per-line": "off",
|
|
1469
|
-
"vue/html-closing-bracket-spacing": "off",
|
|
1470
|
-
...overrides
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
];
|
|
1474
|
-
|
|
1475
|
-
const yaml = ({ overrides } = {}) => [
|
|
1476
|
-
{
|
|
1477
|
-
plugins: {
|
|
1478
|
-
yaml: pluginYaml
|
|
1479
|
-
},
|
|
1480
|
-
languageOptions: {
|
|
1481
|
-
parser: parserYaml
|
|
1482
|
-
},
|
|
1483
|
-
files: [GLOB_YAML],
|
|
1484
|
-
rules: {
|
|
1485
|
-
...renameRules(pluginYaml.configs.prettier.rules, "yml/", "yaml/"),
|
|
1486
|
-
...renameRules(pluginYaml.configs.recommended.rules, "yml/", "yaml/"),
|
|
1487
|
-
"yaml/no-empty-document": "off",
|
|
1488
|
-
"spaced-comment": "off",
|
|
1489
|
-
...overrides
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
];
|
|
1493
|
-
|
|
1494
|
-
const flatConfigProps = [
|
|
1495
|
-
"files",
|
|
1496
|
-
"ignores",
|
|
1497
|
-
"languageOptions",
|
|
1498
|
-
"linterOptions",
|
|
1499
|
-
"processor",
|
|
1500
|
-
"plugins",
|
|
1501
|
-
"rules",
|
|
1502
|
-
"settings"
|
|
1503
|
-
];
|
|
1504
|
-
const VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
|
|
1505
|
-
function so1ve(options = {}, ...userConfigs) {
|
|
1506
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1507
|
-
const {
|
|
1508
|
-
vue: enableVue = VuePackages.some((i) => localPkg.isPackageExists(i)),
|
|
1509
|
-
solid: enableSolid = localPkg.isPackageExists("solid-js"),
|
|
1510
|
-
typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
|
|
1511
|
-
gitignore: enableGitignore = true,
|
|
1512
|
-
componentExts = []
|
|
1513
|
-
} = options;
|
|
1514
|
-
const configs = [];
|
|
1515
|
-
if (enableGitignore) {
|
|
1516
|
-
if (typeof enableGitignore === "boolean") {
|
|
1517
|
-
if (fs.existsSync(".gitignore")) {
|
|
1518
|
-
configs.push([gitignore()]);
|
|
1519
|
-
}
|
|
1520
|
-
} else {
|
|
1521
|
-
configs.push([gitignore(enableGitignore)]);
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
configs.push(
|
|
1525
|
-
ignores(),
|
|
1526
|
-
javascript({
|
|
1527
|
-
overrides: getOverrides(options, "javascript")
|
|
1528
|
-
}),
|
|
1529
|
-
comments(),
|
|
1530
|
-
node(),
|
|
1531
|
-
onlyError(),
|
|
1532
|
-
promise(),
|
|
1533
|
-
sortImports(),
|
|
1534
|
-
imports(),
|
|
1535
|
-
unicorn(),
|
|
1536
|
-
html()
|
|
1537
|
-
);
|
|
1538
|
-
if (enableVue) {
|
|
1539
|
-
componentExts.push("vue");
|
|
1540
|
-
}
|
|
1541
|
-
if (enableTypeScript) {
|
|
1542
|
-
configs.push(
|
|
1543
|
-
typescript({
|
|
1544
|
-
componentExts,
|
|
1545
|
-
overrides: getOverrides(options, "typescript")
|
|
1546
|
-
})
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
if ((_a = options.test) != null ? _a : true) {
|
|
1550
|
-
configs.push(
|
|
1551
|
-
test({
|
|
1552
|
-
overrides: getOverrides(options, "test")
|
|
1553
|
-
})
|
|
1554
|
-
);
|
|
1555
|
-
}
|
|
1556
|
-
if (enableVue) {
|
|
1557
|
-
configs.push(
|
|
1558
|
-
vue({
|
|
1559
|
-
overrides: getOverrides(options, "vue"),
|
|
1560
|
-
typescript: !!enableTypeScript
|
|
1561
|
-
})
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
if (enableSolid) {
|
|
1565
|
-
configs.push(
|
|
1566
|
-
solid({
|
|
1567
|
-
overrides: getOverrides(options, "solid"),
|
|
1568
|
-
typescript: !!enableTypeScript
|
|
1569
|
-
})
|
|
1570
|
-
);
|
|
1571
|
-
}
|
|
1572
|
-
if ((_b = options.jsonc) != null ? _b : true) {
|
|
1573
|
-
configs.push(jsonc());
|
|
1574
|
-
}
|
|
1575
|
-
if ((_c = options.toml) != null ? _c : true) {
|
|
1576
|
-
configs.push(
|
|
1577
|
-
toml({
|
|
1578
|
-
overrides: getOverrides(options, "toml")
|
|
1579
|
-
})
|
|
1580
|
-
);
|
|
1581
|
-
}
|
|
1582
|
-
if ((_d = options.yaml) != null ? _d : true) {
|
|
1583
|
-
configs.push(
|
|
1584
|
-
yaml({
|
|
1585
|
-
overrides: getOverrides(options, "yaml")
|
|
1586
|
-
})
|
|
1587
|
-
);
|
|
1588
|
-
}
|
|
1589
|
-
if ((_e = options.mdx) != null ? _e : true) {
|
|
1590
|
-
configs.push(
|
|
1591
|
-
mdx({
|
|
1592
|
-
componentExts,
|
|
1593
|
-
overrides: getOverrides(options, "mdx")
|
|
1594
|
-
})
|
|
1595
|
-
);
|
|
1596
|
-
}
|
|
1597
|
-
if ((_f = options.formatting) != null ? _f : true) {
|
|
1598
|
-
configs.push(formatting(options));
|
|
1599
|
-
}
|
|
1600
|
-
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1601
|
-
if (key in options) {
|
|
1602
|
-
acc[key] = options[key];
|
|
1603
|
-
}
|
|
1604
|
-
return acc;
|
|
1605
|
-
}, {});
|
|
1606
|
-
if (Object.keys(fusedConfig).length > 0) {
|
|
1607
|
-
configs.push([fusedConfig]);
|
|
1608
|
-
}
|
|
1609
|
-
const merged = [...configs, ...userConfigs].flat();
|
|
1610
|
-
return merged;
|
|
1611
|
-
}
|
|
1612
|
-
const resolveSubOptions = (options, key) => typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1613
|
-
function getOverrides(options, key) {
|
|
1614
|
-
var _a;
|
|
1615
|
-
const sub = resolveSubOptions(options, key);
|
|
1616
|
-
return {
|
|
1617
|
-
// eslint-disable-next-line etc/no-deprecated
|
|
1618
|
-
...(_a = options.overrides) == null ? void 0 : _a[key],
|
|
1619
|
-
..."overrides" in sub ? sub.overrides : {}
|
|
1620
|
-
};
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
exports.pluginComments = pluginComments;
|
|
1624
|
-
exports.pluginHtml = pluginHtml;
|
|
1625
|
-
exports.parserHtml = parserHtml;
|
|
1626
|
-
exports.pluginSo1ve = pluginSo1ve;
|
|
1627
|
-
exports.pluginSortImports = pluginSortImports;
|
|
1628
|
-
exports.pluginStylistic = pluginStylistic;
|
|
1629
|
-
exports.parserMdx = eslintMdx;
|
|
1630
|
-
exports.pluginArrayFunc = pluginArrayFunc;
|
|
1631
|
-
exports.pluginEtc = pluginEtc;
|
|
1632
|
-
exports.pluginHtmlJsSupport = pluginHtmlJsSupport;
|
|
1633
|
-
exports.pluginImport = pluginImport;
|
|
1634
|
-
exports.pluginJestFormatting = pluginJestFormatting;
|
|
1635
|
-
exports.pluginJsonSchemaValidator = pluginJsonSchemaValidator;
|
|
1636
|
-
exports.pluginJsonc = pluginJsonc;
|
|
1637
|
-
exports.pluginMdx = pluginMdx;
|
|
1638
|
-
exports.pluginNode = pluginNode;
|
|
1639
|
-
exports.pluginNoAwaitInPromise = pluginNoAwaitInPromise__namespace;
|
|
1640
|
-
exports.pluginNoOnlyTests = pluginNoOnlyTests;
|
|
1641
|
-
exports.pluginOnlyError = pluginOnlyError;
|
|
1642
|
-
exports.pluginPromise = pluginPromise;
|
|
1643
|
-
exports.pluginRegexp = pluginRegexp;
|
|
1644
|
-
exports.pluginSolid = pluginSolid;
|
|
1645
|
-
exports.pluginToml = pluginToml;
|
|
1646
|
-
exports.pluginUnicorn = pluginUnicorn;
|
|
1647
|
-
exports.pluginUnusedImports = pluginUnusedImports;
|
|
1648
|
-
exports.pluginVitest = pluginVitest;
|
|
1649
|
-
exports.pluginVue = pluginVue;
|
|
1650
|
-
exports.pluginYaml = pluginYaml;
|
|
1651
|
-
exports.parserJsonc = parserJsonc;
|
|
1652
|
-
exports.parserToml = parserToml;
|
|
1653
|
-
exports.parserVue = parserVue;
|
|
1654
|
-
exports.parserYaml = parserYaml;
|
|
1655
|
-
exports.GLOB_ALL_SRC = GLOB_ALL_SRC;
|
|
1656
|
-
exports.GLOB_CSS = GLOB_CSS;
|
|
1657
|
-
exports.GLOB_DTS = GLOB_DTS;
|
|
1658
|
-
exports.GLOB_ESLINTRC = GLOB_ESLINTRC;
|
|
1659
|
-
exports.GLOB_EXCLUDE = GLOB_EXCLUDE;
|
|
1660
|
-
exports.GLOB_HTML = GLOB_HTML;
|
|
1661
|
-
exports.GLOB_JS = GLOB_JS;
|
|
1662
|
-
exports.GLOB_JSON = GLOB_JSON;
|
|
1663
|
-
exports.GLOB_JSON5 = GLOB_JSON5;
|
|
1664
|
-
exports.GLOB_JSONC = GLOB_JSONC;
|
|
1665
|
-
exports.GLOB_JSX = GLOB_JSX;
|
|
1666
|
-
exports.GLOB_LESS = GLOB_LESS;
|
|
1667
|
-
exports.GLOB_MARKDOWN = GLOB_MARKDOWN;
|
|
1668
|
-
exports.GLOB_MARKDOWN_CODE = GLOB_MARKDOWN_CODE;
|
|
1669
|
-
exports.GLOB_PACKAGEJSON = GLOB_PACKAGEJSON;
|
|
1670
|
-
exports.GLOB_SCSS = GLOB_SCSS;
|
|
1671
|
-
exports.GLOB_SRC = GLOB_SRC;
|
|
1672
|
-
exports.GLOB_SRC_EXT = GLOB_SRC_EXT;
|
|
1673
|
-
exports.GLOB_STYLE = GLOB_STYLE;
|
|
1674
|
-
exports.GLOB_TESTS = GLOB_TESTS;
|
|
1675
|
-
exports.GLOB_TOML = GLOB_TOML;
|
|
1676
|
-
exports.GLOB_TS = GLOB_TS;
|
|
1677
|
-
exports.GLOB_TSCONFIG = GLOB_TSCONFIG;
|
|
1678
|
-
exports.GLOB_TSX = GLOB_TSX;
|
|
1679
|
-
exports.GLOB_VUE = GLOB_VUE;
|
|
1680
|
-
exports.GLOB_YAML = GLOB_YAML;
|
|
1681
|
-
exports.comments = comments;
|
|
1682
|
-
exports.formatting = formatting;
|
|
1683
|
-
exports.getOverrides = getOverrides;
|
|
1684
|
-
exports.html = html;
|
|
1685
|
-
exports.ignores = ignores;
|
|
1686
|
-
exports.imports = imports;
|
|
1687
|
-
exports.javascript = javascript;
|
|
1688
|
-
exports.jsonc = jsonc;
|
|
1689
|
-
exports.mdx = mdx;
|
|
1690
|
-
exports.node = node;
|
|
1691
|
-
exports.onlyError = onlyError;
|
|
1692
|
-
exports.promise = promise;
|
|
1693
|
-
exports.recordRulesState = recordRulesState;
|
|
1694
|
-
exports.recordRulesStateConfigs = recordRulesStateConfigs;
|
|
1695
|
-
exports.renameRules = renameRules;
|
|
1696
|
-
exports.resolveSubOptions = resolveSubOptions;
|
|
1697
|
-
exports.so1ve = so1ve;
|
|
1698
|
-
exports.solid = solid;
|
|
1699
|
-
exports.sortImports = sortImports;
|
|
1700
|
-
exports.test = test;
|
|
1701
|
-
exports.toml = toml;
|
|
1702
|
-
exports.typescript = typescript;
|
|
1703
|
-
exports.unicorn = unicorn;
|
|
1704
|
-
exports.vue = vue;
|
|
1705
|
-
exports.warnUnnecessaryOffRules = warnUnnecessaryOffRules;
|
|
1706
|
-
exports.yaml = yaml;
|