@so1ve/eslint-config 1.0.0-alpha.1 → 1.0.0-alpha.3

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