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