@ntnyq/eslint-config 3.12.2 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs DELETED
@@ -1,3561 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- DEFAULT_PRETTIER_OPTIONS: () => DEFAULT_PRETTIER_OPTIONS,
34
- GLOB_ALL_SRC: () => GLOB_ALL_SRC,
35
- GLOB_ASTRO: () => GLOB_ASTRO,
36
- GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
37
- GLOB_CSS: () => GLOB_CSS,
38
- GLOB_DIST: () => GLOB_DIST,
39
- GLOB_DTS: () => GLOB_DTS,
40
- GLOB_EXCLUDE: () => GLOB_EXCLUDE,
41
- GLOB_GITHUB_ACTION: () => GLOB_GITHUB_ACTION,
42
- GLOB_HTML: () => GLOB_HTML,
43
- GLOB_JS: () => GLOB_JS,
44
- GLOB_JSON: () => GLOB_JSON,
45
- GLOB_JSON5: () => GLOB_JSON5,
46
- GLOB_JSONC: () => GLOB_JSONC,
47
- GLOB_JSX: () => GLOB_JSX,
48
- GLOB_LESS: () => GLOB_LESS,
49
- GLOB_LOCKFILE: () => GLOB_LOCKFILE,
50
- GLOB_MARKDOWN: () => GLOB_MARKDOWN,
51
- GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
52
- GLOB_MARKDOWN_NESTED: () => GLOB_MARKDOWN_NESTED,
53
- GLOB_NODE_MODULES: () => GLOB_NODE_MODULES,
54
- GLOB_PACKAGE_JSON: () => GLOB_PACKAGE_JSON,
55
- GLOB_PINIA_STORE: () => GLOB_PINIA_STORE,
56
- GLOB_POSTCSS: () => GLOB_POSTCSS,
57
- GLOB_SCSS: () => GLOB_SCSS,
58
- GLOB_SRC: () => GLOB_SRC,
59
- GLOB_SRC_EXT: () => GLOB_SRC_EXT,
60
- GLOB_STYLE: () => GLOB_STYLE,
61
- GLOB_SVELTE: () => GLOB_SVELTE,
62
- GLOB_SVG: () => GLOB_SVG,
63
- GLOB_TEST: () => GLOB_TEST,
64
- GLOB_TOML: () => GLOB_TOML,
65
- GLOB_TS: () => GLOB_TS,
66
- GLOB_TSX: () => GLOB_TSX,
67
- GLOB_TYPES: () => GLOB_TYPES,
68
- GLOB_VUE: () => GLOB_VUE,
69
- GLOB_YAML: () => GLOB_YAML,
70
- antfu: () => antfu,
71
- combineConfigs: () => combineConfigs,
72
- command: () => command,
73
- comments: () => comments,
74
- createNodeResolver: () => createNodeResolver,
75
- createTypeScriptImportResolver: () => import_eslint_import_resolver_typescript.createTypeScriptImportResolver,
76
- defineESLintConfig: () => defineESLintConfig,
77
- depend: () => depend,
78
- ensurePackages: () => ensurePackages,
79
- esX: () => esX,
80
- eslintPlugin: () => eslintPlugin,
81
- format: () => format,
82
- getOverrides: () => getOverrides,
83
- githubAction: () => githubAction,
84
- gitignore: () => gitignore,
85
- hasPinia: () => hasPinia,
86
- hasShadcnVue: () => hasShadcnVue,
87
- hasTypeScript: () => hasTypeScript,
88
- hasUnoCSS: () => hasUnoCSS,
89
- hasVitest: () => hasVitest,
90
- hasVue: () => hasVue,
91
- ignores: () => ignores,
92
- importX: () => importX,
93
- interopDefault: () => interopDefault,
94
- isInGitHooksOrRunByNanoStagedOrRunByTSX: () => isInGitHooksOrRunByNanoStagedOrRunByTSX,
95
- javascript: () => javascript,
96
- jsdoc: () => jsdoc,
97
- jsonc: () => jsonc,
98
- jsx: () => jsx,
99
- markdown: () => markdown,
100
- mergePrettierOptions: () => mergePrettierOptions,
101
- mergeProcessors: () => import_eslint_merge_processors.mergeProcessors,
102
- node: () => node,
103
- ntnyq: () => ntnyq,
104
- parserJsonc: () => parserJsonc,
105
- parserPlain: () => parserPlain,
106
- parserToml: () => parserToml,
107
- parserTypeScript: () => parserTypeScript,
108
- parserVue: () => parserVue,
109
- parserYaml: () => parserYaml,
110
- perfectionist: () => perfectionist,
111
- pinia: () => pinia,
112
- pluginAntfu: () => import_eslint_plugin_antfu.default,
113
- pluginComments: () => import_eslint_plugin_eslint_comments.default,
114
- pluginDepend: () => pluginDepend,
115
- pluginFormat: () => import_eslint_plugin_format.default,
116
- pluginGitHubAction: () => import_eslint_plugin_github_action.default,
117
- pluginImportX: () => import_eslint_plugin_import_x.default,
118
- pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
119
- pluginJsonc: () => import_eslint_plugin_jsonc.default,
120
- pluginMarkdown: () => import_markdown.default,
121
- pluginNode: () => import_eslint_plugin_n.default,
122
- pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
123
- pluginPinia: () => import_eslint_plugin_pinia.default,
124
- pluginPrettier: () => import_eslint_plugin_prettier.default,
125
- pluginRegexp: () => pluginRegexp,
126
- pluginSvgo: () => import_eslint_plugin_svgo.default,
127
- pluginToml: () => import_eslint_plugin_toml.default,
128
- pluginTypeScript: () => import_typescript_eslint2.plugin,
129
- pluginUnicorn: () => import_eslint_plugin_unicorn.default,
130
- pluginUnoCSS: () => import_eslint_plugin.default,
131
- pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
132
- pluginVitest: () => import_eslint_plugin2.default,
133
- pluginVue: () => import_eslint_plugin_vue.default,
134
- pluginYaml: () => import_eslint_plugin_yml.default,
135
- prettier: () => prettier,
136
- processorPassThrough: () => import_eslint_merge_processors2.processorPassThrough,
137
- processorVueBlocks: () => import_eslint_processor_vue_blocks.default,
138
- regexp: () => regexp,
139
- resolveSubOptions: () => resolveSubOptions,
140
- sort: () => sort,
141
- specials: () => specials,
142
- stylistic: () => stylistic,
143
- svgo: () => svgo,
144
- test: () => test,
145
- toArray: () => toArray,
146
- toml: () => toml,
147
- typescript: () => typescript,
148
- typescriptConfigs: () => import_typescript_eslint3.configs,
149
- unicorn: () => unicorn,
150
- unocss: () => unocss,
151
- unusedImports: () => unusedImports,
152
- vitest: () => vitest,
153
- vue: () => vue,
154
- yml: () => yml
155
- });
156
- module.exports = __toCommonJS(index_exports);
157
-
158
- // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
159
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
160
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
161
-
162
- // src/core.ts
163
- var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
164
-
165
- // src/configs/vue.ts
166
- var import_eslint_merge_processors3 = require("eslint-merge-processors");
167
-
168
- // src/eslint/parsers.ts
169
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
170
- var parserVue = __toESM(require("vue-eslint-parser"), 1);
171
- var parserToml = __toESM(require("toml-eslint-parser"), 1);
172
- var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
173
- var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
174
- var parserTypeScript = import_typescript_eslint.default.parser;
175
- var parserPlain = {
176
- meta: {
177
- name: "plain-eslint-parser"
178
- },
179
- parseForESLint: (code) => ({
180
- ast: {
181
- body: [],
182
- comments: [],
183
- loc: { start: 0, end: code.length },
184
- range: [0, code.length],
185
- tokens: [],
186
- type: "Program"
187
- },
188
- scopeManager: null,
189
- services: { isPlain: true },
190
- visitorKeys: {
191
- Program: []
192
- }
193
- })
194
- };
195
-
196
- // src/eslint/plugins.ts
197
- var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
198
- var pluginDepend = __toESM(require("eslint-plugin-depend"), 1);
199
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
200
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
201
- var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
202
- var import_eslint_plugin_svgo = __toESM(require("eslint-plugin-svgo"), 1);
203
- var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
204
- var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
205
- var import_markdown = __toESM(require("@eslint/markdown"), 1);
206
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
207
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
208
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
209
- var import_typescript_eslint2 = require("typescript-eslint");
210
- var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
211
- var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
212
- var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
213
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
214
- var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
215
- var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
216
- var import_eslint_plugin_github_action = __toESM(require("eslint-plugin-github-action"), 1);
217
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
218
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
219
- var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
220
-
221
- // src/eslint/configs.ts
222
- var import_typescript_eslint3 = require("typescript-eslint");
223
-
224
- // src/eslint/resolvers.ts
225
- var import_eslint_import_resolver_typescript = require("eslint-import-resolver-typescript");
226
- var createNodeResolver = import_eslint_plugin_import_x.default.createNodeResolver;
227
-
228
- // src/eslint/processors.ts
229
- var import_eslint_merge_processors = require("eslint-merge-processors");
230
- var import_eslint_merge_processors2 = require("eslint-merge-processors");
231
- var import_eslint_processor_vue_blocks = __toESM(require("eslint-processor-vue-blocks"), 1);
232
-
233
- // src/globs.ts
234
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
235
- var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
236
- var GLOB_JS = "**/*.?([cm])js";
237
- var GLOB_JSX = `${GLOB_JS}x`;
238
- var GLOB_TS = "**/*.?([cm])ts";
239
- var GLOB_TSX = `${GLOB_TS}x`;
240
- var GLOB_DTS = "**/*.d.?([cm])ts";
241
- var GLOB_TYPES = [GLOB_DTS, `**/types/${GLOB_TS}`, `**/types.ts`];
242
- var GLOB_TEST = [
243
- `**/*.test.${GLOB_SRC_EXT}`,
244
- `**/*.spec.${GLOB_SRC_EXT}`,
245
- `**/*.bench.${GLOB_SRC_EXT}`,
246
- `**/*.benchmark.${GLOB_SRC_EXT}`
247
- ];
248
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
249
- var GLOB_CSS = "**/*.css";
250
- var GLOB_LESS = "**/*.less";
251
- var GLOB_SCSS = "**/*.scss";
252
- var GLOB_POSTCSS = "**/*.{p,post}css";
253
- var GLOB_JSON = "**/*.json";
254
- var GLOB_JSON5 = "**/*.json5";
255
- var GLOB_JSONC = "**/*.jsonc";
256
- var GLOB_PACKAGE_JSON = "**/package.json";
257
- var GLOB_SVG = "**/*.svg";
258
- var GLOB_VUE = "**/*.vue";
259
- var GLOB_YAML = "**/*.y?(a)ml";
260
- var GLOB_TOML = "**/*.toml";
261
- var GLOB_HTML = "**/*.htm?(l)";
262
- var GLOB_ASTRO = "**/*.astro";
263
- var GLOB_ASTRO_TS = "**/*.astro/*.ts";
264
- var GLOB_SVELTE = "**/*.svelte";
265
- var GLOB_MARKDOWN = "**/*.md";
266
- var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
267
- var GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
268
- var GLOB_ALL_SRC = [
269
- GLOB_SRC,
270
- GLOB_STYLE,
271
- GLOB_JSON,
272
- GLOB_JSON5,
273
- GLOB_VUE,
274
- GLOB_YAML,
275
- GLOB_TOML,
276
- GLOB_HTML,
277
- GLOB_MARKDOWN
278
- ];
279
- var GLOB_PINIA_STORE = `**/store?(s)/*.${GLOB_SRC_EXT}`;
280
- var GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
281
- var GLOB_NODE_MODULES = "**/node_modules/**";
282
- var GLOB_DIST = "**/dist/**";
283
- var GLOB_LOCKFILE = [
284
- "**/package-lock.json",
285
- "**/yarn.lock",
286
- "**/pnpm-lock.yaml",
287
- "**/bun.lockb",
288
- "**/deno.lock"
289
- ];
290
- var GLOB_EXCLUDE = [
291
- GLOB_NODE_MODULES,
292
- GLOB_DIST,
293
- ...GLOB_LOCKFILE,
294
- // Force lint
295
- "!.github",
296
- "!.vitepress",
297
- "!.vuepress",
298
- "!.vscode",
299
- "**/CHANGELOG*.md",
300
- "**/*.min.*",
301
- "**/LICENSE*",
302
- "**/__snapshots__",
303
- // unplugin-auto-import
304
- "**/auto-import?(s).d.ts",
305
- // unplugin-vue-components
306
- "**/components.d.ts",
307
- // unplugin-vue-router
308
- "**/typed-router.d.ts",
309
- // vite-plugin-uni-pages
310
- "**/uni-pages.d.ts",
311
- "**/coverage",
312
- "**/fixtures",
313
- "**/output",
314
- "**/public",
315
- "**/static",
316
- // VitePress and VuePress
317
- "**/?(.)temp",
318
- "**/?(.)cache",
319
- "**/.eslintcache",
320
- "**/.stylelintcache",
321
- "**/.eslint-config-inspector",
322
- "**/.vite-inspect",
323
- "**/.nuxt",
324
- "**/.wxt",
325
- "**/.output",
326
- "**/.tsup",
327
- "**/.nitro",
328
- "**/.vercel",
329
- "**/.wrangler",
330
- "**/.changeset",
331
- "**/.npmrc",
332
- "**/.yarnrc",
333
- "**/.husky",
334
- // tauri
335
- "**/src-tauri/gen",
336
- "**/src-tauri/target"
337
- ];
338
-
339
- // src/configs/vue.ts
340
- var vue2Rules = {
341
- ...import_eslint_plugin_vue.default.configs.base.rules,
342
- ...import_eslint_plugin_vue.default.configs.essential.rules,
343
- ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
344
- ...import_eslint_plugin_vue.default.configs.recommended.rules
345
- };
346
- var vue3Rules = {
347
- ...import_eslint_plugin_vue.default.configs.base.rules,
348
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
349
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
350
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
351
- };
352
- var disabledRules = {
353
- "vue/no-v-html": "off",
354
- "vue/require-prop-types": "off",
355
- "vue/require-default-prop": "off",
356
- "vue/multi-word-component-names": "off",
357
- "vue/no-v-text-v-html-on-component": "off",
358
- "vue/no-setup-props-reactivity-loss": "off"
359
- };
360
- var extensionRules = {
361
- "vue/prefer-template": "error",
362
- "vue/no-sparse-arrays": "error",
363
- "vue/no-empty-pattern": "error",
364
- "vue/space-infix-ops": "error",
365
- "vue/no-loss-of-precision": "error",
366
- "vue/no-constant-condition": "error",
367
- "vue/template-curly-spacing": "error",
368
- "vue/eqeqeq": ["error", "smart"],
369
- "vue/comma-style": ["error", "last"],
370
- "vue/block-spacing": ["error", "always"],
371
- "vue/dot-location": ["error", "property"],
372
- "vue/space-in-parens": ["error", "never"],
373
- "vue/operator-linebreak": ["error", "before"],
374
- "vue/no-extra-parens": ["error", "functions"],
375
- "vue/array-bracket-spacing": ["error", "never"],
376
- "vue/object-curly-spacing": ["error", "always"],
377
- "vue/comma-dangle": ["error", "always-multiline"],
378
- "vue/quote-props": ["error", "consistent-as-needed"],
379
- "vue/arrow-spacing": ["error", { before: true, after: true }],
380
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
381
- "vue/comma-spacing": ["error", { before: false, after: true }],
382
- "vue/dot-notation": ["error", { allowKeywords: true }],
383
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
384
- "vue/keyword-spacing": ["error", { before: true, after: true }],
385
- "vue/no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
386
- "vue/space-unary-ops": [
387
- "error",
388
- {
389
- words: true,
390
- nonwords: false
391
- }
392
- ],
393
- "vue/object-curly-newline": [
394
- "error",
395
- {
396
- multiline: true,
397
- consistent: true
398
- }
399
- ],
400
- "vue/object-property-newline": [
401
- "error",
402
- {
403
- allowMultiplePropertiesPerLine: true
404
- }
405
- ],
406
- "vue/object-shorthand": [
407
- "error",
408
- "always",
409
- {
410
- ignoreConstructors: false,
411
- avoidQuotes: true
412
- }
413
- ]
414
- };
415
- var unCategorizedRules = {
416
- "vue/no-v-text": "error",
417
- "vue/no-useless-v-bind": "error",
418
- "vue/valid-define-options": "error",
419
- "vue/prefer-define-options": "error",
420
- "vue/prefer-use-template-ref": "error",
421
- "vue/no-irregular-whitespace": "error",
422
- "vue/no-use-v-else-with-v-for": "error",
423
- "vue/no-deprecated-delete-set": "error",
424
- "vue/no-empty-component-block": "error",
425
- "vue/require-typed-object-prop": "error",
426
- "vue/no-unused-emit-declarations": "error",
427
- "vue/padding-line-between-blocks": "error",
428
- "vue/no-multiple-objects-in-class": "error",
429
- "vue/prefer-separate-static-class": "error",
430
- "vue/no-ref-object-reactivity-loss": "error",
431
- "vue/prefer-prop-type-boolean-first": "error",
432
- "vue/html-comment-indent": ["error", 2],
433
- "vue/next-tick-style": ["error", "promise"],
434
- "vue/v-for-delimiter-style": ["error", "in"],
435
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
436
- "vue/slot-name-casing": ["error", "kebab-case"],
437
- "vue/custom-event-name-casing": ["error", "camelCase"],
438
- "vue/define-props-declaration": ["error", "type-based"],
439
- "vue/define-emits-declaration": ["error", "type-literal"],
440
- "vue/prefer-true-attribute-shorthand": ["error", "always"],
441
- "vue/component-options-name-casing": ["error", "PascalCase"],
442
- "vue/component-api-style": ["error", ["script-setup", "composition"]],
443
- "vue/html-button-has-type": [
444
- "error",
445
- {
446
- button: true,
447
- submit: true,
448
- reset: true
449
- }
450
- ],
451
- "vue/no-duplicate-attr-inheritance": [
452
- "error",
453
- {
454
- checkMultiRootNodes: true
455
- }
456
- ],
457
- "vue/block-order": [
458
- "error",
459
- {
460
- order: ["script", "template", "style"]
461
- }
462
- ],
463
- "vue/enforce-style-attribute": [
464
- "error",
465
- {
466
- allow: ["scoped", "plain"]
467
- }
468
- ],
469
- "vue/block-tag-newline": [
470
- "error",
471
- {
472
- singleline: "always",
473
- multiline: "always"
474
- }
475
- ],
476
- "vue/no-required-prop-with-default": [
477
- "error",
478
- {
479
- autofix: true
480
- }
481
- ],
482
- "vue/html-comment-content-newline": [
483
- "error",
484
- {
485
- singleline: "ignore",
486
- multiline: "always"
487
- },
488
- {
489
- exceptions: ["*"]
490
- }
491
- ],
492
- "vue/no-static-inline-styles": [
493
- "error",
494
- {
495
- allowBinding: true
496
- }
497
- ],
498
- "vue/no-deprecated-model-definition": [
499
- "error",
500
- {
501
- allowVue3Compat: true
502
- }
503
- ],
504
- "vue/component-name-in-template-casing": [
505
- "error",
506
- "PascalCase",
507
- {
508
- // Force auto-import components to be PascalCase
509
- registeredComponentsOnly: false,
510
- ignores: ["slot", "component"]
511
- }
512
- ],
513
- "vue/define-macros-order": [
514
- "error",
515
- {
516
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots", "defineModel"],
517
- defineExposeLast: true
518
- }
519
- ],
520
- "vue/html-comment-content-spacing": [
521
- "error",
522
- "always",
523
- {
524
- exceptions: ["-"]
525
- }
526
- ],
527
- "vue/require-macro-variable-name": [
528
- "error",
529
- {
530
- defineProps: "props",
531
- defineEmits: "emits",
532
- defineSlots: "slots",
533
- useSlots: "slots",
534
- useAttrs: "attrs"
535
- }
536
- ]
537
- };
538
- var vue = (options = {}) => {
539
- const isVue3 = options.vueVersion !== 2;
540
- const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
541
- const { files: FILES_VUE = [GLOB_VUE] } = options;
542
- function getVueProcessor() {
543
- const processorVueSFC = import_eslint_plugin_vue.default.processors[".vue"];
544
- if (!sfcBlocks) return processorVueSFC;
545
- return (0, import_eslint_merge_processors3.mergeProcessors)([
546
- processorVueSFC,
547
- (0, import_eslint_processor_vue_blocks.default)({
548
- ...sfcBlocks,
549
- blocks: {
550
- styles: true,
551
- ...sfcBlocks.blocks
552
- }
553
- })
554
- ]);
555
- }
556
- return [
557
- {
558
- name: "ntnyq/vue/setup",
559
- plugins: {
560
- vue: import_eslint_plugin_vue.default,
561
- "@typescript-eslint": import_typescript_eslint2.plugin
562
- }
563
- },
564
- {
565
- name: "ntnyq/vue/rules",
566
- files: [
567
- // File apply vue rules
568
- ...FILES_VUE
569
- ],
570
- languageOptions: {
571
- parser: parserVue,
572
- parserOptions: {
573
- sourceType: "module",
574
- ecmaVersion: "latest",
575
- extraFileExtensions: [".vue"],
576
- parser: parserTypeScript,
577
- ecmaFeatures: {
578
- jsx: true
579
- }
580
- }
581
- },
582
- processor: getVueProcessor(),
583
- rules: {
584
- ...isVue3 ? vue3Rules : vue2Rules,
585
- "vue/html-self-closing": [
586
- "error",
587
- {
588
- html: {
589
- void: "always",
590
- normal: "always",
591
- component: "always"
592
- },
593
- svg: "always",
594
- math: "always"
595
- }
596
- ],
597
- "vue/this-in-template": ["error", "never"],
598
- "vue/prop-name-casing": ["error", "camelCase"],
599
- "vue/attributes-order": [
600
- "error",
601
- {
602
- order: [
603
- "EVENTS",
604
- // `@click="functionCall"`, `v-on="event"`
605
- "TWO_WAY_BINDING",
606
- // `v-model`
607
- "OTHER_DIRECTIVES",
608
- // `v-custom-directive`
609
- "LIST_RENDERING",
610
- // `v-for item in items`
611
- "CONDITIONALS",
612
- // `v-if`, `v-show`, `v-cloak`
613
- "CONTENT",
614
- // `v-text`, `v-html`
615
- "SLOT",
616
- // `v-slot`, `slot`
617
- "UNIQUE",
618
- // `ref`, `key`
619
- "DEFINITION",
620
- // `is`, `v-is`
621
- "ATTR_DYNAMIC",
622
- // `v-bind:prop="foo"`, `:prop="foo"`
623
- // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
624
- "RENDER_MODIFIERS",
625
- // `v-once`, `v-pre`
626
- "GLOBAL",
627
- // `id`
628
- "ATTR_STATIC",
629
- // `prop="foo", `static attributes
630
- "ATTR_SHORTHAND_BOOL"
631
- // `disabled`, prop shorthand
632
- ],
633
- alphabetical: false
634
- }
635
- ],
636
- "vue/order-in-components": [
637
- "error",
638
- {
639
- order: [
640
- "el",
641
- "name",
642
- "key",
643
- "parent",
644
- "functional",
645
- ["provide", "inject"],
646
- ["delimiters", "comments"],
647
- ["components", "directives", "filters"],
648
- "extends",
649
- "mixins",
650
- "layout",
651
- "middleware",
652
- "validate",
653
- "scrollToTop",
654
- "transition",
655
- "loading",
656
- "inheritAttrs",
657
- "model",
658
- ["props", "propsData"],
659
- "emits",
660
- "setup",
661
- "asyncData",
662
- "computed",
663
- "data",
664
- "fetch",
665
- "head",
666
- "methods",
667
- ["template", "render"],
668
- "watch",
669
- "watchQuery",
670
- "LIFECYCLE_HOOKS",
671
- "renderError",
672
- "ROUTER_GUARDS"
673
- ]
674
- }
675
- ],
676
- "vue/max-attributes-per-line": [
677
- "error",
678
- {
679
- singleline: 1,
680
- multiline: 1
681
- }
682
- ],
683
- ...disabledRules,
684
- ...extensionRules,
685
- ...unCategorizedRules,
686
- // Overrides rules
687
- ...options.overrides
688
- }
689
- }
690
- ];
691
- };
692
-
693
- // src/configs/yml.ts
694
- var yml = (options = {}) => [
695
- {
696
- name: "ntnyq/yaml",
697
- files: [GLOB_YAML],
698
- languageOptions: {
699
- parser: parserYaml
700
- },
701
- plugins: {
702
- yml: import_eslint_plugin_yml.default
703
- },
704
- rules: {
705
- ...import_eslint_plugin_yml.default.configs.standard.rules,
706
- ...import_eslint_plugin_yml.default.configs.prettier.rules,
707
- "yml/no-empty-mapping-value": "off",
708
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
709
- // Overrides rules
710
- ...options.overrides
711
- }
712
- }
713
- ];
714
-
715
- // src/utils/env.ts
716
- var import_node_path = require("path");
717
- var import_node_process = __toESM(require("process"), 1);
718
- var import_local_pkg = require("local-pkg");
719
- var hasPinia = (0, import_local_pkg.isPackageExists)("pinia");
720
- var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
721
- var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
722
- var hasShadcnVue = (0, import_local_pkg.isPackageExists)("radix-vue") && (0, import_local_pkg.isPackageExists)("clsx");
723
- var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
724
- var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("vuepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
725
- paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground"), (0, import_node_path.resolve)(import_node_process.default.cwd(), "docs")]
726
- });
727
-
728
- // src/utils/toArray.ts
729
- function toArray(val) {
730
- val = val ?? [];
731
- return Array.isArray(val) ? val : [val];
732
- }
733
-
734
- // src/utils/resolveSubOptions.ts
735
- function resolveSubOptions(options, key) {
736
- return typeof options[key] === "boolean" ? {} : options[key] || {};
737
- }
738
-
739
- // src/utils/getOverrides.ts
740
- function getOverrides(options, key) {
741
- const subOptions = resolveSubOptions(options, key);
742
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
743
- }
744
-
745
- // src/utils/combineConfigs.ts
746
- async function combineConfigs(...configs2) {
747
- const resolved = await Promise.all(configs2);
748
- return resolved.flat();
749
- }
750
-
751
- // src/utils/ensurePackages.ts
752
- var import_node_process3 = __toESM(require("process"), 1);
753
- var import_node_url = require("url");
754
- var import_local_pkg2 = require("local-pkg");
755
-
756
- // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
757
- var import_node_process2 = __toESM(require("process"), 1);
758
- function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
759
- return !!(import_node_process2.default.env.GIT_PARAMS || import_node_process2.default.env.VSCODE_GIT_COMMAND || // lint staged files
760
- import_node_process2.default.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
761
- import_node_process2.default.env.npm_lifecycle_script?.startsWith("tsx"));
762
- }
763
-
764
- // src/utils/ensurePackages.ts
765
- var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
766
- var isCwdInScope = (0, import_local_pkg2.isPackageExists)("@ntnyq/eslint-config");
767
- function isPackageInScope(name) {
768
- return (0, import_local_pkg2.isPackageExists)(name, {
769
- paths: [scopeUrl]
770
- });
771
- }
772
- async function ensurePackages(packages) {
773
- if (import_node_process3.default.env.CI || !import_node_process3.default.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
774
- return;
775
- }
776
- const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
777
- if (nonExistingPackages.length === 0) {
778
- return;
779
- }
780
- const { confirm } = await import("@clack/prompts");
781
- const confirmInstall = await confirm({
782
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
783
- });
784
- if (confirmInstall) {
785
- try {
786
- const { installPackage } = await import("@antfu/install-pkg");
787
- await installPackage(nonExistingPackages, { dev: true });
788
- } catch (err) {
789
- console.log(err);
790
- }
791
- }
792
- }
793
-
794
- // src/utils/interopDefault.ts
795
- async function interopDefault(mod) {
796
- const resolved = await mod;
797
- return resolved.default || resolved;
798
- }
799
-
800
- // src/utils/mergePrettierOptions.ts
801
- function mergePrettierOptions(options = {}, overrides = {}) {
802
- const result = {
803
- ...options,
804
- ...overrides,
805
- plugins: [
806
- // built-in plugins
807
- ...options.plugins || [],
808
- // custom plugins
809
- ...overrides.plugins || []
810
- ]
811
- };
812
- return result;
813
- }
814
-
815
- // src/configs/esX.ts
816
- var esX = async (options = {}) => {
817
- await ensurePackages(["eslint-plugin-es-x"]);
818
- const pluginEsX = await interopDefault(import("eslint-plugin-es-x"));
819
- return [
820
- {
821
- name: "ntnyq/es-x",
822
- plugins: {
823
- "es-x": pluginEsX
824
- },
825
- rules: {
826
- // Overrides rules
827
- ...options.overrides
828
- }
829
- }
830
- ];
831
- };
832
-
833
- // src/configs/node.ts
834
- var node = (options = {}) => [
835
- {
836
- name: "ntnyq/node",
837
- plugins: {
838
- node: import_eslint_plugin_n.default
839
- },
840
- rules: {
841
- "node/handle-callback-err": ["error", "^(err|error)$"],
842
- "node/no-deprecated-api": "error",
843
- "node/no-exports-assign": "error",
844
- "node/no-new-require": "error",
845
- "node/no-path-concat": "error",
846
- "node/prefer-global/buffer": ["error", "never"],
847
- "node/prefer-global/process": ["error", "never"],
848
- "node/process-exit-as-throw": "error",
849
- // Overrides rules
850
- ...options.overrides
851
- }
852
- }
853
- ];
854
-
855
- // src/configs/sort.ts
856
- var sort = (options = {}) => {
857
- const configs2 = [];
858
- const {
859
- tsconfig: enableSortTsconfig = true,
860
- packageJson: enableSortPackageJson = true,
861
- i18nLocale: enableSortI18nLocale = true,
862
- pnpmWorkspace: enableSortPnpmWorkspace = true
863
- } = options;
864
- if (enableSortTsconfig) {
865
- configs2.push({
866
- name: "ntnyq/sort/tsconfig",
867
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
868
- rules: {
869
- "jsonc/sort-keys": [
870
- "error",
871
- {
872
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
873
- pathPattern: "^$"
874
- },
875
- {
876
- order: [
877
- /* Projects */
878
- "incremental",
879
- "composite",
880
- "tsBuildInfoFile",
881
- "disableSourceOfProjectReferenceRedirect",
882
- "disableSolutionSearching",
883
- "disableReferencedProjectLoad",
884
- /* Language and Environment */
885
- "target",
886
- "lib",
887
- "jsx",
888
- "experimentalDecorators",
889
- "emitDecoratorMetadata",
890
- "jsxFactory",
891
- "jsxFragmentFactory",
892
- "jsxImportSource",
893
- "reactNamespace",
894
- "noLib",
895
- "useDefineForClassFields",
896
- "moduleDetection",
897
- /* Modules */
898
- "module",
899
- "rootDir",
900
- "moduleResolution",
901
- "baseUrl",
902
- "paths",
903
- "rootDirs",
904
- "typeRoots",
905
- "types",
906
- "allowUmdGlobalAccess",
907
- "moduleSuffixes",
908
- "allowImportingTsExtensions",
909
- "resolvePackageJsonExports",
910
- "resolvePackageJsonImports",
911
- "customConditions",
912
- "resolveJsonModule",
913
- "allowArbitraryExtensions",
914
- "noResolve",
915
- /* JavaScript Support */
916
- "allowJs",
917
- "checkJs",
918
- "maxNodeModuleJsDepth",
919
- /* Emit */
920
- "declaration",
921
- "declarationMap",
922
- "emitDeclarationOnly",
923
- "sourceMap",
924
- "inlineSourceMap",
925
- "outFile",
926
- "outDir",
927
- "removeComments",
928
- "noEmit",
929
- "importHelpers",
930
- "importsNotUsedAsValues",
931
- "downlevelIteration",
932
- "sourceRoot",
933
- "mapRoot",
934
- "inlineSources",
935
- "emitBOM",
936
- "newLine",
937
- "stripInternal",
938
- "noEmitHelpers",
939
- "noEmitOnError",
940
- "preserveConstEnums",
941
- "declarationDir",
942
- "preserveValueImports",
943
- /* Interop Constraints */
944
- "isolatedModules",
945
- "verbatimModuleSyntax",
946
- "allowSyntheticDefaultImports",
947
- "esModuleInterop",
948
- "preserveSymlinks",
949
- "forceConsistentCasingInFileNames",
950
- /* Type Checking */
951
- "strict",
952
- "strictBindCallApply",
953
- "strictFunctionTypes",
954
- "strictNullChecks",
955
- "strictPropertyInitialization",
956
- "allowUnreachableCode",
957
- "allowUnusedLabels",
958
- "alwaysStrict",
959
- "exactOptionalPropertyTypes",
960
- "noFallthroughCasesInSwitch",
961
- "noImplicitAny",
962
- "noImplicitOverride",
963
- "noImplicitReturns",
964
- "noImplicitThis",
965
- "noPropertyAccessFromIndexSignature",
966
- "noUncheckedIndexedAccess",
967
- "noUnusedLocals",
968
- "noUnusedParameters",
969
- "useUnknownInCatchVariables",
970
- /* Completeness */
971
- "skipDefaultLibCheck",
972
- "skipLibCheck"
973
- ],
974
- pathPattern: "^compilerOptions$"
975
- }
976
- ]
977
- }
978
- });
979
- }
980
- if (enableSortPackageJson) {
981
- configs2.push({
982
- name: "ntnyq/sort/package-json",
983
- files: ["**/package.json"],
984
- rules: {
985
- "jsonc/sort-keys": [
986
- "error",
987
- {
988
- pathPattern: "^$",
989
- order: [
990
- /**
991
- * Meta
992
- */
993
- "publisher",
994
- "name",
995
- "displayName",
996
- "preview",
997
- "type",
998
- "config",
999
- "version",
1000
- "private",
1001
- "packageManager",
1002
- "workspaces",
1003
- "description",
1004
- "keywords",
1005
- "license",
1006
- "licenses",
1007
- "author",
1008
- "contributors",
1009
- "maintainers",
1010
- "homepage",
1011
- "repository",
1012
- "bugs",
1013
- "funding",
1014
- /**
1015
- * Publish
1016
- */
1017
- "exports",
1018
- "imports",
1019
- "main",
1020
- "module",
1021
- "unpkg",
1022
- "jsdelivr",
1023
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
1024
- "types",
1025
- "typesVersions",
1026
- "bin",
1027
- "icon",
1028
- "files",
1029
- "directories",
1030
- "publishConfig",
1031
- /**
1032
- * Misc
1033
- */
1034
- "sideEffects",
1035
- "scripts",
1036
- /**
1037
- * Dependencies
1038
- */
1039
- "peerDependencies",
1040
- "peerDependenciesMeta",
1041
- "bundledDependencies",
1042
- "bundleDependencies",
1043
- "dependencies",
1044
- "optionalDependencies",
1045
- "devDependencies",
1046
- /**
1047
- * VSCode extension
1048
- */
1049
- "activationEvents",
1050
- "contributes",
1051
- "categories",
1052
- "galleryBanner",
1053
- "badges",
1054
- "markdown",
1055
- "qna",
1056
- "sponsor",
1057
- "extensionPack",
1058
- "extensionDependencies",
1059
- "extensionKind",
1060
- "pricing",
1061
- "capabilities",
1062
- /**
1063
- * Package manager
1064
- */
1065
- "engines",
1066
- "pnpm",
1067
- "overrides",
1068
- "resolutions",
1069
- /**
1070
- * Third party
1071
- */
1072
- "husky",
1073
- "prettier",
1074
- "nano-staged",
1075
- "lint-staged",
1076
- "eslintConfig"
1077
- ]
1078
- },
1079
- {
1080
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1081
- order: { type: "asc" }
1082
- },
1083
- {
1084
- order: { type: "asc" },
1085
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1086
- },
1087
- {
1088
- pathPattern: "^exports.*$",
1089
- order: ["types", "import", "require", "default"]
1090
- },
1091
- // VSCode extension
1092
- {
1093
- order: { type: "asc" },
1094
- pathPattern: "^contributes.*$"
1095
- },
1096
- /**
1097
- * pnpm publish config
1098
- * @see {@link https://pnpm.io/package_json#publishconfig}
1099
- */
1100
- {
1101
- order: { type: "asc" },
1102
- pathPattern: "^publishConfig.*$"
1103
- },
1104
- // npm scripts
1105
- {
1106
- pathPattern: "^scripts$",
1107
- order: { type: "asc" }
1108
- },
1109
- {
1110
- order: [
1111
- // client hooks only
1112
- "pre-commit",
1113
- "prepare-commit-msg",
1114
- "commit-msg",
1115
- "post-commit",
1116
- "pre-rebase",
1117
- "post-rewrite",
1118
- "post-checkout",
1119
- "post-merge",
1120
- "pre-push",
1121
- "pre-auto-gc"
1122
- ],
1123
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1124
- }
1125
- ],
1126
- "jsonc/sort-array-values": [
1127
- "error",
1128
- {
1129
- pathPattern: "^files$",
1130
- order: { type: "asc" }
1131
- },
1132
- {
1133
- pathPattern: "^keywords$",
1134
- order: { type: "asc" }
1135
- },
1136
- {
1137
- pathPattern: "^activationEvents$",
1138
- order: { type: "asc" }
1139
- },
1140
- {
1141
- pathPattern: "^contributes.*$",
1142
- order: { type: "asc" }
1143
- }
1144
- ]
1145
- }
1146
- });
1147
- }
1148
- if (enableSortI18nLocale) {
1149
- configs2.push(
1150
- {
1151
- name: "ntnyq/sort/i18n-locale/json",
1152
- files: ["**/{locales,i18n}/*.json"],
1153
- rules: {
1154
- "jsonc/sort-keys": [
1155
- "error",
1156
- {
1157
- pathPattern: ".*",
1158
- order: { type: "asc" }
1159
- }
1160
- ]
1161
- }
1162
- },
1163
- {
1164
- name: "ntnyq/sort/i18n-locale/yaml",
1165
- files: ["**/{locales,i18n}/*.y?(a)ml"],
1166
- rules: {
1167
- "yml/sort-keys": [
1168
- "error",
1169
- {
1170
- pathPattern: ".*",
1171
- order: { type: "asc" }
1172
- }
1173
- ]
1174
- }
1175
- }
1176
- );
1177
- }
1178
- if (enableSortPnpmWorkspace) {
1179
- configs2.push({
1180
- name: "ntnyq/sort/pnpm-workspace",
1181
- files: ["**/pnpm-workspace.yaml"],
1182
- rules: {
1183
- "yml/sort-keys": [
1184
- "error",
1185
- {
1186
- pathPattern: ".*",
1187
- order: { type: "asc" }
1188
- }
1189
- ]
1190
- }
1191
- });
1192
- }
1193
- return configs2;
1194
- };
1195
-
1196
- // src/configs/toml.ts
1197
- var toml = (options = {}) => [
1198
- {
1199
- name: "ntnyq/toml",
1200
- files: [GLOB_TOML],
1201
- languageOptions: {
1202
- parser: parserToml
1203
- },
1204
- plugins: {
1205
- toml: import_eslint_plugin_toml.default
1206
- },
1207
- rules: {
1208
- "toml/keys-order": "error",
1209
- "toml/key-spacing": "error",
1210
- "toml/quoted-keys": "error",
1211
- "toml/comma-style": "error",
1212
- "toml/tables-order": "error",
1213
- "toml/no-space-dots": "error",
1214
- "toml/spaced-comment": "error",
1215
- "toml/precision-of-integer": "error",
1216
- "toml/table-bracket-spacing": "error",
1217
- "toml/array-bracket-newline": "error",
1218
- "toml/inline-table-curly-spacing": "error",
1219
- "toml/padding-line-between-pairs": "error",
1220
- "toml/padding-line-between-tables": "error",
1221
- "toml/no-unreadable-number-separator": "error",
1222
- "toml/precision-of-fractional-seconds": "error",
1223
- "toml/vue-custom-block/no-parsing-error": "error",
1224
- "toml/indent": ["error", 2],
1225
- "toml/array-bracket-spacing": ["error", "never"],
1226
- "toml/array-element-newline": ["error", "never"],
1227
- // Overrides rules
1228
- ...options.overrides
1229
- }
1230
- }
1231
- ];
1232
-
1233
- // src/configs/test.ts
1234
- var test = (options = {}) => [
1235
- {
1236
- name: "ntnyq/test",
1237
- files: [...GLOB_TEST],
1238
- rules: {
1239
- "no-unused-expressions": "off",
1240
- "max-lines-per-function": "off",
1241
- // Overrides rules
1242
- ...options.overrides
1243
- }
1244
- }
1245
- ];
1246
- var vitest = (options = {}) => {
1247
- if (!import_eslint_plugin2.default.configs?.recommended) return [];
1248
- const vitestConfigs = import_eslint_plugin2.default.configs;
1249
- return [
1250
- {
1251
- name: "ntnyq/vitest",
1252
- plugins: {
1253
- vitest: import_eslint_plugin2.default
1254
- },
1255
- files: [...GLOB_TEST],
1256
- rules: {
1257
- ...vitestConfigs.recommended.rules,
1258
- // Overrides rules
1259
- ...options.overridesVitestRules
1260
- }
1261
- }
1262
- ];
1263
- };
1264
-
1265
- // src/configs/svgo.ts
1266
- var import_eslint_plugin_svgo2 = require("eslint-plugin-svgo");
1267
- var svgo = (options = {}) => {
1268
- const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1269
- return [
1270
- (0, import_eslint_plugin_svgo2.createConfig)({
1271
- name: "ntnyq/svgo",
1272
- files,
1273
- rules: {
1274
- "svgo/svgo": "error",
1275
- ...overridesRules
1276
- }
1277
- })
1278
- ];
1279
- };
1280
-
1281
- // src/configs/antfu.ts
1282
- var antfu = (options = {}) => [
1283
- {
1284
- name: "ntnyq/antfu",
1285
- plugins: {
1286
- antfu: import_eslint_plugin_antfu.default
1287
- },
1288
- rules: {
1289
- // required `object-curly-newline` to be disabled
1290
- // 'antfu/consistent-list-newline': 'error',
1291
- "antfu/import-dedupe": "error",
1292
- "antfu/no-import-dist": "error",
1293
- "antfu/indent-unindent": "error",
1294
- "antfu/no-import-node-modules-by-path": "error",
1295
- // Overrides rules
1296
- ...options.overrides
1297
- }
1298
- }
1299
- ];
1300
-
1301
- // src/configs/jsdoc.ts
1302
- var javscriptRules = {
1303
- "jsdoc/no-types": "off",
1304
- "jsdoc/no-undefined-types": "error",
1305
- "jsdoc/require-param-type": "error",
1306
- "jsdoc/require-property-type": "error",
1307
- "jsdoc/require-returns-type": "error"
1308
- };
1309
- var typescriptRules = {
1310
- "jsdoc/no-undefined-types": "off",
1311
- "jsdoc/require-param-type": "off",
1312
- "jsdoc/require-property-type": "off",
1313
- "jsdoc/require-returns-type": "off",
1314
- "jsdoc/no-types": "error"
1315
- };
1316
- var jsdoc = (options = {}) => [
1317
- {
1318
- name: "ntnyq/jsdoc",
1319
- plugins: {
1320
- jsdoc: import_eslint_plugin_jsdoc.default
1321
- },
1322
- rules: {
1323
- // Disabled rules
1324
- "jsdoc/tag-lines": "off",
1325
- // Use `jsdoc/sort-tags`
1326
- "jsdoc/text-escaping": "off",
1327
- // No need
1328
- // Fixable rules
1329
- "jsdoc/empty-tags": "error",
1330
- "jsdoc/no-defaults": "error",
1331
- "jsdoc/check-types": "error",
1332
- "jsdoc/no-blank-blocks": "error",
1333
- "jsdoc/check-alignment": "error",
1334
- "jsdoc/multiline-blocks": "error",
1335
- "jsdoc/check-param-names": "error",
1336
- "jsdoc/no-multi-asterisks": "error",
1337
- "jsdoc/check-line-alignment": "error",
1338
- "jsdoc/check-property-names": "error",
1339
- "jsdoc/require-asterisk-prefix": "error",
1340
- "jsdoc/no-blank-block-descriptions": "error",
1341
- "jsdoc/require-hyphen-before-param-description": "error",
1342
- "jsdoc/no-bad-blocks": [
1343
- "error",
1344
- {
1345
- ignore: [
1346
- // built-in default
1347
- "ts-check",
1348
- "ts-expect-error",
1349
- "ts-ignore",
1350
- "ts-nocheck",
1351
- // useful
1352
- "vite-ignore"
1353
- ]
1354
- }
1355
- ],
1356
- "jsdoc/check-tag-names": [
1357
- "error",
1358
- {
1359
- definedTags: [
1360
- // magic-comments
1361
- "vite-ignore",
1362
- "unocss-include",
1363
- // eslint-plugin-command (block comment only)
1364
- "regex101",
1365
- // non-standard, but common used
1366
- "compatibility",
1367
- "category",
1368
- "experimental",
1369
- "internal"
1370
- ]
1371
- }
1372
- ],
1373
- // TODO: this after investigate
1374
- // 'jsdoc/sort-tags': [
1375
- // 'error',
1376
- // {
1377
- // tagSequence: [
1378
- // {
1379
- // // Module/file-level
1380
- // tags: ['module', 'exports', 'file', 'fileoverview', 'overview', 'import'],
1381
- // },
1382
- // {
1383
- // // Identifying (name, type)
1384
- // tags: [
1385
- // 'typedef',
1386
- // 'interface',
1387
- // 'record',
1388
- // 'template',
1389
- // 'name',
1390
- // 'kind',
1391
- // 'type',
1392
- // 'alias',
1393
- // 'external',
1394
- // 'host',
1395
- // 'callback',
1396
- // 'func',
1397
- // 'function',
1398
- // 'method',
1399
- // 'class',
1400
- // 'constructor',
1401
- // ],
1402
- // },
1403
- // {
1404
- // // Relationships
1405
- // tags: [
1406
- // 'modifies',
1407
- // 'mixes',
1408
- // 'mixin',
1409
- // 'mixinClass',
1410
- // 'mixinFunction',
1411
- // 'namespace',
1412
- // 'borrows',
1413
- // 'constructs',
1414
- // 'lends',
1415
- // 'implements',
1416
- // 'requires',
1417
- // ],
1418
- // },
1419
- // {
1420
- // // Long descriptions
1421
- // tags: ['desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license'],
1422
- // },
1423
- // {
1424
- // // Simple annotations
1425
- // tags: [
1426
- // 'const',
1427
- // 'constant',
1428
- // 'final',
1429
- // 'global',
1430
- // 'readonly',
1431
- // 'abstract',
1432
- // 'virtual',
1433
- // 'var',
1434
- // 'member',
1435
- // 'memberof',
1436
- // 'memberof!',
1437
- // 'inner',
1438
- // 'instance',
1439
- // 'inheritdoc',
1440
- // 'inheritDoc',
1441
- // 'override',
1442
- // 'hideconstructor',
1443
- // ],
1444
- // },
1445
- // {
1446
- // // Core function/object inf
1447
- // tags: ['param', 'arg', 'argument', 'prop', 'property', 'return', 'returns'],
1448
- // },
1449
- // {
1450
- // // Important behavior details
1451
- // tags: [
1452
- // 'async',
1453
- // 'generator',
1454
- // 'default',
1455
- // 'defaultvalue',
1456
- // 'enum',
1457
- // 'augments',
1458
- // 'extends',
1459
- // 'throws',
1460
- // 'exception',
1461
- // 'yield',
1462
- // 'yields',
1463
- // 'event',
1464
- // 'fires',
1465
- // 'emits',
1466
- // 'listens',
1467
- // 'this',
1468
- // ],
1469
- // },
1470
- // {
1471
- // // Access
1472
- // tags: ['static', 'private', 'protected', 'public', 'access', 'internal', 'package'],
1473
- // },
1474
- // {
1475
- // // Other/unknown
1476
- // tags: ['-other'],
1477
- // },
1478
- // {
1479
- // // Supplementary descriptions
1480
- // tags: ['see', 'example'],
1481
- // },
1482
- // {
1483
- // // Other Closure (undocumented) metadata
1484
- // tags: [
1485
- // 'closurePrimitive',
1486
- // 'customElement',
1487
- // 'expose',
1488
- // 'hidden',
1489
- // 'idGenerator',
1490
- // 'meaning',
1491
- // 'ngInject',
1492
- // 'owner',
1493
- // 'wizaction',
1494
- // ],
1495
- // },
1496
- // {
1497
- // // Other Closure (documented) metadata
1498
- // tags: [
1499
- // 'define',
1500
- // 'dict',
1501
- // 'export',
1502
- // 'externs',
1503
- // 'implicitCast',
1504
- // 'noalias',
1505
- // 'nocollapse',
1506
- // 'nocompile',
1507
- // 'noinline',
1508
- // 'nosideeffects',
1509
- // 'polymer',
1510
- // 'polymerBehavior',
1511
- // 'preserve',
1512
- // 'struct',
1513
- // 'suppress',
1514
- // 'unrestricted',
1515
- // ],
1516
- // },
1517
- // {
1518
- // // Metadata
1519
- // tags: ['category'],
1520
- // },
1521
- // {
1522
- // // Non-Closure metadata
1523
- // tags: [
1524
- // 'ignore',
1525
- // 'author',
1526
- // 'version',
1527
- // 'variation',
1528
- // 'since',
1529
- // 'deprecated',
1530
- // 'compatibility',
1531
- // 'todo',
1532
- // ],
1533
- // },
1534
- // ],
1535
- // alphabetizeExtras: true,
1536
- // linesBetween: 1,
1537
- // },
1538
- // ],
1539
- "jsdoc/check-access": "warn",
1540
- "jsdoc/implements-on-classes": "warn",
1541
- "jsdoc/require-param-name": "warn",
1542
- "jsdoc/require-property": "warn",
1543
- "jsdoc/require-property-name": "warn",
1544
- "jsdoc/require-property-description": "warn",
1545
- "jsdoc/require-returns-check": "warn",
1546
- "jsdoc/require-returns-description": "warn",
1547
- "jsdoc/require-yields-check": "warn",
1548
- // TypeScript rules overrides
1549
- ...options.typescript ? typescriptRules : javscriptRules,
1550
- // Overrides rules
1551
- ...options.overrides
1552
- }
1553
- }
1554
- ];
1555
-
1556
- // src/configs/jsonc.ts
1557
- var jsonc = (options = {}) => [
1558
- {
1559
- name: "ntnyq/jsonc",
1560
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1561
- plugins: {
1562
- jsonc: import_eslint_plugin_jsonc.default
1563
- },
1564
- languageOptions: {
1565
- parser: parserJsonc
1566
- },
1567
- rules: {
1568
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
1569
- "jsonc/no-octal-escape": "error",
1570
- "jsonc/indent": ["error", 2],
1571
- "jsonc/comma-style": ["error", "last"],
1572
- "jsonc/comma-dangle": ["error", "never"],
1573
- "jsonc/object-curly-spacing": ["error", "always"],
1574
- "jsonc/array-bracket-spacing": ["error", "never"],
1575
- "jsonc/key-spacing": [
1576
- "error",
1577
- {
1578
- beforeColon: false,
1579
- afterColon: true
1580
- }
1581
- ],
1582
- "jsonc/object-curly-newline": [
1583
- "error",
1584
- {
1585
- multiline: true,
1586
- consistent: true
1587
- }
1588
- ],
1589
- "jsonc/object-property-newline": [
1590
- "error",
1591
- {
1592
- allowMultiplePropertiesPerLine: true
1593
- }
1594
- ],
1595
- // Overrides rules
1596
- ...options.overrides
1597
- }
1598
- }
1599
- ];
1600
-
1601
- // src/configs/pinia.ts
1602
- var pinia = (options = {}) => {
1603
- const { files = [GLOB_PINIA_STORE] } = options;
1604
- return [
1605
- {
1606
- name: "ntnyq/pinia",
1607
- files,
1608
- plugins: {
1609
- pinia: import_eslint_plugin_pinia.default
1610
- },
1611
- rules: {
1612
- "pinia/prefer-single-store-per-file": "error",
1613
- "pinia/no-duplicate-store-ids": "error",
1614
- "pinia/no-return-global-properties": "error",
1615
- "pinia/no-store-to-refs-in-store": "error",
1616
- "pinia/never-export-initialized-store": "error",
1617
- "pinia/require-setup-store-properties-export": "error",
1618
- "pinia/prefer-use-store-naming-convention": [
1619
- "error",
1620
- {
1621
- checkStoreNameMismatch: true,
1622
- storeSuffix: "Store"
1623
- }
1624
- ],
1625
- // Overrides rules
1626
- ...options.overrides
1627
- }
1628
- }
1629
- ];
1630
- };
1631
-
1632
- // src/configs/ntnyq.ts
1633
- var import_eslint_plugin_ntnyq = require("eslint-plugin-ntnyq");
1634
- var ntnyq = (options = {}) => [
1635
- {
1636
- ...(0, import_eslint_plugin_ntnyq.createConfig)({
1637
- rules: {
1638
- "ntnyq/prefer-newline-after-file-header": "error",
1639
- // Overrides rules
1640
- ...options.overrides
1641
- }
1642
- }),
1643
- name: "ntnyq/ntnyq"
1644
- }
1645
- ];
1646
-
1647
- // src/configs/depend.ts
1648
- var depend = (options = {}) => {
1649
- const {
1650
- files = [GLOB_SRC],
1651
- // check package.json file
1652
- packageJson: enableCheckPackageJson = true
1653
- } = options;
1654
- const configs2 = [
1655
- {
1656
- name: "ntnyq/depend",
1657
- files,
1658
- plugins: {
1659
- depend: pluginDepend
1660
- },
1661
- rules: {
1662
- "depend/ban-dependencies": "error",
1663
- // Overrides rules
1664
- ...options.overrides
1665
- }
1666
- }
1667
- ];
1668
- if (enableCheckPackageJson) {
1669
- configs2.push({
1670
- name: "ntnyq/depend/package-json",
1671
- files: [GLOB_PACKAGE_JSON],
1672
- plugins: {
1673
- depend: pluginDepend
1674
- },
1675
- languageOptions: {
1676
- parser: parserJsonc
1677
- },
1678
- rules: {
1679
- "depend/ban-dependencies": "error",
1680
- // Overrides rules
1681
- ...options.overrides
1682
- }
1683
- });
1684
- }
1685
- return configs2;
1686
- };
1687
-
1688
- // src/configs/regexp.ts
1689
- var regexp = (options = {}) => {
1690
- const recommendedConfig = pluginRegexp.configs["flat/recommended"];
1691
- const recommendedRules2 = {
1692
- ...recommendedConfig.rules
1693
- };
1694
- if (options.severity || options.level === "warn") {
1695
- for (const key in recommendedRules2) {
1696
- if (recommendedRules2[key] === "error") {
1697
- recommendedRules2[key] = "warn";
1698
- }
1699
- }
1700
- }
1701
- return [
1702
- {
1703
- ...recommendedConfig,
1704
- name: "ntnyq/regexp",
1705
- rules: {
1706
- ...recommendedRules2,
1707
- // Overrides rules
1708
- ...options.overrides
1709
- }
1710
- }
1711
- ];
1712
- };
1713
-
1714
- // src/configs/unocss.ts
1715
- var unocss = (options = {}) => [
1716
- {
1717
- name: "ntnyq/unocss",
1718
- plugins: {
1719
- unocss: import_eslint_plugin.default
1720
- },
1721
- rules: {
1722
- "unocss/order": "error",
1723
- "unocss/order-attributify": options.attributify ? "error" : "off",
1724
- // Overrides rules
1725
- ...options.overrides
1726
- }
1727
- }
1728
- ];
1729
-
1730
- // src/constants.ts
1731
- var DEFAULT_PRETTIER_OPTIONS = {
1732
- // Include parentheses around a sole arrow function parameter
1733
- arrowParens: "avoid",
1734
- // Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
1735
- bracketSameLine: false,
1736
- // Print spaces between brackets in object literals.
1737
- bracketSpacing: true,
1738
- // Control whether Prettier formats quoted code embedded in the file
1739
- embeddedLanguageFormatting: "auto",
1740
- // End of line
1741
- endOfLine: "lf",
1742
- // Specify the global whitespace sensitivity for HTML files
1743
- htmlWhitespaceSensitivity: "css",
1744
- // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1745
- insertPragma: false,
1746
- // Use single quotes instead of double quotes in JSX
1747
- jsxSingleQuote: true,
1748
- // Maximum line length
1749
- printWidth: 100,
1750
- // By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
1751
- proseWrap: "preserve",
1752
- // Change when properties in objects are quoted
1753
- quoteProps: "as-needed",
1754
- rangeEnd: Number.POSITIVE_INFINITY,
1755
- // Format only a segment of a file.
1756
- rangeStart: 0,
1757
- // Specify which parser to use.
1758
- // parser: undefined,
1759
- // Specify the file name to use to infer which parser to use.
1760
- // filepath: undefined,
1761
- // Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
1762
- requirePragma: false,
1763
- // Use semicolons or not
1764
- semi: false,
1765
- // Enforce single attribute per line in HTML, Vue and JSX
1766
- singleAttributePerLine: true,
1767
- // Use single quotes instead of double quotes
1768
- singleQuote: true,
1769
- // Specify the number of spaces per indentation-level
1770
- tabWidth: 2,
1771
- // Print trailing commas wherever possible when multi-line
1772
- trailingComma: "all",
1773
- // Indent lines with tabs instead of spaces
1774
- useTabs: false,
1775
- // Whether or not to indent the code inside <script> and <style> tags in Vue files
1776
- vueIndentScriptAndStyle: false
1777
- };
1778
-
1779
- // src/configs/format.ts
1780
- var format = (options = {}) => {
1781
- const {
1782
- css: enableCSS = true,
1783
- html: enableHTML = true,
1784
- // user custom options
1785
- prettierOptions = {}
1786
- } = options;
1787
- const sharedPrettierOptions = {
1788
- ...DEFAULT_PRETTIER_OPTIONS,
1789
- ...prettierOptions
1790
- };
1791
- const configs2 = [
1792
- {
1793
- name: "ntnyq/format/setup",
1794
- plugins: {
1795
- format: import_eslint_plugin_format.default
1796
- }
1797
- }
1798
- ];
1799
- if (enableCSS) {
1800
- configs2.push(
1801
- {
1802
- name: "ntnyq/format/css",
1803
- files: [GLOB_CSS, GLOB_POSTCSS],
1804
- languageOptions: {
1805
- parser: parserPlain
1806
- },
1807
- rules: {
1808
- "format/prettier": [
1809
- "error",
1810
- mergePrettierOptions(sharedPrettierOptions, {
1811
- parser: "css"
1812
- })
1813
- ]
1814
- }
1815
- },
1816
- {
1817
- name: "ntnyq/format/scss",
1818
- files: [GLOB_SCSS],
1819
- languageOptions: {
1820
- parser: parserPlain
1821
- },
1822
- rules: {
1823
- "format/prettier": [
1824
- "error",
1825
- mergePrettierOptions(sharedPrettierOptions, {
1826
- parser: "scss"
1827
- })
1828
- ]
1829
- }
1830
- },
1831
- {
1832
- name: "ntnyq/format/less",
1833
- files: [GLOB_LESS],
1834
- languageOptions: {
1835
- parser: parserPlain
1836
- },
1837
- rules: {
1838
- "format/prettier": [
1839
- "error",
1840
- mergePrettierOptions(sharedPrettierOptions, {
1841
- parser: "less"
1842
- })
1843
- ]
1844
- }
1845
- }
1846
- );
1847
- }
1848
- if (enableHTML) {
1849
- configs2.push({
1850
- name: "ntnyq/format/html",
1851
- files: [GLOB_HTML],
1852
- languageOptions: {
1853
- parser: parserPlain
1854
- },
1855
- rules: {
1856
- "format/prettier": [
1857
- "error",
1858
- mergePrettierOptions(sharedPrettierOptions, {
1859
- parser: "html"
1860
- })
1861
- ]
1862
- }
1863
- });
1864
- }
1865
- return configs2;
1866
- };
1867
-
1868
- // src/configs/command.ts
1869
- var import_commands2 = require("eslint-plugin-command/commands");
1870
- var import_config = __toESM(require("eslint-plugin-command/config"), 1);
1871
-
1872
- // src/commands/regexper.ts
1873
- var import_commands = require("eslint-plugin-command/commands");
1874
- var regexper = (0, import_commands.defineCommand)({
1875
- name: "regexper",
1876
- // @regexper https://regexper.com/#%2F(%5Cb%7C%5Cs%7C%5E)(%40regexper)(%5Cs%5CS%2B)%3F(%5Cb%7C%5Cs%7C%24)%2F
1877
- match: /(\b|\s|^)(@regexper)(\s\S+)?(\b|\s|$)/,
1878
- action(ctx) {
1879
- const literal = ctx.findNodeBelow((node2) => {
1880
- return node2.type === "Literal" && "regex" in node2;
1881
- });
1882
- if (!literal) {
1883
- return ctx.reportError("Unable to find a regexp literal to generate");
1884
- }
1885
- const [
1886
- // non-use
1887
- _fullStr = "",
1888
- spaceBefore = "",
1889
- commandStr = "",
1890
- existingUrl = "",
1891
- // non-use
1892
- _spaceAfter = ""
1893
- ] = ctx.matches;
1894
- const url = `https://regexper.com/#${encodeURIComponent(literal.raw)}`;
1895
- if (existingUrl.trim() === url.trim()) {
1896
- return;
1897
- }
1898
- const indexStart = ctx.comment.range[0] + ctx.matches.index + spaceBefore.length + 2;
1899
- const indexEnd = indexStart + commandStr.length + existingUrl.length;
1900
- ctx.report({
1901
- loc: {
1902
- start: ctx.source.getLocFromIndex(indexStart),
1903
- end: ctx.source.getLocFromIndex(indexEnd)
1904
- },
1905
- removeComment: false,
1906
- message: "Update the regexper link",
1907
- fix(fixer) {
1908
- return fixer.replaceTextRange([indexStart, indexEnd], `@regexper ${url}`);
1909
- }
1910
- });
1911
- }
1912
- });
1913
-
1914
- // src/commands/index.ts
1915
- var commands = [regexper];
1916
-
1917
- // src/configs/command.ts
1918
- var command = (options = {}) => [
1919
- {
1920
- ...(0, import_config.default)({
1921
- ...options,
1922
- commands: [
1923
- // built-in commands
1924
- ...import_commands2.builtinCommands,
1925
- // config internal commands
1926
- ...commands,
1927
- // user custom commands
1928
- ...options.commands || []
1929
- ]
1930
- }),
1931
- name: "ntnyq/command"
1932
- }
1933
- ];
1934
-
1935
- // src/configs/ignores.ts
1936
- var ignores = (customIgnores = []) => [
1937
- {
1938
- name: "ntnyq/ignores",
1939
- ignores: [
1940
- ...GLOB_EXCLUDE,
1941
- // Overrides built-in ignores
1942
- ...customIgnores
1943
- ]
1944
- }
1945
- ];
1946
-
1947
- // src/configs/importX.ts
1948
- var importX = (options = {}) => {
1949
- const {
1950
- typescript: enableTypeScript,
1951
- // use typescript resolve if possible
1952
- preferTypeScriptResolver = true
1953
- } = options;
1954
- return [
1955
- {
1956
- name: "ntnyq/import-x",
1957
- plugins: {
1958
- "import-x": import_eslint_plugin_import_x.default
1959
- },
1960
- settings: {
1961
- "import-x/resolver-next": [
1962
- enableTypeScript && preferTypeScriptResolver ? (0, import_eslint_import_resolver_typescript.createTypeScriptImportResolver)({
1963
- extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".json", ".node"]
1964
- }) : createNodeResolver({
1965
- extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
1966
- })
1967
- ]
1968
- },
1969
- rules: {
1970
- "import-x/no-unresolved": "off",
1971
- "import-x/no-absolute-path": "off",
1972
- "import-x/no-named-as-default-member": "off",
1973
- "import-x/no-named-default": "off",
1974
- // disabled in favor or `perfectionist/sort-imports`
1975
- "import-x/order": "off",
1976
- "import-x/first": "error",
1977
- "import-x/export": "error",
1978
- "import-x/no-self-import": "error",
1979
- "import-x/no-duplicates": "error",
1980
- "import-x/no-mutable-exports": "error",
1981
- "import-x/newline-after-import": "error",
1982
- // Overrides rules
1983
- ...options.overrides
1984
- }
1985
- }
1986
- ];
1987
- };
1988
-
1989
- // src/configs/unicorn.ts
1990
- var disabledRules2 = {
1991
- "unicorn/better-regex": "off",
1992
- "unicorn/explicit-length-check": "off",
1993
- "unicorn/prefer-top-level-await": "off",
1994
- "unicorn/no-array-callback-reference": "off",
1995
- /**
1996
- * @see https://caniuse.com/?search=globalThis
1997
- */
1998
- "unicorn/prefer-global-this": "off"
1999
- };
2000
- var unicorn = (options = {}) => [
2001
- {
2002
- name: "ntnyq/unicorn",
2003
- plugins: {
2004
- unicorn: import_eslint_plugin_unicorn.default
2005
- },
2006
- rules: {
2007
- "unicorn/escape-case": "error",
2008
- "unicorn/no-for-loop": "error",
2009
- "unicorn/no-lonely-if": "error",
2010
- "unicorn/error-message": "error",
2011
- "unicorn/no-new-buffer": "error",
2012
- "unicorn/no-hex-escape": "error",
2013
- "unicorn/throw-new-error": "error",
2014
- "unicorn/prefer-includes": "error",
2015
- "unicorn/new-for-builtins": "error",
2016
- "unicorn/prefer-type-error": "error",
2017
- "unicorn/prefer-math-trunc": "error",
2018
- "unicorn/no-console-spaces": "error",
2019
- "unicorn/no-zero-fractions": "error",
2020
- "unicorn/prefer-regexp-test": "error",
2021
- "unicorn/number-literal-case": "error",
2022
- "unicorn/no-typeof-undefined": "error",
2023
- "unicorn/prefer-math-min-max": "error",
2024
- "unicorn/prefer-node-protocol": "error",
2025
- "unicorn/no-unnecessary-await": "error",
2026
- "unicorn/no-static-only-class": "error",
2027
- "unicorn/prefer-reflect-apply": "error",
2028
- "unicorn/prefer-negative-index": "error",
2029
- "unicorn/prefer-structured-clone": "error",
2030
- "unicorn/custom-error-definition": "error",
2031
- "unicorn/prefer-modern-math-apis": "error",
2032
- "unicorn/prefer-number-properties": "error",
2033
- "unicorn/prefer-prototype-methods": "error",
2034
- "unicorn/prefer-keyboard-event-key": "error",
2035
- "unicorn/prefer-optional-catch-binding": "error",
2036
- "unicorn/consistent-existence-index-check": "error",
2037
- "unicorn/switch-case-braces": ["error", "avoid"],
2038
- "unicorn/catch-error-name": [
2039
- "error",
2040
- {
2041
- name: "err",
2042
- ignore: ["^_."]
2043
- }
2044
- ],
2045
- "unicorn/prefer-date-now": "error",
2046
- // String
2047
- "unicorn/prefer-code-point": "error",
2048
- "unicorn/prefer-string-slice": "error",
2049
- "unicorn/prefer-string-trim-start-end": "error",
2050
- "unicorn/prefer-string-starts-ends-with": "error",
2051
- // DOM
2052
- "unicorn/prefer-query-selector": "error",
2053
- "unicorn/prefer-modern-dom-apis": "error",
2054
- "unicorn/prefer-dom-node-remove": "error",
2055
- "unicorn/prefer-dom-node-append": "error",
2056
- "unicorn/prefer-dom-node-dataset": "error",
2057
- "unicorn/prefer-add-event-listener": "error",
2058
- "unicorn/prefer-dom-node-text-content": "error",
2059
- "unicorn/no-invalid-remove-event-listener": "error",
2060
- // Array
2061
- "unicorn/no-new-array": "error",
2062
- "unicorn/no-array-push-push": "error",
2063
- "unicorn/prefer-array-find": "error",
2064
- "unicorn/prefer-array-some": "error",
2065
- "unicorn/no-instanceof-array": "error",
2066
- "unicorn/prefer-array-flat-map": "error",
2067
- "unicorn/prefer-array-index-of": "error",
2068
- "unicorn/require-array-join-separator": "error",
2069
- "unicorn/no-array-method-this-argument": "error",
2070
- // Set
2071
- "unicorn/prefer-set-has": "error",
2072
- "unicorn/prefer-set-size": "error",
2073
- ...disabledRules2,
2074
- // Overrides rules
2075
- ...options.overrides
2076
- }
2077
- }
2078
- ];
2079
-
2080
- // src/configs/specials.ts
2081
- var import_globals = __toESM(require("globals"), 1);
2082
- var specials = (options = {}) => {
2083
- const {
2084
- // Enable shadcn-vue support
2085
- shadcnVue: enableShadcnVue = hasShadcnVue
2086
- } = options;
2087
- const configs2 = [
2088
- {
2089
- name: "ntnyq/specials/scripts",
2090
- files: [`**/scripts/${GLOB_SRC}`],
2091
- rules: {
2092
- "no-console": "off",
2093
- "@typescript-eslint/explicit-function-return-type": "off",
2094
- // Overrides rules
2095
- ...options.overridesScriptsRules
2096
- }
2097
- },
2098
- {
2099
- name: "ntnyq/specials/cli",
2100
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
2101
- rules: {
2102
- "no-console": "off",
2103
- "@typescript-eslint/explicit-function-return-type": "off",
2104
- // Overrides rules
2105
- ...options.overridesCliRules
2106
- }
2107
- },
2108
- {
2109
- name: "ntnyq/specials/userscript",
2110
- files: [`**/*.user.${GLOB_SRC_EXT}`],
2111
- languageOptions: {
2112
- globals: {
2113
- ...import_globals.default.greasemonkey
2114
- }
2115
- },
2116
- rules: {
2117
- camelcase: [
2118
- "error",
2119
- {
2120
- allow: ["^GM_.+"]
2121
- }
2122
- ],
2123
- // Overrides rules
2124
- ...options.overridesUserScriptsRules
2125
- }
2126
- },
2127
- {
2128
- name: "ntnyq/specials/config-file",
2129
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
2130
- plugins: {
2131
- "import-x": import_eslint_plugin_import_x.default,
2132
- perfectionist: import_eslint_plugin_perfectionist.default
2133
- },
2134
- rules: {
2135
- "no-console": "off",
2136
- "import-x/no-default-export": "off",
2137
- "@typescript-eslint/explicit-function-return-type": "off",
2138
- "perfectionist/sort-objects": [
2139
- "error",
2140
- {
2141
- type: "alphabetical",
2142
- order: "asc",
2143
- partitionByComment: true,
2144
- groups: ["unknown", "method", "multiline"]
2145
- }
2146
- ],
2147
- ...options.overridesConfigFileRules
2148
- }
2149
- }
2150
- ];
2151
- if (enableShadcnVue) {
2152
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
2153
- configs2.push({
2154
- name: "ntnyq/specials/shadcn-vue",
2155
- files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
2156
- rules: {
2157
- "@typescript-eslint/no-unused-vars": "off",
2158
- "@typescript-eslint/consistent-type-imports": "off",
2159
- // Overrides rules
2160
- ...shadcnOptions.overridesRules
2161
- }
2162
- });
2163
- }
2164
- if (options.specialCaseConfigs) {
2165
- configs2.push(...options.specialCaseConfigs);
2166
- }
2167
- return configs2;
2168
- };
2169
-
2170
- // src/configs/comments.ts
2171
- var comments = (options = {}) => [
2172
- {
2173
- name: "ntnyq/eslint-comments",
2174
- plugins: {
2175
- "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
2176
- },
2177
- rules: {
2178
- ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
2179
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
2180
- // Overrides rules
2181
- ...options.overrides
2182
- }
2183
- }
2184
- ];
2185
-
2186
- // src/configs/markdown.ts
2187
- var markdown = (options = {}) => {
2188
- if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
2189
- const {
2190
- /**
2191
- * code block files
2192
- */
2193
- files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`],
2194
- /**
2195
- * other extensions
2196
- */
2197
- extensions = [],
2198
- /**
2199
- * disbale type aware linting
2200
- */
2201
- disableTypeAwareLinting = false
2202
- } = options;
2203
- const configs2 = [
2204
- /**
2205
- * extracting code blocks to be linted individually
2206
- */
2207
- ...import_markdown.default.configs.processor.map((config) => ({
2208
- ...config,
2209
- name: `ntnyq/${config.name}`
2210
- })),
2211
- /**
2212
- * enhance `markdown/recommended/processor`
2213
- */
2214
- {
2215
- name: "ntnyq/markdown/processor",
2216
- files,
2217
- ignores: [GLOB_MARKDOWN_NESTED],
2218
- processor: (0, import_eslint_merge_processors.mergeProcessors)([
2219
- import_markdown.default.processors.markdown,
2220
- // Just pass through processor
2221
- import_eslint_merge_processors2.processorPassThrough
2222
- ])
2223
- },
2224
- {
2225
- name: "ntnyq/markdown/parser",
2226
- files,
2227
- languageOptions: {
2228
- parser: parserPlain
2229
- }
2230
- },
2231
- {
2232
- name: "ntnyq/markdown/disabled/code-blocks",
2233
- files: [
2234
- ...files,
2235
- // Extension block support
2236
- ...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
2237
- ],
2238
- languageOptions: {
2239
- parserOptions: {
2240
- ecmaFeatures: {
2241
- impliedStrict: true
2242
- }
2243
- }
2244
- },
2245
- rules: {
2246
- "no-undef": "off",
2247
- "no-alert": "off",
2248
- "no-console": "off",
2249
- "no-unused-vars": "off",
2250
- "no-unused-expressions": "off",
2251
- "no-restricted-imports": "off",
2252
- "node/prefer-global/buffer": "off",
2253
- "node/prefer-global/process": "off",
2254
- "import-x/no-unresolved": "off",
2255
- "unused-imports/no-unused-imports": "off",
2256
- "unused-imports/no-unused-vars": "off",
2257
- "@typescript-eslint/comma-dangle": "off",
2258
- "@typescript-eslint/no-redeclare": "off",
2259
- "@typescript-eslint/no-namespace": "off",
2260
- "@typescript-eslint/no-unused-vars": "off",
2261
- "@typescript-eslint/no-require-imports": "off",
2262
- "@typescript-eslint/no-extraneous-class": "off",
2263
- "@typescript-eslint/no-use-before-define": "off",
2264
- "@typescript-eslint/no-unused-expressions": "off",
2265
- "@typescript-eslint/consistent-type-imports": "off",
2266
- // Overrides rules
2267
- ...options.overrides
2268
- }
2269
- }
2270
- ];
2271
- if (disableTypeAwareLinting) {
2272
- configs2.push({
2273
- ...import_typescript_eslint3.configs.disableTypeChecked,
2274
- name: "ntnyq/markdown/disable/type-aware",
2275
- files: [GLOB_MARKDOWN_CODE]
2276
- });
2277
- }
2278
- return configs2;
2279
- };
2280
-
2281
- // src/configs/prettier.ts
2282
- var prettier = (options = {}) => {
2283
- const {
2284
- disabledFiles = [GLOB_SVG, GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
2285
- // User defined disabled files
2286
- userDisabledFiles = []
2287
- } = options;
2288
- return [
2289
- {
2290
- name: "ntnyq/prettier",
2291
- plugins: {
2292
- prettier: import_eslint_plugin_prettier.default
2293
- },
2294
- rules: {
2295
- "vue/array-bracket-newline": "off",
2296
- "vue/array-bracket-spacing": "off",
2297
- "vue/array-element-newline": "off",
2298
- "vue/arrow-spacing": "off",
2299
- "vue/block-spacing": "off",
2300
- "vue/block-tag-newline": "off",
2301
- "vue/brace-style": "off",
2302
- "vue/comma-dangle": "off",
2303
- "vue/comma-spacing": "off",
2304
- "vue/comma-style": "off",
2305
- "vue/dot-location": "off",
2306
- "vue/func-call-spacing": "off",
2307
- "vue/html-closing-bracket-newline": "off",
2308
- "vue/html-closing-bracket-spacing": "off",
2309
- "vue/html-end-tags": "off",
2310
- "vue/html-indent": "off",
2311
- "vue/html-quotes": "off",
2312
- "vue/key-spacing": "off",
2313
- "vue/keyword-spacing": "off",
2314
- "vue/max-attributes-per-line": "off",
2315
- "vue/multiline-html-element-content-newline": "off",
2316
- "vue/multiline-ternary": "off",
2317
- "vue/mustache-interpolation-spacing": "off",
2318
- "vue/no-extra-parens": "off",
2319
- "vue/no-multi-spaces": "off",
2320
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
2321
- "vue/object-curly-newline": "off",
2322
- "vue/object-curly-spacing": "off",
2323
- "vue/object-property-newline": "off",
2324
- "vue/operator-linebreak": "off",
2325
- "vue/quote-props": "off",
2326
- "vue/script-indent": "off",
2327
- "vue/singleline-html-element-content-newline": "off",
2328
- "vue/space-in-parens": "off",
2329
- "vue/space-infix-ops": "off",
2330
- "vue/space-unary-ops": "off",
2331
- "vue/template-curly-spacing": "off",
2332
- ...import_eslint_plugin_prettier.default.configs.recommended.rules,
2333
- "prettier/prettier": options.severity || options.level || "warn",
2334
- // Overrides rules
2335
- ...options.overrides
2336
- }
2337
- },
2338
- /**
2339
- * Languages that prettier currently does not support
2340
- */
2341
- {
2342
- name: "ntnyq/prettier/disabled",
2343
- files: [...disabledFiles, ...userDisabledFiles],
2344
- plugins: {
2345
- prettier: import_eslint_plugin_prettier.default
2346
- },
2347
- rules: {
2348
- "prettier/prettier": "off"
2349
- }
2350
- }
2351
- ];
2352
- };
2353
-
2354
- // src/configs/stylistic.ts
2355
- var stylistic = async (options = {}) => {
2356
- await ensurePackages(["@stylistic/eslint-plugin"]);
2357
- const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
2358
- return [
2359
- {
2360
- name: "ntnyq/stylistic",
2361
- plugins: {
2362
- "@stylistic": pluginStylistic
2363
- },
2364
- rules: {
2365
- // Only rules are not conflicted with Prettier
2366
- // Use stylistic config to provide type support
2367
- // Overrides rules
2368
- ...options.overrides
2369
- }
2370
- }
2371
- ];
2372
- };
2373
-
2374
- // src/configs/gitignore.ts
2375
- var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
2376
- var gitignore = (options = {}) => {
2377
- options.strict ??= false;
2378
- return [
2379
- {
2380
- ...(0, import_eslint_config_flat_gitignore.default)(options),
2381
- name: "ntnyq/gitignore"
2382
- }
2383
- ];
2384
- };
2385
-
2386
- // src/configs/javascript.ts
2387
- var import_js = __toESM(require("@eslint/js"), 1);
2388
- var import_globals2 = __toESM(require("globals"), 1);
2389
- var strictRules = {
2390
- complexity: ["error", { max: 30 }],
2391
- "max-params": ["error", { max: 5 }],
2392
- "max-depth": ["error", { max: 5 }],
2393
- "max-nested-callbacks": ["error", { max: 10 }],
2394
- "max-lines": [
2395
- "error",
2396
- {
2397
- max: 1e3,
2398
- skipComments: true,
2399
- skipBlankLines: true
2400
- }
2401
- ],
2402
- "max-lines-per-function": [
2403
- "error",
2404
- {
2405
- max: 200,
2406
- skipComments: true,
2407
- skipBlankLines: true
2408
- }
2409
- ]
2410
- };
2411
- var javascript = (options = {}) => [
2412
- {
2413
- ...import_js.default.configs.recommended,
2414
- name: "ntnyq/js/recommended"
2415
- },
2416
- {
2417
- name: "ntnyq/js/core",
2418
- languageOptions: {
2419
- globals: {
2420
- ...import_globals2.default.browser,
2421
- ...import_globals2.default.es2021,
2422
- ...import_globals2.default.node
2423
- },
2424
- sourceType: "module"
2425
- },
2426
- rules: {
2427
- "require-await": "off",
2428
- "no-return-assign": "off",
2429
- "no-useless-escape": "off",
2430
- "consistent-return": "off",
2431
- // disabled in favor of `perfectionist/sort-named-imports`
2432
- "sort-imports": "off",
2433
- // standard v17.0.0
2434
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
2435
- camelcase: [
2436
- "error",
2437
- {
2438
- allow: ["^UNSAFE_"],
2439
- properties: "never",
2440
- ignoreGlobals: true
2441
- }
2442
- ],
2443
- "constructor-super": "error",
2444
- curly: ["error", "multi-line"],
2445
- "default-case-last": "error",
2446
- "dot-notation": ["error", { allowKeywords: true }],
2447
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
2448
- "no-array-constructor": "error",
2449
- "no-async-promise-executor": "error",
2450
- "no-caller": "error",
2451
- "no-class-assign": "error",
2452
- "no-compare-neg-zero": "error",
2453
- "no-cond-assign": "error",
2454
- "no-const-assign": "error",
2455
- "no-constant-condition": ["error", { checkLoops: false }],
2456
- "no-control-regex": "error",
2457
- "no-debugger": "error",
2458
- "no-delete-var": "error",
2459
- "no-dupe-args": "error",
2460
- "no-dupe-class-members": "error",
2461
- "no-dupe-keys": "error",
2462
- "no-duplicate-case": "error",
2463
- "no-useless-backreference": "error",
2464
- "no-empty": ["error", { allowEmptyCatch: true }],
2465
- "no-empty-character-class": "error",
2466
- "no-empty-pattern": "error",
2467
- "no-eval": "error",
2468
- "no-ex-assign": "error",
2469
- "no-extend-native": "error",
2470
- "no-extra-bind": "error",
2471
- "no-extra-boolean-cast": "error",
2472
- "no-fallthrough": "error",
2473
- "no-func-assign": "error",
2474
- "no-global-assign": "error",
2475
- "no-implied-eval": "error",
2476
- "no-import-assign": "error",
2477
- "no-invalid-regexp": "error",
2478
- "no-irregular-whitespace": "error",
2479
- "no-iterator": "error",
2480
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
2481
- "no-lone-blocks": "error",
2482
- "no-loss-of-precision": "error",
2483
- "no-misleading-character-class": "error",
2484
- "no-prototype-builtins": "error",
2485
- "no-useless-catch": "error",
2486
- "no-new": "error",
2487
- "no-new-func": "error",
2488
- "no-new-wrappers": "error",
2489
- "no-obj-calls": "error",
2490
- "no-octal": "error",
2491
- "no-octal-escape": "error",
2492
- "no-proto": "error",
2493
- "no-redeclare": ["error", { builtinGlobals: false }],
2494
- "no-regex-spaces": "error",
2495
- "no-self-assign": ["error", { props: true }],
2496
- "no-self-compare": "error",
2497
- "no-sequences": "error",
2498
- "no-shadow-restricted-names": "error",
2499
- "no-sparse-arrays": "error",
2500
- "no-template-curly-in-string": "error",
2501
- "no-this-before-super": "error",
2502
- "no-throw-literal": "error",
2503
- "no-undef": "error",
2504
- "no-undef-init": "error",
2505
- "no-unexpected-multiline": "error",
2506
- "no-unmodified-loop-condition": "error",
2507
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
2508
- "no-unreachable": "error",
2509
- "no-unreachable-loop": "error",
2510
- "no-unsafe-finally": "error",
2511
- "no-unsafe-negation": "error",
2512
- "no-unused-expressions": [
2513
- "error",
2514
- {
2515
- allowShortCircuit: true,
2516
- allowTernary: true,
2517
- allowTaggedTemplates: true
2518
- }
2519
- ],
2520
- "no-unused-vars": [
2521
- "error",
2522
- {
2523
- args: "none",
2524
- caughtErrors: "none",
2525
- ignoreRestSiblings: true,
2526
- vars: "all"
2527
- }
2528
- ],
2529
- "no-useless-call": "error",
2530
- "no-useless-computed-key": "error",
2531
- "no-useless-constructor": "error",
2532
- "no-useless-rename": "error",
2533
- "no-useless-return": "error",
2534
- "prefer-promise-reject-errors": "error",
2535
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
2536
- "symbol-description": "error",
2537
- "unicode-bom": ["error", "never"],
2538
- "use-isnan": [
2539
- "error",
2540
- {
2541
- enforceForSwitchCase: true,
2542
- enforceForIndexOf: true
2543
- }
2544
- ],
2545
- "valid-typeof": ["error", { requireStringLiterals: true }],
2546
- yoda: ["error", "never"],
2547
- // es6+
2548
- "no-var": "error",
2549
- "prefer-rest-params": "error",
2550
- "prefer-spread": "error",
2551
- "prefer-template": "error",
2552
- "no-empty-static-block": "error",
2553
- "no-new-native-nonconstructor": "error",
2554
- "prefer-const": [
2555
- "error",
2556
- {
2557
- destructuring: "all",
2558
- ignoreReadBeforeAssign: true
2559
- }
2560
- ],
2561
- "prefer-arrow-callback": [
2562
- "error",
2563
- {
2564
- allowNamedFunctions: false,
2565
- allowUnboundThis: true
2566
- }
2567
- ],
2568
- "object-shorthand": [
2569
- "error",
2570
- "always",
2571
- {
2572
- ignoreConstructors: false,
2573
- avoidQuotes: true
2574
- }
2575
- ],
2576
- // best-practice
2577
- eqeqeq: ["error", "smart"],
2578
- "array-callback-return": "error",
2579
- "block-scoped-var": "error",
2580
- "no-alert": "error",
2581
- "no-case-declarations": "error",
2582
- "no-multi-str": "error",
2583
- "no-with": "error",
2584
- "no-void": "error",
2585
- "vars-on-top": "error",
2586
- "one-var": ["error", "never"],
2587
- "no-use-before-define": [
2588
- "error",
2589
- {
2590
- functions: false,
2591
- classes: false,
2592
- variables: true,
2593
- allowNamedExports: false
2594
- }
2595
- ],
2596
- // Strict rules
2597
- ...options.strict ? strictRules : {},
2598
- // Overrides rules
2599
- ...options.overrides
2600
- }
2601
- }
2602
- ];
2603
- var jsx = () => [
2604
- {
2605
- name: "ntnyq/jsx",
2606
- files: ["**/*.jsx"],
2607
- languageOptions: {
2608
- parserOptions: {
2609
- ecmaFeatures: {
2610
- jsx: true
2611
- }
2612
- }
2613
- }
2614
- }
2615
- ];
2616
-
2617
- // src/configs/typescript.ts
2618
- var import_node_process4 = __toESM(require("process"), 1);
2619
- var typeAwareRules = {
2620
- "dot-notation": "off",
2621
- "require-await": "off",
2622
- "no-implied-eval": "off",
2623
- "no-throw-literal": "off",
2624
- // too strict
2625
- "@typescript-eslint/strict-boolean-expressions": "off",
2626
- "@typescript-eslint/require-await": "error",
2627
- "@typescript-eslint/unbound-method": "error",
2628
- "@typescript-eslint/no-unsafe-call": "error",
2629
- "@typescript-eslint/await-thenable": "error",
2630
- "@typescript-eslint/no-for-in-array": "error",
2631
- "@typescript-eslint/no-implied-eval": "error",
2632
- "@typescript-eslint/only-throw-error": "error",
2633
- "@typescript-eslint/no-unsafe-return": "error",
2634
- "@typescript-eslint/no-misused-spread": "error",
2635
- "@typescript-eslint/no-unsafe-argument": "error",
2636
- "@typescript-eslint/no-misused-promises": "error",
2637
- "@typescript-eslint/no-unsafe-assignment": "error",
2638
- "@typescript-eslint/no-floating-promises": "error",
2639
- "@typescript-eslint/promise-function-async": "error",
2640
- "@typescript-eslint/restrict-plus-operands": "error",
2641
- "@typescript-eslint/triple-slash-reference": "error",
2642
- "@typescript-eslint/no-unsafe-member-access": "error",
2643
- "@typescript-eslint/switch-exhaustiveness-check": "error",
2644
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
2645
- "@typescript-eslint/restrict-template-expressions": "error",
2646
- "@typescript-eslint/no-redundant-type-constituents": "error",
2647
- "@typescript-eslint/no-duplicate-type-constituents": "error",
2648
- "@typescript-eslint/return-await": ["error", "in-try-catch"],
2649
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }]
2650
- };
2651
- var recommendedRules = import_typescript_eslint3.configs.recommended.reduce((rules, config) => {
2652
- return { ...rules, ...config.rules || {} };
2653
- }, {});
2654
- var typescript = (options = {}) => {
2655
- const enableTypeAwareLint = !!options?.tsconfigPath;
2656
- const {
2657
- extensions = [],
2658
- filesTypeAware = [GLOB_TS, GLOB_TSX],
2659
- ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
2660
- overridesTypeAwareRules = {},
2661
- parserOptions = {}
2662
- } = options;
2663
- const files = options.files ?? [
2664
- GLOB_TS,
2665
- GLOB_TSX,
2666
- // Enable typescript in these exts
2667
- ...extensions.map((ext) => `**/*.${ext}`)
2668
- ];
2669
- function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
2670
- const typescriptParserOptions = {
2671
- extraFileExtensions: extensions.map((ext) => `.${ext}`),
2672
- sourceType: "module",
2673
- ...enableTypeAware ? {
2674
- projectService: {
2675
- allowDefaultProject: ["./*.js"],
2676
- defaultProject: options.tsconfigPath
2677
- },
2678
- tsconfigRootDir: import_node_process4.default.cwd()
2679
- } : {},
2680
- ...parserOptions
2681
- };
2682
- const parserConfig = {
2683
- name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2684
- files: files2,
2685
- ignores: [...ignores2],
2686
- languageOptions: {
2687
- parser: parserTypeScript,
2688
- parserOptions: typescriptParserOptions
2689
- }
2690
- };
2691
- return parserConfig;
2692
- }
2693
- return [
2694
- {
2695
- name: "ntnyq/ts/setup",
2696
- plugins: {
2697
- "@typescript-eslint": import_typescript_eslint2.plugin,
2698
- antfu: import_eslint_plugin_antfu.default
2699
- }
2700
- },
2701
- ...enableTypeAwareLint ? [
2702
- createParserConfig(false, files),
2703
- createParserConfig(true, filesTypeAware, ignoresTypeAware)
2704
- ] : [createParserConfig(false, files)],
2705
- {
2706
- name: "ntnyq/ts/rules",
2707
- files,
2708
- rules: {
2709
- ...recommendedRules,
2710
- "@typescript-eslint/no-namespace": "off",
2711
- "@typescript-eslint/no-explicit-any": "off",
2712
- "@typescript-eslint/naming-convention": "off",
2713
- "@typescript-eslint/no-empty-function": "off",
2714
- "@typescript-eslint/no-non-null-assertion": "off",
2715
- "@typescript-eslint/triple-slash-reference": "off",
2716
- "@typescript-eslint/explicit-member-accessibility": "off",
2717
- "@typescript-eslint/explicit-function-return-type": "off",
2718
- "@typescript-eslint/explicit-module-boundary-types": "off",
2719
- "@typescript-eslint/consistent-indexed-object-style": "off",
2720
- "@typescript-eslint/prefer-as-const": "warn",
2721
- // Disabled in favor of enhanced ts rules
2722
- "no-redeclare": "off",
2723
- "no-unused-vars": "off",
2724
- "default-param-last": "off",
2725
- "no-use-before-define": "off",
2726
- "no-useless-constructor": "off",
2727
- "@typescript-eslint/default-param-last": "error",
2728
- "@typescript-eslint/no-useless-constructor": "error",
2729
- "@typescript-eslint/no-redeclare": [
2730
- "error",
2731
- {
2732
- builtinGlobals: false,
2733
- ignoreDeclarationMerge: true
2734
- }
2735
- ],
2736
- "@typescript-eslint/no-use-before-define": [
2737
- "error",
2738
- {
2739
- functions: false,
2740
- classes: false,
2741
- variables: true,
2742
- allowNamedExports: false,
2743
- enums: true,
2744
- typedefs: false,
2745
- ignoreTypeReferences: false
2746
- }
2747
- ],
2748
- "@typescript-eslint/no-unused-vars": [
2749
- "error",
2750
- {
2751
- // Args after the last used will be reported
2752
- args: "after-used",
2753
- argsIgnorePattern: "^_",
2754
- caughtErrors: "all",
2755
- caughtErrorsIgnorePattern: "^_",
2756
- destructuredArrayIgnorePattern: "^_",
2757
- varsIgnorePattern: "^_",
2758
- ignoreRestSiblings: true
2759
- }
2760
- ],
2761
- // Extra rules
2762
- "@typescript-eslint/ban-tslint-comment": "error",
2763
- "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
2764
- "@typescript-eslint/ban-ts-comment": [
2765
- "error",
2766
- {
2767
- minimumDescriptionLength: 1,
2768
- "ts-check": false,
2769
- "ts-expect-error": "allow-with-description",
2770
- "ts-ignore": "allow-with-description",
2771
- "ts-nocheck": "allow-with-description"
2772
- }
2773
- ],
2774
- "@typescript-eslint/no-unused-expressions": [
2775
- "error",
2776
- {
2777
- allowShortCircuit: true,
2778
- allowTernary: true,
2779
- allowTaggedTemplates: true
2780
- }
2781
- ],
2782
- "@typescript-eslint/consistent-type-imports": [
2783
- "error",
2784
- {
2785
- prefer: "type-imports",
2786
- fixStyle: "separate-type-imports",
2787
- disallowTypeAnnotations: false
2788
- }
2789
- ],
2790
- "@typescript-eslint/no-empty-object-type": [
2791
- "error",
2792
- {
2793
- allowInterfaces: "always",
2794
- allowObjectTypes: "always"
2795
- }
2796
- ],
2797
- "@typescript-eslint/consistent-type-assertions": [
2798
- "error",
2799
- {
2800
- assertionStyle: "as",
2801
- objectLiteralTypeAssertions: "allow-as-parameter"
2802
- }
2803
- ],
2804
- // Overrides rules
2805
- ...options.overrides
2806
- }
2807
- },
2808
- ...enableTypeAwareLint ? [
2809
- {
2810
- name: "ntnyq/ts/rules/type-aware",
2811
- files: [...filesTypeAware],
2812
- ignores: [...ignoresTypeAware],
2813
- rules: {
2814
- ...typeAwareRules,
2815
- // Overrides type aware rules
2816
- ...overridesTypeAwareRules
2817
- }
2818
- }
2819
- ] : [],
2820
- {
2821
- name: "ntnyq/ts/types",
2822
- files: [...GLOB_TYPES],
2823
- rules: {
2824
- "no-use-before-define": "off",
2825
- "no-restricted-syntax": "off",
2826
- "import-x/no-duplicates": "off",
2827
- "import-x/newline-after-import": "off",
2828
- "@typescript-eslint/no-use-before-define": "off"
2829
- }
2830
- }
2831
- ];
2832
- };
2833
-
2834
- // src/configs/eslintPlugin.ts
2835
- var eslintPlugin = async (options = {}) => {
2836
- await ensurePackages(["eslint-plugin-eslint-plugin"]);
2837
- const pluginESLintPlugin = await interopDefault(import("eslint-plugin-eslint-plugin"));
2838
- return [
2839
- {
2840
- ...pluginESLintPlugin.configs["flat/all"],
2841
- name: "ntnyq/eslint-plugin",
2842
- rules: {
2843
- ...pluginESLintPlugin.configs["flat/all"].rules,
2844
- // injected by `createRule`
2845
- "eslint-plugin/require-meta-docs-url": "off",
2846
- // Overrides rules
2847
- ...options.overrides
2848
- }
2849
- }
2850
- ];
2851
- };
2852
-
2853
- // src/configs/githubAction.ts
2854
- var import_eslint_plugin_github_action2 = require("eslint-plugin-github-action");
2855
- var githubAction = (options = {}) => {
2856
- const {
2857
- // Support common overrides rules
2858
- overrides: overridesRules = {},
2859
- // Config options
2860
- ...restOptions
2861
- } = options;
2862
- return [
2863
- (0, import_eslint_plugin_github_action2.createConfig)({
2864
- name: "ntnyq/github-action",
2865
- files: [GLOB_GITHUB_ACTION],
2866
- rules: {
2867
- "github-action/no-invalid-key": "error",
2868
- "github-action/prefer-file-extension": "error",
2869
- "github-action/require-action-name": "error",
2870
- ...overridesRules
2871
- },
2872
- ...restOptions
2873
- })
2874
- ];
2875
- };
2876
-
2877
- // src/configs/perfectionist.ts
2878
- var sharedGroupsForInterfaceOrObjectTypes = [
2879
- "required-property",
2880
- "optional-property",
2881
- "required-method",
2882
- "optional-method",
2883
- "required-multiline-property",
2884
- "optional-multiline-property",
2885
- "required-multiline-method",
2886
- "optional-multiline-method",
2887
- "unknown",
2888
- "index-signature",
2889
- "multiline-index-signature"
2890
- ];
2891
- var sharedGroupsForIntersectionOrUnion = [
2892
- /**
2893
- * eg. 'foobar', 24, false
2894
- */
2895
- "literal",
2896
- /**
2897
- * eg. number, string
2898
- */
2899
- "keyword",
2900
- /**
2901
- * eg. FooBar
2902
- */
2903
- "named",
2904
- /**
2905
- * eg. Foo & Bar
2906
- */
2907
- "intersection",
2908
- /**
2909
- * eg. Foobar extends string ? Foo : Bar
2910
- */
2911
- "conditional",
2912
- /**
2913
- * eg. (...args: any[]) => void
2914
- */
2915
- "function",
2916
- /**
2917
- * eg. import('eslint').Linter
2918
- */
2919
- "import",
2920
- /**
2921
- * eg. { foo: string; bar: number; }
2922
- */
2923
- "object",
2924
- /**
2925
- * eg. keyof T
2926
- */
2927
- "operator",
2928
- /**
2929
- * eg. [string, number]
2930
- */
2931
- "tuple",
2932
- /**
2933
- * eg. Foo | Bar
2934
- */
2935
- "union",
2936
- /**
2937
- * eg. null | undefined
2938
- */
2939
- "nullish"
2940
- ];
2941
- var defaultSortInterfacesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
2942
- var defaultSortObjectTypesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
2943
- var defaultSortIntersectionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
2944
- var defaultSortUnionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
2945
- var perfectionist = (options = {}) => {
2946
- const {
2947
- sortEnums: enableSortEnums = true,
2948
- sortTypes: enableSortTypes = true,
2949
- sortConstants: enableSortConstants = true
2950
- } = options;
2951
- const configs2 = [
2952
- {
2953
- name: "ntnyq/perfectionist/common",
2954
- plugins: {
2955
- perfectionist: import_eslint_plugin_perfectionist.default
2956
- },
2957
- rules: {
2958
- "perfectionist/sort-imports": [
2959
- "error",
2960
- {
2961
- groups: [
2962
- // Side effect style imports (e.g. 'normalize.css')
2963
- "side-effect-style",
2964
- // Styles (e.g. *.{css,scss,less})
2965
- "style",
2966
- // Node.js built-in modules. (e.g. fs, path)
2967
- "builtin",
2968
- // External modules installed in the project (e.g. vue, lodash)
2969
- "external",
2970
- // Internal modules (e.g. @/utils, @/components)
2971
- "internal",
2972
- // Modules from parent directory (e.g. ../utils)
2973
- "parent",
2974
- // Modules from the same directory (e.g. ./utils)
2975
- "sibling",
2976
- // Main file from the current directory (e.g. ./index)
2977
- "index",
2978
- // TypeScript object-imports (e.g. import log = console.log)
2979
- "object",
2980
- // Side effect imports (e.g. import 'babel-polyfill')
2981
- "side-effect",
2982
- /**
2983
- * Type import at the end
2984
- */
2985
- "builtin-type",
2986
- "external-type",
2987
- "internal-type",
2988
- "parent-type",
2989
- "sibling-type",
2990
- "index-type",
2991
- "type",
2992
- /**
2993
- * Imports that don’t fit into any other group
2994
- */
2995
- "unknown"
2996
- ],
2997
- order: "asc",
2998
- type: "natural",
2999
- ignoreCase: true,
3000
- internalPattern: ["^~/.+", "^@/.+", "^#.+"],
3001
- newlinesBetween: "ignore",
3002
- partitionByComment: true
3003
- }
3004
- ],
3005
- "perfectionist/sort-exports": [
3006
- "error",
3007
- {
3008
- order: "asc",
3009
- type: "line-length",
3010
- groupKind: "values-first",
3011
- partitionByComment: true
3012
- }
3013
- ],
3014
- "perfectionist/sort-named-exports": [
3015
- "error",
3016
- {
3017
- type: "alphabetical",
3018
- order: "asc",
3019
- ignoreCase: true,
3020
- groupKind: "values-first",
3021
- partitionByComment: true
3022
- }
3023
- ],
3024
- "perfectionist/sort-named-imports": [
3025
- "error",
3026
- {
3027
- type: "alphabetical",
3028
- order: "asc",
3029
- ignoreCase: true,
3030
- ignoreAlias: false,
3031
- groupKind: "values-first",
3032
- partitionByComment: true
3033
- }
3034
- ],
3035
- // Overrides rules
3036
- ...options.overrides
3037
- }
3038
- }
3039
- ];
3040
- if (enableSortEnums) {
3041
- configs2.push({
3042
- name: "ntnyq/perfectionist/enums",
3043
- files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
3044
- plugins: {
3045
- perfectionist: import_eslint_plugin_perfectionist.default
3046
- },
3047
- rules: {
3048
- "perfectionist/sort-enums": [
3049
- "error",
3050
- {
3051
- type: "alphabetical",
3052
- order: "asc",
3053
- partitionByComment: true
3054
- }
3055
- ],
3056
- "perfectionist/sort-modules": [
3057
- "error",
3058
- {
3059
- type: "alphabetical",
3060
- order: "asc",
3061
- partitionByComment: true
3062
- }
3063
- ],
3064
- // Overrides rules
3065
- ...options.overridesEnumsRules
3066
- }
3067
- });
3068
- }
3069
- if (enableSortTypes) {
3070
- configs2.push({
3071
- name: "ntnyq/perfectionist/types",
3072
- files: [...GLOB_TYPES],
3073
- plugins: {
3074
- perfectionist: import_eslint_plugin_perfectionist.default
3075
- },
3076
- rules: {
3077
- "perfectionist/sort-heritage-clauses": [
3078
- "error",
3079
- {
3080
- type: "alphabetical",
3081
- order: "asc"
3082
- }
3083
- ],
3084
- "perfectionist/sort-interfaces": [
3085
- "error",
3086
- {
3087
- type: "alphabetical",
3088
- order: "asc",
3089
- partitionByComment: true,
3090
- groups: defaultSortInterfacesGroups
3091
- }
3092
- ],
3093
- "perfectionist/sort-intersection-types": [
3094
- "error",
3095
- {
3096
- type: "alphabetical",
3097
- order: "asc",
3098
- partitionByComment: true,
3099
- groups: defaultSortIntersectionTypesGroups
3100
- }
3101
- ],
3102
- "perfectionist/sort-modules": [
3103
- "error",
3104
- {
3105
- type: "alphabetical",
3106
- order: "asc",
3107
- partitionByComment: true
3108
- }
3109
- ],
3110
- "perfectionist/sort-object-types": [
3111
- "error",
3112
- {
3113
- type: "alphabetical",
3114
- order: "asc",
3115
- partitionByComment: true,
3116
- groups: defaultSortObjectTypesGroups
3117
- }
3118
- ],
3119
- "perfectionist/sort-union-types": [
3120
- "error",
3121
- {
3122
- type: "alphabetical",
3123
- order: "asc",
3124
- partitionByComment: true,
3125
- groups: defaultSortUnionTypesGroups
3126
- }
3127
- ],
3128
- // Overrides rules
3129
- ...options.overridesTypesRules
3130
- }
3131
- });
3132
- }
3133
- if (enableSortConstants) {
3134
- configs2.push({
3135
- name: "ntnyq/perfectionist/constants",
3136
- files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
3137
- plugins: {
3138
- perfectionist: import_eslint_plugin_perfectionist.default
3139
- },
3140
- rules: {
3141
- "perfectionist/sort-maps": [
3142
- "error",
3143
- {
3144
- type: "alphabetical",
3145
- order: "asc",
3146
- partitionByComment: true
3147
- }
3148
- ],
3149
- "perfectionist/sort-objects": [
3150
- "error",
3151
- {
3152
- type: "alphabetical",
3153
- order: "asc",
3154
- partitionByComment: true,
3155
- groups: ["unknown", "method", "multiline"]
3156
- }
3157
- ],
3158
- "perfectionist/sort-sets": [
3159
- "error",
3160
- {
3161
- type: "alphabetical",
3162
- order: "asc",
3163
- partitionByComment: true
3164
- }
3165
- ],
3166
- "perfectionist/sort-modules": [
3167
- "error",
3168
- {
3169
- type: "alphabetical",
3170
- order: "asc",
3171
- partitionByComment: true
3172
- }
3173
- ],
3174
- // Overrides rules
3175
- ...options.overridesConstantsRules
3176
- }
3177
- });
3178
- }
3179
- return configs2;
3180
- };
3181
-
3182
- // src/configs/unusedImports.ts
3183
- var unusedImports = (options = {}) => [
3184
- {
3185
- name: "ntnyq/unused-imports",
3186
- plugins: {
3187
- "unused-imports": import_eslint_plugin_unused_imports.default
3188
- },
3189
- rules: {
3190
- "@typescript-eslint/no-unused-vars": "off",
3191
- "unused-imports/no-unused-imports": "error",
3192
- "unused-imports/no-unused-vars": [
3193
- "error",
3194
- {
3195
- vars: "all",
3196
- varsIgnorePattern: "^_",
3197
- args: "after-used",
3198
- argsIgnorePattern: "^_",
3199
- ignoreRestSiblings: true,
3200
- destructuredArrayIgnorePattern: "^_",
3201
- caughtErrors: "all",
3202
- caughtErrorsIgnorePattern: "^_"
3203
- }
3204
- ],
3205
- // Overrides rules
3206
- ...options.overrides
3207
- }
3208
- }
3209
- ];
3210
-
3211
- // src/core.ts
3212
- function defineESLintConfig(options = {}, ...userConfigs) {
3213
- const {
3214
- /**
3215
- * Shared options
3216
- */
3217
- extensions: supportedExtensions = [],
3218
- /**
3219
- * Conditional by deps
3220
- */
3221
- vue: enableVue = hasVue,
3222
- pinia: enablePinia = hasPinia,
3223
- test: enableTest = hasVitest,
3224
- unocss: enableUnoCSS = hasUnoCSS,
3225
- typescript: enableTypeScript = hasTypeScript,
3226
- /**
3227
- * Enabled by default
3228
- */
3229
- yml: enableYML = true,
3230
- sort: enableSort = true,
3231
- toml: enableTOML = true,
3232
- jsonc: enableJSONC = true,
3233
- antfu: enableAntfu = true,
3234
- ntnyq: enableNtnyq = true,
3235
- depend: enableDepend = true,
3236
- regexp: enableRegexp = true,
3237
- unicorn: enableUnicorn = true,
3238
- prettier: enablePrettier = true,
3239
- markdown: enableMarkdown = true,
3240
- gitignore: enableGitIgnore = true,
3241
- githubAction: enableGitHubAction = true,
3242
- perfectionist: enablePerfectionist = true,
3243
- // disabled by default
3244
- svgo: enableSVGO = false,
3245
- stylistic: enableStylistic = false,
3246
- eslintPlugin: enableESLintPlugin = false
3247
- } = options;
3248
- const configs2 = [];
3249
- if (enableVue) {
3250
- supportedExtensions.push("vue");
3251
- }
3252
- if (enableGitIgnore) {
3253
- configs2.push(gitignore(resolveSubOptions(options, "gitignore")));
3254
- }
3255
- configs2.push(
3256
- ignores(options.ignores),
3257
- jsx(),
3258
- node({
3259
- overrides: getOverrides(options, "node")
3260
- }),
3261
- command(resolveSubOptions(options, "command")),
3262
- importX({
3263
- ...resolveSubOptions(options, "importX"),
3264
- typescript: !!enableTypeScript,
3265
- overrides: getOverrides(options, "importX")
3266
- }),
3267
- jsdoc({
3268
- typescript: !!enableTypeScript,
3269
- overrides: getOverrides(options, "jsdoc"),
3270
- ...resolveSubOptions(options, "jsdoc")
3271
- }),
3272
- comments({
3273
- overrides: getOverrides(options, "comments")
3274
- }),
3275
- javascript({
3276
- ...resolveSubOptions(options, "javascript"),
3277
- overrides: getOverrides(options, "javascript")
3278
- })
3279
- );
3280
- if (enablePerfectionist) {
3281
- configs2.push(
3282
- perfectionist({
3283
- ...resolveSubOptions(options, "perfectionist"),
3284
- overrides: getOverrides(options, "perfectionist")
3285
- })
3286
- );
3287
- }
3288
- if (enableUnicorn) {
3289
- configs2.push(
3290
- unicorn({
3291
- overrides: getOverrides(options, "unicorn")
3292
- })
3293
- );
3294
- }
3295
- if (enablePinia) {
3296
- configs2.push(
3297
- pinia({
3298
- ...resolveSubOptions(options, "pinia"),
3299
- overrides: getOverrides(options, "pinia")
3300
- })
3301
- );
3302
- }
3303
- if (enableRegexp) {
3304
- configs2.push(
3305
- regexp({
3306
- ...resolveSubOptions(options, "regexp"),
3307
- overrides: getOverrides(options, "regexp")
3308
- })
3309
- );
3310
- }
3311
- if (enableTypeScript) {
3312
- configs2.push(
3313
- typescript({
3314
- ...resolveSubOptions(options, "typescript"),
3315
- extensions: supportedExtensions,
3316
- overrides: getOverrides(options, "typescript")
3317
- })
3318
- );
3319
- }
3320
- if (enableVue) {
3321
- configs2.push(
3322
- vue({
3323
- ...resolveSubOptions(options, "vue"),
3324
- typescript: !!enableTypeScript,
3325
- overrides: getOverrides(options, "vue")
3326
- })
3327
- );
3328
- }
3329
- if (enableYML) {
3330
- configs2.push(
3331
- yml({
3332
- overrides: getOverrides(options, "yml")
3333
- })
3334
- );
3335
- }
3336
- if (enableTOML) {
3337
- configs2.push(
3338
- toml({
3339
- overrides: getOverrides(options, "toml")
3340
- })
3341
- );
3342
- }
3343
- if (enableJSONC) {
3344
- configs2.push(
3345
- jsonc({
3346
- overrides: getOverrides(options, "jsonc")
3347
- })
3348
- );
3349
- }
3350
- if (enableSort) {
3351
- configs2.push(sort(resolveSubOptions(options, "sort")));
3352
- }
3353
- if (enableTest) {
3354
- configs2.push(
3355
- test({
3356
- overrides: getOverrides(options, "test")
3357
- }),
3358
- vitest({
3359
- overrides: getOverrides(options, "test")
3360
- })
3361
- );
3362
- }
3363
- if (enableUnoCSS) {
3364
- configs2.push(
3365
- unocss({
3366
- overrides: getOverrides(options, "unocss")
3367
- })
3368
- );
3369
- }
3370
- if (enableMarkdown) {
3371
- configs2.push(
3372
- markdown({
3373
- extensions: supportedExtensions,
3374
- overrides: getOverrides(options, "markdown")
3375
- })
3376
- );
3377
- }
3378
- if (enableAntfu) {
3379
- configs2.push(
3380
- antfu({
3381
- overrides: getOverrides(options, "antfu")
3382
- })
3383
- );
3384
- }
3385
- if (enableDepend) {
3386
- configs2.push(
3387
- depend({
3388
- ...resolveSubOptions(options, "depend"),
3389
- overrides: getOverrides(options, "depend")
3390
- })
3391
- );
3392
- }
3393
- if (enableNtnyq) {
3394
- configs2.push(
3395
- ntnyq({
3396
- overrides: getOverrides(options, "ntnyq")
3397
- })
3398
- );
3399
- }
3400
- if (enableGitHubAction) {
3401
- configs2.push(
3402
- githubAction({
3403
- overrides: getOverrides(options, "githubAction")
3404
- })
3405
- );
3406
- }
3407
- if (enableESLintPlugin) {
3408
- configs2.push(
3409
- eslintPlugin({
3410
- overrides: getOverrides(options, "eslintPlugin")
3411
- })
3412
- );
3413
- }
3414
- if (enableStylistic) {
3415
- configs2.push(
3416
- stylistic({
3417
- overrides: getOverrides(options, "stylistic")
3418
- })
3419
- );
3420
- }
3421
- if (enableSVGO) {
3422
- configs2.push(svgo(resolveSubOptions(options, "svgo")));
3423
- }
3424
- const configSpecials = specials(resolveSubOptions(options, "specials"));
3425
- const configPrettier = enablePrettier ? prettier({
3426
- ...resolveSubOptions(options, "prettier"),
3427
- overrides: getOverrides(options, "prettier")
3428
- }) : [];
3429
- const composer = new import_eslint_flat_config_utils.FlatConfigComposer(
3430
- ...configs2,
3431
- ...userConfigs,
3432
- ...configSpecials,
3433
- ...configPrettier
3434
- );
3435
- return composer;
3436
- }
3437
- // Annotate the CommonJS export names for ESM import in node:
3438
- 0 && (module.exports = {
3439
- DEFAULT_PRETTIER_OPTIONS,
3440
- GLOB_ALL_SRC,
3441
- GLOB_ASTRO,
3442
- GLOB_ASTRO_TS,
3443
- GLOB_CSS,
3444
- GLOB_DIST,
3445
- GLOB_DTS,
3446
- GLOB_EXCLUDE,
3447
- GLOB_GITHUB_ACTION,
3448
- GLOB_HTML,
3449
- GLOB_JS,
3450
- GLOB_JSON,
3451
- GLOB_JSON5,
3452
- GLOB_JSONC,
3453
- GLOB_JSX,
3454
- GLOB_LESS,
3455
- GLOB_LOCKFILE,
3456
- GLOB_MARKDOWN,
3457
- GLOB_MARKDOWN_CODE,
3458
- GLOB_MARKDOWN_NESTED,
3459
- GLOB_NODE_MODULES,
3460
- GLOB_PACKAGE_JSON,
3461
- GLOB_PINIA_STORE,
3462
- GLOB_POSTCSS,
3463
- GLOB_SCSS,
3464
- GLOB_SRC,
3465
- GLOB_SRC_EXT,
3466
- GLOB_STYLE,
3467
- GLOB_SVELTE,
3468
- GLOB_SVG,
3469
- GLOB_TEST,
3470
- GLOB_TOML,
3471
- GLOB_TS,
3472
- GLOB_TSX,
3473
- GLOB_TYPES,
3474
- GLOB_VUE,
3475
- GLOB_YAML,
3476
- antfu,
3477
- combineConfigs,
3478
- command,
3479
- comments,
3480
- createNodeResolver,
3481
- createTypeScriptImportResolver,
3482
- defineESLintConfig,
3483
- depend,
3484
- ensurePackages,
3485
- esX,
3486
- eslintPlugin,
3487
- format,
3488
- getOverrides,
3489
- githubAction,
3490
- gitignore,
3491
- hasPinia,
3492
- hasShadcnVue,
3493
- hasTypeScript,
3494
- hasUnoCSS,
3495
- hasVitest,
3496
- hasVue,
3497
- ignores,
3498
- importX,
3499
- interopDefault,
3500
- isInGitHooksOrRunByNanoStagedOrRunByTSX,
3501
- javascript,
3502
- jsdoc,
3503
- jsonc,
3504
- jsx,
3505
- markdown,
3506
- mergePrettierOptions,
3507
- mergeProcessors,
3508
- node,
3509
- ntnyq,
3510
- parserJsonc,
3511
- parserPlain,
3512
- parserToml,
3513
- parserTypeScript,
3514
- parserVue,
3515
- parserYaml,
3516
- perfectionist,
3517
- pinia,
3518
- pluginAntfu,
3519
- pluginComments,
3520
- pluginDepend,
3521
- pluginFormat,
3522
- pluginGitHubAction,
3523
- pluginImportX,
3524
- pluginJsdoc,
3525
- pluginJsonc,
3526
- pluginMarkdown,
3527
- pluginNode,
3528
- pluginPerfectionist,
3529
- pluginPinia,
3530
- pluginPrettier,
3531
- pluginRegexp,
3532
- pluginSvgo,
3533
- pluginToml,
3534
- pluginTypeScript,
3535
- pluginUnicorn,
3536
- pluginUnoCSS,
3537
- pluginUnusedImports,
3538
- pluginVitest,
3539
- pluginVue,
3540
- pluginYaml,
3541
- prettier,
3542
- processorPassThrough,
3543
- processorVueBlocks,
3544
- regexp,
3545
- resolveSubOptions,
3546
- sort,
3547
- specials,
3548
- stylistic,
3549
- svgo,
3550
- test,
3551
- toArray,
3552
- toml,
3553
- typescript,
3554
- typescriptConfigs,
3555
- unicorn,
3556
- unocss,
3557
- unusedImports,
3558
- vitest,
3559
- vue,
3560
- yml
3561
- });