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

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