@ntnyq/eslint-config 2.8.2 → 3.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -44,6 +44,8 @@ __export(src_exports, {
44
44
  GLOB_LESS: () => GLOB_LESS,
45
45
  GLOB_LOCKFILE: () => GLOB_LOCKFILE,
46
46
  GLOB_MARKDOWN: () => GLOB_MARKDOWN,
47
+ GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
48
+ GLOB_MARKDOWN_NESTED: () => GLOB_MARKDOWN_NESTED,
47
49
  GLOB_NODE_MODULES: () => GLOB_NODE_MODULES,
48
50
  GLOB_SCSS: () => GLOB_SCSS,
49
51
  GLOB_SRC: () => GLOB_SRC,
@@ -55,10 +57,11 @@ __export(src_exports, {
55
57
  GLOB_TSX: () => GLOB_TSX,
56
58
  GLOB_VUE: () => GLOB_VUE,
57
59
  GLOB_YAML: () => GLOB_YAML,
60
+ antfu: () => antfu,
58
61
  command: () => command,
59
62
  comments: () => comments,
60
- defineConfig: () => defineConfig,
61
- getVueVersion: () => getVueVersion,
63
+ getOverrides: () => getOverrides,
64
+ gitignore: () => gitignore,
62
65
  hasTypeScript: () => hasTypeScript,
63
66
  hasUnoCSS: () => hasUnoCSS,
64
67
  hasVitest: () => hasVitest,
@@ -79,11 +82,12 @@ __export(src_exports, {
79
82
  parserVue: () => parserVue,
80
83
  parserYaml: () => parserYaml,
81
84
  perfectionist: () => perfectionist,
85
+ pluginAntfu: () => import_eslint_plugin_antfu.default,
82
86
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
83
87
  pluginImport: () => import_eslint_plugin_import_x.default,
84
88
  pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
85
89
  pluginJsonc: () => import_eslint_plugin_jsonc.default,
86
- pluginMarkdown: () => import_eslint_plugin_markdown.default,
90
+ pluginMarkdown: () => import_markdown.default,
87
91
  pluginNode: () => import_eslint_plugin_n.default,
88
92
  pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
89
93
  pluginPrettier: () => import_eslint_plugin_prettier.default,
@@ -97,8 +101,11 @@ __export(src_exports, {
97
101
  pluginYaml: () => import_eslint_plugin_yml.default,
98
102
  prettier: () => prettier,
99
103
  regexp: () => regexp,
104
+ resolveSubOptions: () => resolveSubOptions,
105
+ sortI18nLocale: () => sortI18nLocale,
100
106
  sortPackageJson: () => sortPackageJson,
101
107
  sortTsConfig: () => sortTsConfig,
108
+ toArray: () => toArray,
102
109
  toml: () => toml,
103
110
  tseslint: () => import_typescript_eslint.default,
104
111
  typescript: () => typescript,
@@ -112,46 +119,18 @@ __export(src_exports, {
112
119
  });
113
120
  module.exports = __toCommonJS(src_exports);
114
121
 
115
- // src/utils/env.ts
116
- var import_node_process = __toESM(require("process"), 1);
117
- var import_node_path = require("path");
118
- var import_local_pkg = require("local-pkg");
119
- var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
120
- var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
121
- 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)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
122
- paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
123
- });
124
- 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");
125
-
126
- // src/utils/interopDefault.ts
127
- async function interopDefault(mod) {
128
- const resolved = await mod;
129
- return resolved.default || resolved;
130
- }
131
-
132
- // src/utils/loadPlugin.ts
133
- async function loadPlugin(name) {
134
- const mod = await import(name).catch((err) => {
135
- console.error(err);
136
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
137
- });
138
- return interopDefault(mod);
139
- }
140
-
141
- // src/utils/defineConfig.ts
142
- function defineConfig(configs = []) {
143
- return configs;
144
- }
122
+ // src/core.ts
123
+ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
145
124
 
146
125
  // src/globs.ts
147
126
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
148
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
127
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
149
128
  var GLOB_JS = "**/*.?([cm])js";
150
129
  var GLOB_JSX = "**/*.?([cm])jsx";
151
130
  var GLOB_TS = "**/*.?([cm])ts";
152
131
  var GLOB_TSX = "**/*.?([cm])tsx";
153
132
  var GLOB_DTS = "**/*.d.?([cm])ts";
154
- var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
133
+ var GLOB_TEST = `**/*.{test,spec,bench,benchmark}.${GLOB_SRC_EXT}`;
155
134
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
156
135
  var GLOB_CSS = "**/*.css";
157
136
  var GLOB_LESS = "**/*.less";
@@ -160,20 +139,22 @@ var GLOB_JSON = "**/*.json";
160
139
  var GLOB_JSON5 = "**/*.json5";
161
140
  var GLOB_JSONC = "**/*.jsonc";
162
141
  var GLOB_VUE = "**/*.vue";
163
- var GLOB_MARKDOWN = "**/*.md";
164
142
  var GLOB_YAML = "**/*.y?(a)ml";
165
143
  var GLOB_TOML = "**/*.toml";
166
144
  var GLOB_HTML = "**/*.htm?(l)";
145
+ var GLOB_MARKDOWN = "**/*.md";
146
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
147
+ var GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
167
148
  var GLOB_ALL_SRC = [
168
149
  GLOB_SRC,
169
150
  GLOB_STYLE,
170
151
  GLOB_JSON,
171
152
  GLOB_JSON5,
172
- GLOB_MARKDOWN,
173
153
  GLOB_VUE,
174
154
  GLOB_YAML,
175
155
  GLOB_TOML,
176
- GLOB_HTML
156
+ GLOB_HTML,
157
+ GLOB_MARKDOWN
177
158
  ];
178
159
  var GLOB_NODE_MODULES = "**/node_modules/**";
179
160
  var GLOB_DIST = "**/dist/**";
@@ -229,661 +210,833 @@ var GLOB_EXCLUDE = [
229
210
  "**/.yarnrc"
230
211
  ];
231
212
 
232
- // src/configs/ignores.ts
233
- var ignores = defineConfig([
234
- {
235
- name: "ntnyq/ignores",
236
- ignores: GLOB_EXCLUDE
237
- }
238
- ]);
239
-
240
213
  // src/plugins.ts
241
214
  var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
215
+ var parserVue = __toESM(require("vue-eslint-parser"), 1);
216
+ var parserToml = __toESM(require("toml-eslint-parser"), 1);
217
+ var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
218
+ var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
242
219
  var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
243
220
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
244
221
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
245
222
  var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
246
223
  var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
247
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
224
+ var import_markdown = __toESM(require("@eslint/markdown"), 1);
225
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
248
226
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
227
+ var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
249
228
  var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
250
229
  var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
251
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
252
230
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
231
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
253
232
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
254
- var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
255
233
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
256
234
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
257
235
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
258
- var parserToml = __toESM(require("toml-eslint-parser"), 1);
259
- var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
260
- var parserVue = __toESM(require("vue-eslint-parser"), 1);
261
- var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
262
236
 
263
- // src/configs/node.ts
264
- var node = defineConfig([
265
- {
266
- name: "ntnyq/node",
267
- plugins: {
268
- node: import_eslint_plugin_n.default
237
+ // src/configs/typescript.ts
238
+ var import_node_process = __toESM(require("process"), 1);
239
+ var typescriptCore = (options = {}) => {
240
+ const isTypeAware = !!options.tsconfigPath;
241
+ const configs = import_typescript_eslint.default.config({
242
+ name: "ntnyq/ts/core",
243
+ extends: [...import_typescript_eslint.default.configs.recommended],
244
+ files: [GLOB_TS, GLOB_TSX],
245
+ languageOptions: {
246
+ parser: import_typescript_eslint.default.parser,
247
+ parserOptions: {
248
+ sourceType: "module",
249
+ ...isTypeAware ? {
250
+ projectService: {
251
+ defaultProject: options.tsconfigPath
252
+ },
253
+ tsconfigRootDir: import_node_process.default.cwd()
254
+ } : {}
255
+ }
269
256
  },
270
257
  rules: {
271
- "node/handle-callback-err": ["error", "^(err|error)$"],
272
- "node/no-deprecated-api": "error",
273
- "node/no-exports-assign": "error",
274
- "node/no-new-require": "error",
275
- "node/no-path-concat": "error",
276
- "node/prefer-global/buffer": ["error", "never"],
277
- "node/prefer-global/process": ["error", "never"],
278
- "node/process-exit-as-throw": "error"
258
+ "@typescript-eslint/no-unused-vars": [
259
+ "error",
260
+ {
261
+ // Args after the last used will be reported
262
+ args: "after-used",
263
+ argsIgnorePattern: "^_",
264
+ caughtErrors: "all",
265
+ caughtErrorsIgnorePattern: "^_",
266
+ destructuredArrayIgnorePattern: "^_",
267
+ varsIgnorePattern: "^_",
268
+ ignoreRestSiblings: true
269
+ }
270
+ ],
271
+ "@typescript-eslint/no-redeclare": "error",
272
+ "@typescript-eslint/consistent-type-imports": [
273
+ "error",
274
+ {
275
+ prefer: "type-imports",
276
+ fixStyle: "separate-type-imports",
277
+ disallowTypeAnnotations: false
278
+ }
279
+ ],
280
+ "@typescript-eslint/no-empty-object-type": [
281
+ "error",
282
+ {
283
+ allowInterfaces: "always",
284
+ allowObjectTypes: "always"
285
+ }
286
+ ],
287
+ "@typescript-eslint/consistent-type-assertions": [
288
+ "error",
289
+ {
290
+ assertionStyle: "as",
291
+ objectLiteralTypeAssertions: "allow-as-parameter"
292
+ }
293
+ ],
294
+ "@typescript-eslint/prefer-as-const": "warn",
295
+ "@typescript-eslint/ban-types": "off",
296
+ "@typescript-eslint/camelcase": "off",
297
+ "@typescript-eslint/no-namespace": "off",
298
+ "@typescript-eslint/ban-ts-ignore": "off",
299
+ "@typescript-eslint/ban-ts-comment": "off",
300
+ "@typescript-eslint/no-explicit-any": "off",
301
+ "@typescript-eslint/no-empty-function": "off",
302
+ "@typescript-eslint/naming-convention": "off",
303
+ "@typescript-eslint/no-non-null-assertion": "off",
304
+ "@typescript-eslint/triple-slash-reference": "off",
305
+ "@typescript-eslint/no-parameter-properties": "off",
306
+ "@typescript-eslint/explicit-member-accessibility": "off",
307
+ "@typescript-eslint/explicit-function-return-type": "off",
308
+ "@typescript-eslint/explicit-module-boundary-types": "off",
309
+ "@typescript-eslint/consistent-indexed-object-style": "off"
310
+ },
311
+ // Overrides built-in rules
312
+ ...options.overrides
313
+ });
314
+ return configs;
315
+ };
316
+ var typescript = (options = {}) => [
317
+ ...typescriptCore(options),
318
+ {
319
+ name: "ntnyq/ts/dts",
320
+ files: [GLOB_DTS],
321
+ rules: {
322
+ "no-use-before-define": "off",
323
+ "no-restricted-syntax": "off",
324
+ "import/no-duplicates": "off",
325
+ "import/newline-after-import": "off"
326
+ }
327
+ },
328
+ {
329
+ name: "ntnyq/ts/test",
330
+ files: ["**/*.{spec,test}.ts?(x)"],
331
+ rules: {
332
+ "no-unused-expressions": "off",
333
+ "max-lines-per-function": "off"
279
334
  }
335
+ },
336
+ {
337
+ name: "ntnyq/ts/cjs",
338
+ files: [GLOB_JS],
339
+ rules: {}
280
340
  }
281
- ]);
341
+ ];
282
342
 
283
- // src/configs/jsdoc.ts
284
- var jsdoc = defineConfig([
343
+ // src/configs/vue.ts
344
+ var vue2Rules = {
345
+ ...import_eslint_plugin_vue.default.configs.base.rules,
346
+ ...import_eslint_plugin_vue.default.configs.essential.rules,
347
+ ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
348
+ ...import_eslint_plugin_vue.default.configs.recommended.rules
349
+ };
350
+ var vue3Rules = {
351
+ ...import_eslint_plugin_vue.default.configs.base.rules,
352
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
353
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
354
+ ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
355
+ };
356
+ var vue = (options = {}) => {
357
+ const isVue3 = options.vueVersion !== 2;
358
+ return [
359
+ ...import_typescript_eslint.default.config({
360
+ name: "ntnyq/vue/ts",
361
+ files: [GLOB_VUE],
362
+ extends: typescriptCore()
363
+ }),
364
+ {
365
+ name: "ntnyq/vue/core",
366
+ files: [GLOB_VUE],
367
+ plugins: {
368
+ vue: import_eslint_plugin_vue.default,
369
+ "@typescript-eslint": import_typescript_eslint.default.plugin
370
+ },
371
+ languageOptions: {
372
+ parser: parserVue,
373
+ parserOptions: {
374
+ parser: "@typescript-eslint/parser",
375
+ sourceType: "module",
376
+ extraFileExtensions: [".vue"],
377
+ ecmaFeatures: {
378
+ jsx: true
379
+ }
380
+ }
381
+ },
382
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
383
+ rules: {
384
+ ...isVue3 ? vue3Rules : vue2Rules,
385
+ // OFF
386
+ "vue/no-v-html": "off",
387
+ "vue/require-prop-types": "off",
388
+ "vue/require-default-prop": "off",
389
+ "vue/multi-word-component-names": "off",
390
+ "vue/no-v-text-v-html-on-component": "off",
391
+ "vue/no-setup-props-reactivity-loss": "off",
392
+ "vue/html-self-closing": [
393
+ "error",
394
+ {
395
+ html: {
396
+ void: "always",
397
+ normal: "always",
398
+ component: "always"
399
+ },
400
+ svg: "always",
401
+ math: "always"
402
+ }
403
+ ],
404
+ "vue/block-tag-newline": [
405
+ "error",
406
+ {
407
+ singleline: "always",
408
+ multiline: "always"
409
+ }
410
+ ],
411
+ "vue/component-name-in-template-casing": [
412
+ "error",
413
+ "PascalCase",
414
+ {
415
+ // Force auto-import components to be PascalCase
416
+ registeredComponentsOnly: false,
417
+ ignores: ["slot", "component"]
418
+ }
419
+ ],
420
+ "vue/component-options-name-casing": ["error", "PascalCase"],
421
+ "vue/custom-event-name-casing": ["error", "camelCase"],
422
+ "vue/define-macros-order": [
423
+ "error",
424
+ {
425
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
426
+ }
427
+ ],
428
+ "vue/html-comment-content-spacing": [
429
+ "error",
430
+ "always",
431
+ {
432
+ exceptions: ["-"]
433
+ }
434
+ ],
435
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
436
+ "vue/no-useless-v-bind": "error",
437
+ "vue/padding-line-between-blocks": "error",
438
+ "vue/next-tick-style": ["error", "promise"],
439
+ "vue/array-bracket-spacing": ["error", "never"],
440
+ "vue/prefer-separate-static-class": "error",
441
+ "vue/no-constant-condition": "error",
442
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
443
+ "vue/prefer-define-options": "error",
444
+ "vue/valid-define-options": "error",
445
+ // TypeScript enhancements
446
+ "vue/define-emits-declaration": ["error", "type-literal"],
447
+ "vue/no-unused-emit-declarations": "error",
448
+ "vue/this-in-template": ["error", "never"],
449
+ "vue/arrow-spacing": ["error", { before: true, after: true }],
450
+ "vue/block-spacing": ["error", "always"],
451
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
452
+ "vue/comma-dangle": ["error", "always-multiline"],
453
+ "vue/comma-spacing": ["error", { before: false, after: true }],
454
+ "vue/comma-style": ["error", "last"],
455
+ "vue/dot-location": ["error", "property"],
456
+ "vue/dot-notation": ["error", { allowKeywords: true }],
457
+ "vue/eqeqeq": ["error", "smart"],
458
+ "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
459
+ "vue/keyword-spacing": ["error", { before: true, after: true }],
460
+ "vue/no-empty-pattern": "error",
461
+ "vue/no-loss-of-precision": "error",
462
+ "vue/no-irregular-whitespace": "error",
463
+ "vue/no-use-v-else-with-v-for": "error",
464
+ "vue/require-typed-object-prop": "error",
465
+ "vue/no-extra-parens": ["error", "functions"],
466
+ "vue/no-restricted-syntax": [
467
+ "error",
468
+ "DebuggerStatement",
469
+ "LabeledStatement",
470
+ "WithStatement"
471
+ ],
472
+ "vue/no-sparse-arrays": "error",
473
+ "vue/no-deprecated-model-definition": [
474
+ "error",
475
+ {
476
+ allowVue3Compat: true
477
+ }
478
+ ],
479
+ "vue/object-curly-newline": [
480
+ "error",
481
+ {
482
+ multiline: true,
483
+ consistent: true
484
+ }
485
+ ],
486
+ "vue/no-static-inline-styles": [
487
+ "error",
488
+ {
489
+ allowBinding: true
490
+ }
491
+ ],
492
+ "vue/object-curly-spacing": ["error", "always"],
493
+ "vue/object-property-newline": [
494
+ "error",
495
+ {
496
+ allowMultiplePropertiesPerLine: true
497
+ }
498
+ ],
499
+ "vue/object-shorthand": [
500
+ "error",
501
+ "always",
502
+ {
503
+ ignoreConstructors: false,
504
+ avoidQuotes: true
505
+ }
506
+ ],
507
+ "vue/operator-linebreak": ["error", "before"],
508
+ "vue/prefer-template": "error",
509
+ "vue/prop-name-casing": ["error", "camelCase"],
510
+ "vue/quote-props": ["error", "consistent-as-needed"],
511
+ "vue/space-in-parens": ["error", "never"],
512
+ "vue/space-infix-ops": "error",
513
+ "vue/space-unary-ops": [
514
+ "error",
515
+ {
516
+ words: true,
517
+ nonwords: false
518
+ }
519
+ ],
520
+ "vue/template-curly-spacing": "error",
521
+ "vue/block-order": [
522
+ "error",
523
+ {
524
+ order: ["script", "template", "style"]
525
+ }
526
+ ],
527
+ "vue/attributes-order": [
528
+ "error",
529
+ {
530
+ order: [
531
+ "EVENTS",
532
+ // `@click="functionCall"`, `v-on="event"`
533
+ "TWO_WAY_BINDING",
534
+ // `v-model`
535
+ "OTHER_DIRECTIVES",
536
+ // `v-custom-directive`
537
+ "LIST_RENDERING",
538
+ // `v-for item in items`
539
+ "CONDITIONALS",
540
+ // `v-if`, `v-show`, `v-cloak`
541
+ "CONTENT",
542
+ // `v-text`, `v-html`
543
+ "SLOT",
544
+ // `v-slot`, `slot`
545
+ "UNIQUE",
546
+ // `ref`, `key`
547
+ "DEFINITION",
548
+ // `is`, `v-is`
549
+ "ATTR_DYNAMIC",
550
+ // `v-bind:prop="foo"`, `:prop="foo"`
551
+ // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
552
+ "RENDER_MODIFIERS",
553
+ // `v-once`, `v-pre`
554
+ "GLOBAL",
555
+ // `id`
556
+ "ATTR_STATIC",
557
+ // `prop="foo", `static attributes
558
+ "ATTR_SHORTHAND_BOOL"
559
+ // `disabled`, prop shorthand
560
+ ],
561
+ alphabetical: false
562
+ }
563
+ ],
564
+ "vue/order-in-components": [
565
+ "error",
566
+ {
567
+ order: [
568
+ "el",
569
+ "name",
570
+ "key",
571
+ "parent",
572
+ "functional",
573
+ ["provide", "inject"],
574
+ ["delimiters", "comments"],
575
+ ["components", "directives", "filters"],
576
+ "extends",
577
+ "mixins",
578
+ "layout",
579
+ "middleware",
580
+ "validate",
581
+ "scrollToTop",
582
+ "transition",
583
+ "loading",
584
+ "inheritAttrs",
585
+ "model",
586
+ ["props", "propsData"],
587
+ "emits",
588
+ "setup",
589
+ "asyncData",
590
+ "computed",
591
+ "data",
592
+ "fetch",
593
+ "head",
594
+ "methods",
595
+ ["template", "render"],
596
+ "watch",
597
+ "watchQuery",
598
+ "LIFECYCLE_HOOKS",
599
+ "renderError",
600
+ "ROUTER_GUARDS"
601
+ ]
602
+ }
603
+ ],
604
+ "vue/max-attributes-per-line": [
605
+ "error",
606
+ {
607
+ singleline: 1,
608
+ multiline: 1
609
+ }
610
+ ],
611
+ // Overrides built-in rules
612
+ ...options.overrides
613
+ }
614
+ }
615
+ ];
616
+ };
617
+
618
+ // src/configs/yml.ts
619
+ var yml = (options = {}) => [
285
620
  {
286
- name: "ntnyq/jsdoc",
621
+ name: "ntnyq/yaml",
622
+ files: [GLOB_YAML],
623
+ languageOptions: {
624
+ parser: parserYaml
625
+ },
287
626
  plugins: {
288
- jsdoc: import_eslint_plugin_jsdoc.default
627
+ yml: import_eslint_plugin_yml.default
289
628
  },
290
629
  rules: {
291
- "jsdoc/check-access": "warn",
292
- "jsdoc/check-param-names": "warn",
293
- "jsdoc/check-property-names": "warn",
294
- "jsdoc/check-types": "warn",
295
- "jsdoc/empty-tags": "warn",
296
- "jsdoc/implements-on-classes": "warn",
297
- "jsdoc/no-defaults": "warn",
298
- "jsdoc/no-multi-asterisks": "warn",
299
- "jsdoc/require-param-name": "warn",
300
- "jsdoc/require-property": "warn",
301
- "jsdoc/require-property-description": "warn",
302
- "jsdoc/require-property-name": "warn",
303
- "jsdoc/require-returns-check": "warn",
304
- "jsdoc/require-returns-description": "warn",
305
- "jsdoc/require-yields-check": "warn",
306
- "jsdoc/check-alignment": "warn",
307
- "jsdoc/multiline-blocks": "warn"
630
+ ...import_eslint_plugin_yml.default.configs.standard.rules,
631
+ ...import_eslint_plugin_yml.default.configs.prettier.rules,
632
+ "yml/no-empty-mapping-value": "off",
633
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
634
+ // Overrides built-in rules
635
+ ...options.overrides
308
636
  }
309
637
  }
310
- ]);
638
+ ];
311
639
 
312
- // src/configs/imports.ts
313
- var imports = defineConfig([
640
+ // src/configs/node.ts
641
+ var node = (options = {}) => [
314
642
  {
315
- name: "ntnyq/imports",
643
+ name: "ntnyq/node",
316
644
  plugins: {
317
- import: import_eslint_plugin_import_x.default
318
- },
319
- settings: {
320
- "import/resolver": {
321
- node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
322
- }
645
+ node: import_eslint_plugin_n.default
323
646
  },
324
647
  rules: {
325
- "import/no-unresolved": "off",
326
- "import/no-absolute-path": "off",
327
- "import/no-named-as-default-member": "off",
328
- "import/first": "error",
329
- "import/export": "error",
330
- "import/no-duplicates": "error",
331
- "import/no-mutable-exports": "error",
332
- "import/newline-after-import": "error",
333
- "import/order": [
334
- "error",
335
- {
336
- groups: [
337
- "builtin",
338
- "external",
339
- "internal",
340
- "parent",
341
- "sibling",
342
- "index",
343
- "object",
344
- "type"
345
- ],
346
- "newlines-between": "never",
347
- pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
348
- pathGroupsExcludedImportTypes: ["type"]
349
- }
350
- ]
648
+ "node/handle-callback-err": ["error", "^(err|error)$"],
649
+ "node/no-deprecated-api": "error",
650
+ "node/no-exports-assign": "error",
651
+ "node/no-new-require": "error",
652
+ "node/no-path-concat": "error",
653
+ "node/prefer-global/buffer": ["error", "never"],
654
+ "node/prefer-global/process": ["error", "never"],
655
+ "node/process-exit-as-throw": "error",
656
+ // Overrides built-in rules
657
+ ...options.overrides
351
658
  }
352
659
  }
353
- ]);
660
+ ];
354
661
 
355
- // src/configs/unicorn.ts
356
- var unicorn = defineConfig([
662
+ // src/configs/sort.ts
663
+ var sortPackageJson = () => [
357
664
  {
358
- name: "ntnyq/unicorn",
359
- plugins: {
360
- unicorn: import_eslint_plugin_unicorn.default
361
- },
665
+ name: "ntnyq/sort/package-json",
666
+ files: ["**/package.json"],
362
667
  rules: {
363
- // Disabled for now
364
- "unicorn/prefer-top-level-await": "off",
365
- "unicorn/explicit-length-check": "off",
366
- "unicorn/no-array-callback-reference": "off",
367
- "unicorn/error-message": "error",
368
- "unicorn/escape-case": "error",
369
- "unicorn/no-new-buffer": "error",
370
- "unicorn/number-literal-case": "error",
371
- "unicorn/prefer-includes": "error",
372
- "unicorn/prefer-type-error": "error",
373
- "unicorn/throw-new-error": "error",
374
- "unicorn/no-unnecessary-await": "error",
375
- "unicorn/switch-case-braces": ["error", "avoid"],
376
- "unicorn/no-typeof-undefined": "error",
377
- "unicorn/prefer-set-size": "error",
378
- "unicorn/better-regex": "error",
379
- "unicorn/prefer-regexp-test": "error",
380
- "unicorn/no-static-only-class": "error",
381
- "unicorn/no-zero-fractions": "error",
382
- "unicorn/custom-error-definition": "error",
383
- "unicorn/prefer-modern-math-apis": "error",
384
- "unicorn/new-for-builtins": "error",
385
- "unicorn/no-console-spaces": "error",
386
- "unicorn/no-for-loop": "error",
387
- "unicorn/no-hex-escape": "error",
388
- "unicorn/no-lonely-if": "error",
389
- "unicorn/prefer-keyboard-event-key": "error",
390
- "unicorn/prefer-math-trunc": "error",
391
- "unicorn/prefer-negative-index": "error",
392
- "unicorn/prefer-node-protocol": "error",
393
- "unicorn/prefer-number-properties": "error",
394
- "unicorn/prefer-optional-catch-binding": "error",
395
- "unicorn/prefer-prototype-methods": "error",
396
- "unicorn/prefer-reflect-apply": "error",
397
- "unicorn/catch-error-name": [
668
+ "jsonc/sort-keys": [
398
669
  "error",
399
670
  {
400
- name: "err",
401
- ignore: ["^_."]
402
- }
403
- ],
404
- "unicorn/prefer-date-now": "error",
405
- // String
406
- "unicorn/prefer-string-slice": "error",
407
- "unicorn/prefer-string-trim-start-end": "error",
408
- "unicorn/prefer-string-starts-ends-with": "error",
409
- // DOM
410
- "unicorn/prefer-add-event-listener": "error",
411
- "unicorn/no-invalid-remove-event-listener": "error",
412
- "unicorn/prefer-query-selector": "error",
413
- "unicorn/prefer-modern-dom-apis": "error",
414
- "unicorn/prefer-dom-node-append": "error",
415
- "unicorn/prefer-dom-node-dataset": "error",
416
- "unicorn/prefer-dom-node-remove": "error",
417
- "unicorn/prefer-dom-node-text-content": "error",
418
- // Array
419
- "unicorn/no-new-array": "error",
420
- "unicorn/no-instanceof-array": "error",
421
- "unicorn/no-array-push-push": "error",
422
- "unicorn/no-array-method-this-argument": "error",
423
- "unicorn/prefer-array-find": "error",
424
- "unicorn/prefer-array-some": "error",
425
- "unicorn/prefer-array-flat-map": "error",
426
- "unicorn/prefer-array-index-of": "error"
427
- }
428
- }
429
- ]);
430
-
431
- // src/configs/prettier.ts
432
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
433
- var prettier = defineConfig([
434
- {
435
- name: "ntnyq/prettier",
436
- plugins: {
437
- prettier: import_eslint_plugin_prettier.default
438
- },
439
- rules: {
440
- ...import_eslint_config_prettier.default.rules,
441
- ...import_eslint_plugin_prettier.default.configs.recommended.rules,
442
- "prettier/prettier": "warn"
443
- }
444
- },
445
- /**
446
- * Languages that prettier currently does not support
447
- */
448
- {
449
- name: "ntnyq/prettier/ignore",
450
- files: [GLOB_TOML],
451
- plugins: {
452
- prettier: import_eslint_plugin_prettier.default
453
- },
454
- rules: {
455
- "prettier/prettier": "off"
456
- }
457
- }
458
- ]);
459
-
460
- // src/configs/comments.ts
461
- var comments = defineConfig([
462
- {
463
- name: "ntnyq/eslint-comments",
464
- plugins: {
465
- "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
466
- },
467
- rules: {
468
- ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
469
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
470
- }
471
- }
472
- ]);
473
-
474
- // src/configs/javascript.ts
475
- var import_globals = __toESM(require("globals"), 1);
476
- var import_js = __toESM(require("@eslint/js"), 1);
477
- var javascript = defineConfig([
478
- {
479
- name: "ntnyq/js/recommended",
480
- ...import_js.default.configs.recommended
481
- },
482
- {
483
- name: "ntnyq/js/core",
484
- languageOptions: {
485
- globals: {
486
- ...import_globals.default.browser,
487
- ...import_globals.default.es2021,
488
- ...import_globals.default.node
489
- },
490
- sourceType: "module"
491
- },
492
- rules: {
493
- // standard v17.0.0
494
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
495
- camelcase: [
496
- "error",
497
- {
498
- allow: ["^UNSAFE_"],
499
- properties: "never",
500
- ignoreGlobals: true
501
- }
502
- ],
503
- "constructor-super": "error",
504
- curly: ["error", "multi-line"],
505
- "default-case-last": "error",
506
- "dot-notation": ["error", { allowKeywords: true }],
507
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
508
- "no-array-constructor": "error",
509
- "no-async-promise-executor": "error",
510
- "no-caller": "error",
511
- "no-class-assign": "error",
512
- "no-compare-neg-zero": "error",
513
- "no-cond-assign": "error",
514
- "no-const-assign": "error",
515
- "no-constant-condition": ["error", { checkLoops: false }],
516
- "no-control-regex": "error",
517
- "no-debugger": "error",
518
- "no-delete-var": "error",
519
- "no-dupe-args": "error",
520
- "no-dupe-class-members": "error",
521
- "no-dupe-keys": "error",
522
- "no-duplicate-case": "error",
523
- "no-useless-backreference": "error",
524
- "no-empty": ["error", { allowEmptyCatch: true }],
525
- "no-empty-character-class": "error",
526
- "no-empty-pattern": "error",
527
- "no-eval": "error",
528
- "no-ex-assign": "error",
529
- "no-extend-native": "error",
530
- "no-extra-bind": "error",
531
- "no-extra-boolean-cast": "error",
532
- "no-fallthrough": "error",
533
- "no-func-assign": "error",
534
- "no-global-assign": "error",
535
- "no-implied-eval": "error",
536
- "no-import-assign": "error",
537
- "no-invalid-regexp": "error",
538
- "no-irregular-whitespace": "error",
539
- "no-iterator": "error",
540
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
541
- "no-lone-blocks": "error",
542
- "no-loss-of-precision": "error",
543
- "no-misleading-character-class": "error",
544
- "no-prototype-builtins": "error",
545
- "no-useless-catch": "error",
546
- "no-new": "error",
547
- "no-new-func": "error",
548
- "no-new-wrappers": "error",
549
- "no-obj-calls": "error",
550
- "no-octal": "error",
551
- "no-octal-escape": "error",
552
- "no-proto": "error",
553
- "no-redeclare": ["error", { builtinGlobals: false }],
554
- "no-regex-spaces": "error",
555
- "no-self-assign": ["error", { props: true }],
556
- "no-self-compare": "error",
557
- "no-sequences": "error",
558
- "no-shadow-restricted-names": "error",
559
- "no-sparse-arrays": "error",
560
- "no-template-curly-in-string": "error",
561
- "no-this-before-super": "error",
562
- "no-throw-literal": "error",
563
- "no-undef": "error",
564
- "no-undef-init": "error",
565
- "no-unexpected-multiline": "error",
566
- "no-unmodified-loop-condition": "error",
567
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
568
- "no-unreachable": "error",
569
- "no-unreachable-loop": "error",
570
- "no-unsafe-finally": "error",
571
- "no-unsafe-negation": "error",
572
- "no-unused-expressions": [
573
- "error",
574
- {
575
- allowShortCircuit: true,
576
- allowTernary: true,
577
- allowTaggedTemplates: true
578
- }
579
- ],
580
- "no-unused-vars": [
581
- "error",
582
- {
583
- args: "none",
584
- caughtErrors: "none",
585
- ignoreRestSiblings: true,
586
- vars: "all"
587
- }
588
- ],
589
- "no-useless-call": "error",
590
- "no-useless-computed-key": "error",
591
- "no-useless-constructor": "error",
592
- "no-useless-rename": "error",
593
- "no-useless-return": "error",
594
- "prefer-promise-reject-errors": "error",
595
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
596
- "symbol-description": "error",
597
- "unicode-bom": ["error", "never"],
598
- "use-isnan": [
599
- "error",
671
+ pathPattern: "^$",
672
+ order: [
673
+ "publisher",
674
+ "name",
675
+ "displayName",
676
+ "preview",
677
+ "type",
678
+ "version",
679
+ "private",
680
+ "packageManager",
681
+ "description",
682
+ "keywords",
683
+ "license",
684
+ "author",
685
+ "homepage",
686
+ "repository",
687
+ "funding",
688
+ "exports",
689
+ "main",
690
+ "module",
691
+ "unpkg",
692
+ "jsdelivr",
693
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
694
+ "types",
695
+ "typesVersions",
696
+ "bin",
697
+ "icon",
698
+ "files",
699
+ "sideEffects",
700
+ "scripts",
701
+ "peerDependencies",
702
+ "peerDependenciesMeta",
703
+ "dependencies",
704
+ "optionalDependencies",
705
+ "devDependencies",
706
+ "activationEvents",
707
+ "contributes",
708
+ "categories",
709
+ "engines",
710
+ "pnpm",
711
+ "overrides",
712
+ "resolutions",
713
+ "husky",
714
+ "prettier",
715
+ "nano-staged",
716
+ "lint-staged",
717
+ "eslintConfig"
718
+ ]
719
+ },
600
720
  {
601
- enforceForSwitchCase: true,
602
- enforceForIndexOf: true
603
- }
604
- ],
605
- "valid-typeof": ["error", { requireStringLiterals: true }],
606
- yoda: ["error", "never"],
607
- // es6+
608
- "no-var": "error",
609
- "prefer-rest-params": "error",
610
- "prefer-spread": "error",
611
- "prefer-template": "error",
612
- "no-empty-static-block": "error",
613
- "no-new-native-nonconstructor": "error",
614
- "prefer-const": [
615
- "error",
721
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
722
+ order: { type: "asc" }
723
+ },
616
724
  {
617
- destructuring: "all",
618
- ignoreReadBeforeAssign: true
619
- }
620
- ],
621
- "prefer-arrow-callback": [
622
- "error",
725
+ order: { type: "asc" },
726
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
727
+ },
623
728
  {
624
- allowNamedFunctions: false,
625
- allowUnboundThis: true
626
- }
627
- ],
628
- "object-shorthand": [
629
- "error",
630
- "always",
729
+ pathPattern: "^exports.*$",
730
+ order: ["types", "import", "require", "default"]
731
+ },
631
732
  {
632
- ignoreConstructors: false,
633
- avoidQuotes: true
634
- }
635
- ],
636
- // best-practice
637
- eqeqeq: ["error", "smart"],
638
- complexity: ["error", { max: 30 }],
639
- "array-callback-return": "error",
640
- "block-scoped-var": "error",
641
- "consistent-return": "off",
642
- "no-alert": "error",
643
- "no-case-declarations": "error",
644
- "no-multi-str": "error",
645
- "no-with": "error",
646
- "no-void": "error",
647
- "no-useless-escape": "off",
648
- "vars-on-top": "error",
649
- "require-await": "off",
650
- "no-return-assign": "off",
651
- "one-var": ["error", "never"],
652
- "max-params": ["error", { max: 5 }],
653
- "max-depth": ["error", { max: 5 }],
654
- "max-nested-callbacks": ["error", { max: 10 }],
655
- "max-lines": [
656
- "error",
733
+ pathPattern: "^scripts$",
734
+ order: { type: "asc" }
735
+ },
657
736
  {
658
- max: 1e3,
659
- skipComments: true,
660
- skipBlankLines: true
737
+ order: [
738
+ // client hooks only
739
+ "pre-commit",
740
+ "prepare-commit-msg",
741
+ "commit-msg",
742
+ "post-commit",
743
+ "pre-rebase",
744
+ "post-rewrite",
745
+ "post-checkout",
746
+ "post-merge",
747
+ "pre-push",
748
+ "pre-auto-gc"
749
+ ],
750
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
661
751
  }
662
752
  ],
663
- "max-lines-per-function": [
753
+ "jsonc/sort-array-values": [
664
754
  "error",
665
755
  {
666
- max: 200,
667
- skipComments: true,
668
- skipBlankLines: true
756
+ pathPattern: "^files$",
757
+ order: { type: "asc" }
669
758
  }
670
- ],
671
- "no-use-before-define": [
759
+ ]
760
+ }
761
+ }
762
+ ];
763
+ var sortTsConfig = () => [
764
+ {
765
+ name: "ntnyq/sort/tsconfig",
766
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
767
+ rules: {
768
+ "jsonc/sort-keys": [
672
769
  "error",
673
770
  {
674
- functions: false,
675
- classes: false,
676
- variables: true
677
- }
678
- ],
679
- "sort-imports": [
680
- "error",
771
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
772
+ pathPattern: "^$"
773
+ },
681
774
  {
682
- ignoreCase: false,
683
- ignoreDeclarationSort: true,
684
- ignoreMemberSort: false,
685
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
686
- allowSeparatedGroups: false
775
+ order: [
776
+ /* Projects */
777
+ "incremental",
778
+ "composite",
779
+ "tsBuildInfoFile",
780
+ "disableSourceOfProjectReferenceRedirect",
781
+ "disableSolutionSearching",
782
+ "disableReferencedProjectLoad",
783
+ /* Language and Environment */
784
+ "target",
785
+ "lib",
786
+ "jsx",
787
+ "experimentalDecorators",
788
+ "emitDecoratorMetadata",
789
+ "jsxFactory",
790
+ "jsxFragmentFactory",
791
+ "jsxImportSource",
792
+ "reactNamespace",
793
+ "noLib",
794
+ "useDefineForClassFields",
795
+ "moduleDetection",
796
+ /* Modules */
797
+ "module",
798
+ "rootDir",
799
+ "moduleResolution",
800
+ "baseUrl",
801
+ "paths",
802
+ "rootDirs",
803
+ "typeRoots",
804
+ "types",
805
+ "allowUmdGlobalAccess",
806
+ "moduleSuffixes",
807
+ "allowImportingTsExtensions",
808
+ "resolvePackageJsonExports",
809
+ "resolvePackageJsonImports",
810
+ "customConditions",
811
+ "resolveJsonModule",
812
+ "allowArbitraryExtensions",
813
+ "noResolve",
814
+ /* JavaScript Support */
815
+ "allowJs",
816
+ "checkJs",
817
+ "maxNodeModuleJsDepth",
818
+ /* Emit */
819
+ "declaration",
820
+ "declarationMap",
821
+ "emitDeclarationOnly",
822
+ "sourceMap",
823
+ "inlineSourceMap",
824
+ "outFile",
825
+ "outDir",
826
+ "removeComments",
827
+ "noEmit",
828
+ "importHelpers",
829
+ "importsNotUsedAsValues",
830
+ "downlevelIteration",
831
+ "sourceRoot",
832
+ "mapRoot",
833
+ "inlineSources",
834
+ "emitBOM",
835
+ "newLine",
836
+ "stripInternal",
837
+ "noEmitHelpers",
838
+ "noEmitOnError",
839
+ "preserveConstEnums",
840
+ "declarationDir",
841
+ "preserveValueImports",
842
+ /* Interop Constraints */
843
+ "isolatedModules",
844
+ "verbatimModuleSyntax",
845
+ "allowSyntheticDefaultImports",
846
+ "esModuleInterop",
847
+ "preserveSymlinks",
848
+ "forceConsistentCasingInFileNames",
849
+ /* Type Checking */
850
+ "strict",
851
+ "strictBindCallApply",
852
+ "strictFunctionTypes",
853
+ "strictNullChecks",
854
+ "strictPropertyInitialization",
855
+ "allowUnreachableCode",
856
+ "allowUnusedLabels",
857
+ "alwaysStrict",
858
+ "exactOptionalPropertyTypes",
859
+ "noFallthroughCasesInSwitch",
860
+ "noImplicitAny",
861
+ "noImplicitOverride",
862
+ "noImplicitReturns",
863
+ "noImplicitThis",
864
+ "noPropertyAccessFromIndexSignature",
865
+ "noUncheckedIndexedAccess",
866
+ "noUnusedLocals",
867
+ "noUnusedParameters",
868
+ "useUnknownInCatchVariables",
869
+ /* Completeness */
870
+ "skipDefaultLibCheck",
871
+ "skipLibCheck"
872
+ ],
873
+ pathPattern: "^compilerOptions$"
687
874
  }
688
875
  ]
689
876
  }
690
- },
691
- {
692
- name: "ntnyq/js/script",
693
- files: ["**/scripts/*", "**/cli.*"],
694
- rules: {
695
- "no-console": "off"
696
- }
697
- },
698
- {
699
- name: "ntnyq/js/test",
700
- files: ["**/*.{test,spec}.js?(x)"],
701
- rules: {
702
- "no-unused-expressions": "off",
703
- "max-lines-per-function": "off"
704
- }
705
877
  }
706
- ]);
707
- var jsx = defineConfig([
878
+ ];
879
+ var sortI18nLocale = () => [
708
880
  {
709
- name: "ntnyq/jsx",
710
- files: ["**/*.jsx"],
711
- languageOptions: {
712
- parserOptions: {
713
- ecmaFeatures: {
714
- jsx: true
881
+ name: "ntnyq/sort/i18n-locale",
882
+ files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
883
+ rules: {
884
+ "jsonc/sort-keys": [
885
+ "error",
886
+ {
887
+ pathPattern: ".*",
888
+ order: { type: "asc" }
715
889
  }
716
- }
890
+ ]
717
891
  }
718
892
  }
719
- ]);
893
+ ];
720
894
 
721
- // src/configs/typescript.ts
722
- var typescriptCore = import_typescript_eslint.default.config({
723
- name: "ntnyq/ts/core",
724
- extends: [...import_typescript_eslint.default.configs.recommended],
725
- files: [GLOB_TS, GLOB_TSX],
726
- languageOptions: {
727
- parser: import_typescript_eslint.default.parser,
728
- parserOptions: {
729
- sourceType: "module"
730
- }
731
- },
732
- rules: {
733
- "@typescript-eslint/no-unused-vars": [
734
- "error",
735
- {
736
- // Args after the last used will be reported
737
- args: "after-used",
738
- argsIgnorePattern: "^_",
739
- caughtErrors: "all",
740
- caughtErrorsIgnorePattern: "^_",
741
- destructuredArrayIgnorePattern: "^_",
742
- varsIgnorePattern: "^_",
743
- ignoreRestSiblings: true
744
- }
745
- ],
746
- "@typescript-eslint/no-redeclare": "error",
747
- "@typescript-eslint/consistent-type-imports": [
748
- "error",
749
- {
750
- prefer: "type-imports",
751
- fixStyle: "separate-type-imports",
752
- disallowTypeAnnotations: false
753
- }
754
- ],
755
- "@typescript-eslint/no-empty-object-type": [
756
- "error",
757
- {
758
- allowInterfaces: "always",
759
- allowObjectTypes: "always"
760
- }
761
- ],
762
- "@typescript-eslint/consistent-type-assertions": [
763
- "error",
764
- {
765
- assertionStyle: "as",
766
- objectLiteralTypeAssertions: "allow-as-parameter"
767
- }
768
- ],
769
- "@typescript-eslint/prefer-as-const": "warn",
770
- "@typescript-eslint/ban-types": "off",
771
- "@typescript-eslint/camelcase": "off",
772
- "@typescript-eslint/no-namespace": "off",
773
- "@typescript-eslint/ban-ts-ignore": "off",
774
- "@typescript-eslint/ban-ts-comment": "off",
775
- "@typescript-eslint/no-explicit-any": "off",
776
- "@typescript-eslint/no-empty-function": "off",
777
- "@typescript-eslint/naming-convention": "off",
778
- "@typescript-eslint/no-non-null-assertion": "off",
779
- "@typescript-eslint/triple-slash-reference": "off",
780
- "@typescript-eslint/no-parameter-properties": "off",
781
- "@typescript-eslint/explicit-member-accessibility": "off",
782
- "@typescript-eslint/explicit-function-return-type": "off",
783
- "@typescript-eslint/explicit-module-boundary-types": "off",
784
- "@typescript-eslint/consistent-indexed-object-style": "off"
785
- }
786
- });
787
- var typescript = defineConfig([
788
- ...typescriptCore,
895
+ // src/configs/toml.ts
896
+ var toml = (options = {}) => [
789
897
  {
790
- name: "ntnyq/ts/dts",
791
- files: [GLOB_DTS],
898
+ name: "ntnyq/toml",
899
+ files: [GLOB_TOML],
900
+ languageOptions: {
901
+ parser: parserToml
902
+ },
903
+ plugins: {
904
+ toml: import_eslint_plugin_toml.default
905
+ },
792
906
  rules: {
793
- "no-use-before-define": "off",
794
- "no-restricted-syntax": "off",
795
- "import/no-duplicates": "off",
796
- "import/newline-after-import": "off"
907
+ "toml/comma-style": "error",
908
+ "toml/keys-order": "error",
909
+ "toml/no-space-dots": "error",
910
+ "toml/no-unreadable-number-separator": "error",
911
+ "toml/precision-of-fractional-seconds": "error",
912
+ "toml/precision-of-integer": "error",
913
+ "toml/tables-order": "error",
914
+ "toml/indent": ["error", 2],
915
+ "toml/vue-custom-block/no-parsing-error": "error",
916
+ "toml/array-bracket-newline": "error",
917
+ "toml/array-bracket-spacing": ["error", "never"],
918
+ "toml/array-element-newline": ["error", "never"],
919
+ "toml/inline-table-curly-spacing": "error",
920
+ "toml/key-spacing": "error",
921
+ "toml/padding-line-between-pairs": "error",
922
+ "toml/padding-line-between-tables": "error",
923
+ "toml/quoted-keys": "error",
924
+ "toml/spaced-comment": "error",
925
+ "toml/table-bracket-spacing": "error",
926
+ // Overrides built-in rules
927
+ ...options.overrides
797
928
  }
798
- },
929
+ }
930
+ ];
931
+
932
+ // src/configs/antfu.ts
933
+ var antfu = (options = {}) => [
799
934
  {
800
- name: "ntnyq/ts/test",
801
- files: ["**/*.{spec,test}.ts?(x)"],
935
+ name: "ntnyq/antfu",
936
+ plugins: {
937
+ antfu: import_eslint_plugin_antfu.default
938
+ },
802
939
  rules: {
803
- "no-unused-expressions": "off",
804
- "max-lines-per-function": "off"
940
+ // required `object-curly-newline` to be disabled
941
+ // 'antfu/consistent-list-newline': 'error',
942
+ "antfu/import-dedupe": "error",
943
+ "antfu/top-level-function": "error",
944
+ ...options.overrides
805
945
  }
806
- },
807
- {
808
- name: "ntnyq/ts/cjs",
809
- files: [GLOB_JS],
810
- rules: {}
811
946
  }
812
- ]);
947
+ ];
813
948
 
814
- // src/configs/unusedImports.ts
815
- var unusedImports = defineConfig([
949
+ // src/configs/jsdoc.ts
950
+ var jsdoc = (options = {}) => [
816
951
  {
817
- name: "ntnyq/unused-imports",
952
+ name: "ntnyq/jsdoc",
818
953
  plugins: {
819
- "unused-imports": import_eslint_plugin_unused_imports.default
954
+ jsdoc: import_eslint_plugin_jsdoc.default
820
955
  },
821
956
  rules: {
822
- "@typescript-eslint/no-unused-vars": "off",
823
- "unused-imports/no-unused-imports": "error",
824
- "unused-imports/no-unused-vars": [
825
- "warn",
826
- {
827
- vars: "all",
828
- varsIgnorePattern: "^_",
829
- args: "after-used",
830
- argsIgnorePattern: "^_"
831
- }
832
- ]
957
+ "jsdoc/check-access": "warn",
958
+ "jsdoc/check-param-names": "warn",
959
+ "jsdoc/check-property-names": "warn",
960
+ "jsdoc/check-types": "warn",
961
+ "jsdoc/empty-tags": "warn",
962
+ "jsdoc/implements-on-classes": "warn",
963
+ "jsdoc/no-defaults": "warn",
964
+ "jsdoc/no-multi-asterisks": "warn",
965
+ "jsdoc/require-param-name": "warn",
966
+ "jsdoc/require-property": "warn",
967
+ "jsdoc/require-property-description": "warn",
968
+ "jsdoc/require-property-name": "warn",
969
+ "jsdoc/require-returns-check": "warn",
970
+ "jsdoc/require-returns-description": "warn",
971
+ "jsdoc/require-yields-check": "warn",
972
+ "jsdoc/check-alignment": "warn",
973
+ "jsdoc/multiline-blocks": "warn",
974
+ // Overrides built-in rules
975
+ ...options.overrides
833
976
  }
834
977
  }
835
- ]);
978
+ ];
836
979
 
837
- // src/configs/perfectionist.ts
838
- var perfectionist = defineConfig([
980
+ // src/configs/jsonc.ts
981
+ var jsonc = (options = {}) => [
839
982
  {
840
- name: "ntnyq/perfectionist",
983
+ name: "ntnyq/jsonc",
984
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
841
985
  plugins: {
842
- perfectionist: import_eslint_plugin_perfectionist.default
986
+ jsonc: import_eslint_plugin_jsonc.default
987
+ },
988
+ languageOptions: {
989
+ parser: parserJsonc
843
990
  },
844
991
  rules: {
845
- "perfectionist/sort-imports": [
992
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
993
+ "jsonc/array-bracket-spacing": ["error", "never"],
994
+ "jsonc/comma-dangle": ["error", "never"],
995
+ "jsonc/comma-style": ["error", "last"],
996
+ "jsonc/indent": ["error", 2],
997
+ "jsonc/key-spacing": [
846
998
  "error",
847
999
  {
848
- groups: [
849
- "builtin",
850
- "external",
851
- "internal",
852
- "internal-type",
853
- "parent",
854
- "parent-type",
855
- "sibling",
856
- "sibling-type",
857
- "index",
858
- "index-type",
859
- "object",
860
- "type",
861
- "side-effect",
862
- "side-effect-style"
863
- ],
864
- internalPattern: ["~/**", "@/**", "#**"],
865
- newlinesBetween: "ignore"
1000
+ beforeColon: false,
1001
+ afterColon: true
1002
+ }
1003
+ ],
1004
+ "jsonc/no-octal-escape": "error",
1005
+ "jsonc/object-curly-newline": [
1006
+ "error",
1007
+ {
1008
+ multiline: true,
1009
+ consistent: true
1010
+ }
1011
+ ],
1012
+ "jsonc/object-curly-spacing": ["error", "always"],
1013
+ "jsonc/object-property-newline": [
1014
+ "error",
1015
+ {
1016
+ allowMultiplePropertiesPerLine: true
866
1017
  }
867
1018
  ],
868
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
869
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
1019
+ // Overrides built-in rules
1020
+ ...options.overrides
870
1021
  }
871
1022
  }
872
- ]);
1023
+ ];
873
1024
 
874
1025
  // src/configs/regexp.ts
875
- var regexp = defineConfig([
1026
+ var regexp = (options = {}) => [
876
1027
  /**
877
1028
  * https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
878
1029
  */
879
1030
  {
880
1031
  name: "ntnyq/regexp",
881
- ...pluginRegexp.configs["flat/recommended"]
1032
+ ...pluginRegexp.configs["flat/recommended"],
1033
+ // Overrides built-in rules
1034
+ ...options.overrides
882
1035
  }
883
- ]);
1036
+ ];
884
1037
 
885
1038
  // src/configs/unocss.ts
886
- var unocss = defineConfig([
1039
+ var unocss = (options = {}) => [
887
1040
  {
888
1041
  name: "ntnyq/unocss",
889
1042
  plugins: {
@@ -892,694 +1045,834 @@ var unocss = defineConfig([
892
1045
  rules: {
893
1046
  "unocss/order": "error",
894
1047
  // We don't use this
895
- "unocss/order-attributify": "off"
1048
+ "unocss/order-attributify": "off",
1049
+ // Overrides built-in rules
1050
+ ...options.overrides
896
1051
  }
897
1052
  }
898
- ]);
899
-
900
- // src/configs/command.ts
901
- var import_config = __toESM(require("eslint-plugin-command/config"), 1);
902
- var command = defineConfig([(0, import_config.default)()]);
1053
+ ];
903
1054
 
904
1055
  // src/configs/vitest.ts
905
- var vitest = defineConfig([
1056
+ var vitest = (options = {}) => [
906
1057
  {
907
- name: "ntnyq/test",
1058
+ name: "ntnyq/vitest",
908
1059
  plugins: {
909
1060
  vitest: import_eslint_plugin2.default
910
1061
  },
911
1062
  files: [GLOB_TEST],
912
1063
  rules: {
913
- ...import_eslint_plugin2.default.configs.recommended.rules
1064
+ ...import_eslint_plugin2.default.configs.recommended.rules,
1065
+ // Overrides built-in rules
1066
+ ...options.overrides
914
1067
  }
915
1068
  }
916
- ]);
1069
+ ];
917
1070
 
918
- // src/configs/vue.ts
919
- var import_node_process2 = __toESM(require("process"), 1);
920
- var import_local_pkg2 = require("local-pkg");
921
- function getVueVersion() {
922
- const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
923
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
924
- return +pkg.version[0];
925
- }
926
- return 3;
927
- }
928
- var isVue3 = getVueVersion() === 3;
929
- var vue2Rules = {
930
- ...import_eslint_plugin_vue.default.configs.base.rules,
931
- ...import_eslint_plugin_vue.default.configs.essential.rules,
932
- ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
933
- ...import_eslint_plugin_vue.default.configs.recommended.rules
934
- };
935
- var vue3Rules = {
936
- ...import_eslint_plugin_vue.default.configs.base.rules,
937
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
938
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
939
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
940
- };
941
- var vue = defineConfig([
942
- ...import_typescript_eslint.default.config({
943
- name: "ntnyq/vue/ts",
944
- files: [GLOB_VUE],
945
- // TODO: Remove this when `typescript-eslint` is aligned with `eslint`
946
- // @ts-expect-error - `typescript-eslint` is not aligned with eslint
947
- extends: typescriptCore
948
- }),
1071
+ // src/configs/command.ts
1072
+ var import_config = __toESM(require("eslint-plugin-command/config"), 1);
1073
+ var command = (options = {}) => [
949
1074
  {
950
- name: "ntnyq/vue/core",
951
- files: [GLOB_VUE],
952
- plugins: {
953
- vue: import_eslint_plugin_vue.default,
954
- "@typescript-eslint": import_typescript_eslint.default.plugin
955
- },
956
- languageOptions: {
957
- parser: parserVue,
958
- parserOptions: {
959
- parser: "@typescript-eslint/parser",
960
- sourceType: "module",
961
- extraFileExtensions: [".vue"],
962
- ecmaFeatures: {
963
- jsx: true
964
- }
965
- }
966
- },
967
- processor: import_eslint_plugin_vue.default.processors[".vue"],
968
- rules: {
969
- ...isVue3 ? vue3Rules : vue2Rules,
970
- // OFF
971
- "vue/no-v-html": "off",
972
- "vue/require-prop-types": "off",
973
- "vue/require-default-prop": "off",
974
- "vue/multi-word-component-names": "off",
975
- "vue/no-setup-props-reactivity-loss": "off",
976
- "vue/html-self-closing": [
977
- "error",
978
- {
979
- html: {
980
- void: "always",
981
- normal: "always",
982
- component: "always"
983
- },
984
- svg: "always",
985
- math: "always"
986
- }
987
- ],
988
- "vue/block-tag-newline": [
989
- "error",
990
- {
991
- singleline: "always",
992
- multiline: "always"
993
- }
994
- ],
995
- "vue/component-name-in-template-casing": [
996
- "error",
997
- "PascalCase",
998
- {
999
- // Force auto-import components to be PascalCase
1000
- registeredComponentsOnly: false,
1001
- ignores: ["slot", "component"]
1002
- }
1003
- ],
1004
- "vue/component-options-name-casing": ["error", "PascalCase"],
1005
- "vue/custom-event-name-casing": ["error", "camelCase"],
1006
- "vue/define-macros-order": [
1007
- "error",
1008
- {
1009
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
1010
- }
1011
- ],
1012
- "vue/html-comment-content-spacing": [
1013
- "error",
1014
- "always",
1015
- {
1016
- exceptions: ["-"]
1017
- }
1018
- ],
1019
- "vue/array-bracket-spacing": ["error", "never"],
1020
- "vue/arrow-spacing": ["error", { before: true, after: true }],
1021
- "vue/block-spacing": ["error", "always"],
1022
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1023
- "vue/comma-dangle": ["error", "always-multiline"],
1024
- "vue/comma-spacing": ["error", { before: false, after: true }],
1025
- "vue/comma-style": ["error", "last"],
1026
- "vue/dot-location": ["error", "property"],
1027
- "vue/dot-notation": ["error", { allowKeywords: true }],
1028
- "vue/eqeqeq": ["error", "smart"],
1029
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1030
- "vue/keyword-spacing": ["error", { before: true, after: true }],
1031
- "vue/no-empty-pattern": "error",
1032
- "vue/no-loss-of-precision": "error",
1033
- "vue/no-irregular-whitespace": "error",
1034
- "vue/no-use-v-else-with-v-for": "error",
1035
- "vue/require-typed-object-prop": "error",
1036
- "vue/no-extra-parens": ["error", "functions"],
1037
- "vue/no-restricted-syntax": [
1038
- "error",
1039
- "DebuggerStatement",
1040
- "LabeledStatement",
1041
- "WithStatement"
1042
- ],
1043
- "vue/no-sparse-arrays": "error",
1044
- "vue/no-deprecated-model-definition": [
1045
- "error",
1046
- {
1047
- allowVue3Compat: true
1048
- }
1049
- ],
1050
- "vue/object-curly-newline": [
1051
- "error",
1052
- {
1053
- multiline: true,
1054
- consistent: true
1055
- }
1056
- ],
1057
- "vue/no-static-inline-styles": [
1058
- "error",
1059
- {
1060
- allowBinding: true
1061
- }
1062
- ],
1063
- "vue/object-curly-spacing": ["error", "always"],
1064
- "vue/object-property-newline": [
1065
- "error",
1066
- {
1067
- allowMultiplePropertiesPerLine: true
1068
- }
1069
- ],
1070
- "vue/object-shorthand": [
1071
- "error",
1072
- "always",
1073
- {
1074
- ignoreConstructors: false,
1075
- avoidQuotes: true
1076
- }
1077
- ],
1078
- "vue/operator-linebreak": ["error", "before"],
1079
- "vue/prefer-template": "error",
1080
- "vue/prop-name-casing": ["error", "camelCase"],
1081
- "vue/quote-props": ["error", "consistent-as-needed"],
1082
- "vue/space-in-parens": ["error", "never"],
1083
- "vue/space-infix-ops": "error",
1084
- "vue/space-unary-ops": [
1085
- "error",
1086
- {
1087
- words: true,
1088
- nonwords: false
1089
- }
1090
- ],
1091
- "vue/template-curly-spacing": "error",
1092
- "vue/block-order": [
1093
- "error",
1094
- {
1095
- order: ["script", "template", "style"]
1096
- }
1097
- ],
1098
- "vue/attributes-order": [
1099
- "error",
1100
- {
1101
- order: [
1102
- "EVENTS",
1103
- // `@click="functionCall"`, `v-on="event"`
1104
- "TWO_WAY_BINDING",
1105
- // `v-model`
1106
- "OTHER_DIRECTIVES",
1107
- // `v-custom-directive`
1108
- "LIST_RENDERING",
1109
- // `v-for item in items`
1110
- "CONDITIONALS",
1111
- // `v-if`, `v-show`, `v-cloak`
1112
- "CONTENT",
1113
- // `v-text`, `v-html`
1114
- "SLOT",
1115
- // `v-slot`, `slot`
1116
- "UNIQUE",
1117
- // `ref`, `key`
1118
- "DEFINITION",
1119
- // `is`, `v-is`
1120
- "ATTR_DYNAMIC",
1121
- // `v-bind:prop="foo"`, `:prop="foo"`
1122
- // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
1123
- "RENDER_MODIFIERS",
1124
- // `v-once`, `v-pre`
1125
- "GLOBAL",
1126
- // `id`
1127
- "ATTR_STATIC",
1128
- // `prop="foo", `static attributes
1129
- "ATTR_SHORTHAND_BOOL"
1130
- // `disabled`, prop shorthand
1131
- ],
1132
- alphabetical: false
1133
- }
1134
- ],
1135
- "vue/order-in-components": [
1075
+ ...(0, import_config.default)(options),
1076
+ name: "ntnyq/command"
1077
+ }
1078
+ ];
1079
+
1080
+ // src/configs/ignores.ts
1081
+ var ignores = (customIgnores = []) => [
1082
+ {
1083
+ name: "ntnyq/ignores",
1084
+ ignores: [
1085
+ ...GLOB_EXCLUDE,
1086
+ // Overrides built-in ignores
1087
+ ...customIgnores
1088
+ ]
1089
+ }
1090
+ ];
1091
+
1092
+ // src/configs/imports.ts
1093
+ var imports = (options = {}) => [
1094
+ {
1095
+ name: "ntnyq/imports",
1096
+ plugins: {
1097
+ import: import_eslint_plugin_import_x.default
1098
+ },
1099
+ settings: {
1100
+ "import/resolver": {
1101
+ node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
1102
+ }
1103
+ },
1104
+ rules: {
1105
+ "import/no-unresolved": "off",
1106
+ "import/no-absolute-path": "off",
1107
+ "import/no-named-as-default-member": "off",
1108
+ "import/no-named-default": "off",
1109
+ // disabled in favor or `perfectionist/sort-imports`
1110
+ "import/order": "off",
1111
+ "import/first": "error",
1112
+ "import/export": "error",
1113
+ "import/no-self-import": "error",
1114
+ "import/no-duplicates": "error",
1115
+ "import/no-mutable-exports": "error",
1116
+ "import/newline-after-import": "error",
1117
+ // Overrides built-in rules
1118
+ ...options.overrides
1119
+ }
1120
+ }
1121
+ ];
1122
+
1123
+ // src/configs/unicorn.ts
1124
+ var unicorn = (options = {}) => [
1125
+ {
1126
+ name: "ntnyq/unicorn",
1127
+ plugins: {
1128
+ unicorn: import_eslint_plugin_unicorn.default
1129
+ },
1130
+ rules: {
1131
+ // Disabled for now
1132
+ "unicorn/better-regex": "off",
1133
+ "unicorn/prefer-top-level-await": "off",
1134
+ "unicorn/explicit-length-check": "off",
1135
+ "unicorn/no-array-callback-reference": "off",
1136
+ "unicorn/error-message": "error",
1137
+ "unicorn/escape-case": "error",
1138
+ "unicorn/no-new-buffer": "error",
1139
+ "unicorn/number-literal-case": "error",
1140
+ "unicorn/prefer-includes": "error",
1141
+ "unicorn/prefer-type-error": "error",
1142
+ "unicorn/throw-new-error": "error",
1143
+ "unicorn/no-unnecessary-await": "error",
1144
+ "unicorn/switch-case-braces": ["error", "avoid"],
1145
+ "unicorn/no-typeof-undefined": "error",
1146
+ "unicorn/prefer-set-size": "error",
1147
+ "unicorn/prefer-regexp-test": "error",
1148
+ "unicorn/no-static-only-class": "error",
1149
+ "unicorn/no-zero-fractions": "error",
1150
+ "unicorn/custom-error-definition": "error",
1151
+ "unicorn/prefer-modern-math-apis": "error",
1152
+ "unicorn/new-for-builtins": "error",
1153
+ "unicorn/no-console-spaces": "error",
1154
+ "unicorn/no-for-loop": "error",
1155
+ "unicorn/no-hex-escape": "error",
1156
+ "unicorn/no-lonely-if": "error",
1157
+ "unicorn/prefer-keyboard-event-key": "error",
1158
+ "unicorn/prefer-math-trunc": "error",
1159
+ "unicorn/prefer-negative-index": "error",
1160
+ "unicorn/prefer-node-protocol": "error",
1161
+ "unicorn/prefer-number-properties": "error",
1162
+ "unicorn/prefer-optional-catch-binding": "error",
1163
+ "unicorn/prefer-prototype-methods": "error",
1164
+ "unicorn/prefer-reflect-apply": "error",
1165
+ "unicorn/catch-error-name": [
1136
1166
  "error",
1137
1167
  {
1138
- order: [
1139
- "el",
1140
- "name",
1141
- "key",
1142
- "parent",
1143
- "functional",
1144
- ["provide", "inject"],
1145
- ["delimiters", "comments"],
1146
- ["components", "directives", "filters"],
1147
- "extends",
1148
- "mixins",
1149
- "layout",
1150
- "middleware",
1151
- "validate",
1152
- "scrollToTop",
1153
- "transition",
1154
- "loading",
1155
- "inheritAttrs",
1156
- "model",
1157
- ["props", "propsData"],
1158
- "emits",
1159
- "setup",
1160
- "asyncData",
1161
- "computed",
1162
- "data",
1163
- "fetch",
1164
- "head",
1165
- "methods",
1166
- ["template", "render"],
1167
- "watch",
1168
- "watchQuery",
1169
- "LIFECYCLE_HOOKS",
1170
- "renderError",
1171
- "ROUTER_GUARDS"
1172
- ]
1168
+ name: "err",
1169
+ ignore: ["^_."]
1173
1170
  }
1174
1171
  ],
1175
- "vue/max-attributes-per-line": [
1176
- "error",
1177
- {
1178
- singleline: 1,
1179
- multiline: 1
1180
- }
1181
- ]
1172
+ "unicorn/prefer-date-now": "error",
1173
+ // String
1174
+ "unicorn/prefer-string-slice": "error",
1175
+ "unicorn/prefer-string-trim-start-end": "error",
1176
+ "unicorn/prefer-string-starts-ends-with": "error",
1177
+ // DOM
1178
+ "unicorn/prefer-add-event-listener": "error",
1179
+ "unicorn/no-invalid-remove-event-listener": "error",
1180
+ "unicorn/prefer-query-selector": "error",
1181
+ "unicorn/prefer-modern-dom-apis": "error",
1182
+ "unicorn/prefer-dom-node-append": "error",
1183
+ "unicorn/prefer-dom-node-dataset": "error",
1184
+ "unicorn/prefer-dom-node-remove": "error",
1185
+ "unicorn/prefer-dom-node-text-content": "error",
1186
+ // Array
1187
+ "unicorn/no-new-array": "error",
1188
+ "unicorn/no-instanceof-array": "error",
1189
+ "unicorn/no-array-push-push": "error",
1190
+ "unicorn/no-array-method-this-argument": "error",
1191
+ "unicorn/prefer-array-find": "error",
1192
+ "unicorn/prefer-array-some": "error",
1193
+ "unicorn/prefer-array-flat-map": "error",
1194
+ "unicorn/prefer-array-index-of": "error",
1195
+ // Overrides built-in rules
1196
+ ...options.overrides
1182
1197
  }
1183
1198
  }
1184
- ]);
1199
+ ];
1185
1200
 
1186
- // src/configs/yml.ts
1187
- var yml = defineConfig([
1201
+ // src/configs/comments.ts
1202
+ var comments = (options = {}) => [
1188
1203
  {
1189
- name: "ntnyq/yaml",
1190
- files: [GLOB_YAML],
1191
- languageOptions: {
1192
- parser: parserYaml
1193
- },
1204
+ name: "ntnyq/eslint-comments",
1194
1205
  plugins: {
1195
- yml: import_eslint_plugin_yml.default
1206
+ "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
1196
1207
  },
1197
1208
  rules: {
1198
- ...import_eslint_plugin_yml.default.configs.standard.rules,
1199
- ...import_eslint_plugin_yml.default.configs.prettier.rules,
1200
- "yml/no-empty-mapping-value": "off",
1201
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
1209
+ ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
1210
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1211
+ // Overrides built-in rules
1212
+ ...options.overrides
1202
1213
  }
1203
1214
  }
1204
- ]);
1215
+ ];
1205
1216
 
1206
- // src/configs/toml.ts
1207
- var toml = defineConfig([
1217
+ // src/configs/markdown.ts
1218
+ var markdown = (options = {}) => {
1219
+ if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
1220
+ return [
1221
+ ...import_markdown.default.configs.processor.map((config) => ({
1222
+ ...config,
1223
+ name: `ntnyq/${config.name}`
1224
+ })),
1225
+ {
1226
+ name: "ntnyq/markdown/disabled/code-blocks",
1227
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1228
+ rules: {
1229
+ "no-undef": "off",
1230
+ "no-alert": "off",
1231
+ "no-console": "off",
1232
+ "no-unused-vars": "off",
1233
+ "no-unused-expressions": "off",
1234
+ "no-restricted-imports": "off",
1235
+ "node/prefer-global/buffer": "off",
1236
+ "node/prefer-global/process": "off",
1237
+ "import/no-unresolved": "off",
1238
+ "unused-imports/no-unused-imports": "off",
1239
+ "unused-imports/no-unused-vars": "off",
1240
+ "@typescript-eslint/comma-dangle": "off",
1241
+ "@typescript-eslint/no-redeclare": "off",
1242
+ "@typescript-eslint/no-namespace": "off",
1243
+ "@typescript-eslint/no-unused-vars": "off",
1244
+ "@typescript-eslint/no-require-imports": "off",
1245
+ "@typescript-eslint/no-extraneous-class": "off",
1246
+ "@typescript-eslint/no-use-before-define": "off",
1247
+ "@typescript-eslint/no-unused-expressions": "off",
1248
+ "@typescript-eslint/consistent-type-imports": "off",
1249
+ // Overrides built-in rules
1250
+ ...options.overrides
1251
+ }
1252
+ }
1253
+ ];
1254
+ };
1255
+
1256
+ // src/configs/prettier.ts
1257
+ var prettier = (options = {}) => [
1208
1258
  {
1209
- name: "ntnyq/toml",
1210
- files: [GLOB_TOML],
1211
- languageOptions: {
1212
- parser: parserToml
1213
- },
1259
+ name: "ntnyq/prettier",
1214
1260
  plugins: {
1215
- toml: import_eslint_plugin_toml.default
1261
+ prettier: import_eslint_plugin_prettier.default
1216
1262
  },
1217
1263
  rules: {
1218
- "toml/comma-style": "error",
1219
- "toml/keys-order": "error",
1220
- "toml/no-space-dots": "error",
1221
- "toml/no-unreadable-number-separator": "error",
1222
- "toml/precision-of-fractional-seconds": "error",
1223
- "toml/precision-of-integer": "error",
1224
- "toml/tables-order": "error",
1225
- "toml/indent": ["error", 2],
1226
- "toml/vue-custom-block/no-parsing-error": "error",
1227
- "toml/array-bracket-newline": "error",
1228
- "toml/array-bracket-spacing": ["error", "never"],
1229
- "toml/array-element-newline": ["error", "never"],
1230
- "toml/inline-table-curly-spacing": "error",
1231
- "toml/key-spacing": "error",
1232
- "toml/padding-line-between-pairs": "error",
1233
- "toml/padding-line-between-tables": "error",
1234
- "toml/quoted-keys": "error",
1235
- "toml/spaced-comment": "error",
1236
- "toml/table-bracket-spacing": "error"
1264
+ "vue/array-bracket-newline": "off",
1265
+ "vue/array-bracket-spacing": "off",
1266
+ "vue/array-element-newline": "off",
1267
+ "vue/arrow-spacing": "off",
1268
+ "vue/block-spacing": "off",
1269
+ "vue/block-tag-newline": "off",
1270
+ "vue/brace-style": "off",
1271
+ "vue/comma-dangle": "off",
1272
+ "vue/comma-spacing": "off",
1273
+ "vue/comma-style": "off",
1274
+ "vue/dot-location": "off",
1275
+ "vue/func-call-spacing": "off",
1276
+ "vue/html-closing-bracket-newline": "off",
1277
+ "vue/html-closing-bracket-spacing": "off",
1278
+ "vue/html-end-tags": "off",
1279
+ "vue/html-indent": "off",
1280
+ "vue/html-quotes": "off",
1281
+ "vue/key-spacing": "off",
1282
+ "vue/keyword-spacing": "off",
1283
+ "vue/max-attributes-per-line": "off",
1284
+ "vue/multiline-html-element-content-newline": "off",
1285
+ "vue/multiline-ternary": "off",
1286
+ "vue/mustache-interpolation-spacing": "off",
1287
+ "vue/no-extra-parens": "off",
1288
+ "vue/no-multi-spaces": "off",
1289
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
1290
+ "vue/object-curly-newline": "off",
1291
+ "vue/object-curly-spacing": "off",
1292
+ "vue/object-property-newline": "off",
1293
+ "vue/operator-linebreak": "off",
1294
+ "vue/quote-props": "off",
1295
+ "vue/script-indent": "off",
1296
+ "vue/singleline-html-element-content-newline": "off",
1297
+ "vue/space-in-parens": "off",
1298
+ "vue/space-infix-ops": "off",
1299
+ "vue/space-unary-ops": "off",
1300
+ "vue/template-curly-spacing": "off",
1301
+ ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1302
+ "prettier/prettier": options.level || "warn",
1303
+ // Overrides built-in rules
1304
+ ...options.overrides
1237
1305
  }
1238
- }
1239
- ]);
1240
-
1241
- // src/configs/sort.ts
1242
- var sortPackageJson = defineConfig([
1306
+ },
1307
+ /**
1308
+ * Languages that prettier currently does not support
1309
+ */
1243
1310
  {
1244
- name: "ntnyq/sort/package-json",
1245
- files: ["**/package.json"],
1311
+ name: "ntnyq/prettier/disabled",
1312
+ files: [GLOB_TOML],
1313
+ plugins: {
1314
+ prettier: import_eslint_plugin_prettier.default
1315
+ },
1246
1316
  rules: {
1247
- "jsonc/sort-keys": [
1248
- "error",
1249
- {
1250
- pathPattern: "^$",
1251
- order: [
1252
- "publisher",
1253
- "name",
1254
- "displayName",
1255
- "type",
1256
- "version",
1257
- "private",
1258
- "packageManager",
1259
- "description",
1260
- "keywords",
1261
- "license",
1262
- "author",
1263
- "homepage",
1264
- "repository",
1265
- "funding",
1266
- "exports",
1267
- "main",
1268
- "module",
1269
- "unpkg",
1270
- "jsdelivr",
1271
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
1272
- "types",
1273
- "typesVersions",
1274
- "bin",
1275
- "icon",
1276
- "files",
1277
- "sideEffects",
1278
- "scripts",
1279
- "peerDependencies",
1280
- "peerDependenciesMeta",
1281
- "dependencies",
1282
- "optionalDependencies",
1283
- "devDependencies",
1284
- "activationEvents",
1285
- "contributes",
1286
- "categories",
1287
- "engines",
1288
- "pnpm",
1289
- "overrides",
1290
- "resolutions",
1291
- "husky",
1292
- "prettier",
1293
- "nano-staged",
1294
- "lint-staged",
1295
- "eslintConfig"
1296
- ]
1297
- },
1298
- {
1299
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1300
- order: { type: "asc" }
1301
- },
1302
- {
1303
- order: { type: "asc" },
1304
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1305
- },
1306
- {
1307
- pathPattern: "^exports.*$",
1308
- order: ["types", "import", "require", "default"]
1309
- },
1310
- {
1311
- pathPattern: "^scripts$",
1312
- order: { type: "asc" }
1313
- },
1314
- {
1315
- order: [
1316
- // client hooks only
1317
- "pre-commit",
1318
- "prepare-commit-msg",
1319
- "commit-msg",
1320
- "post-commit",
1321
- "pre-rebase",
1322
- "post-rewrite",
1323
- "post-checkout",
1324
- "post-merge",
1325
- "pre-push",
1326
- "pre-auto-gc"
1327
- ],
1328
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1329
- }
1330
- ],
1331
- "jsonc/sort-array-values": [
1332
- "error",
1333
- {
1334
- pathPattern: "^files$",
1335
- order: { type: "asc" }
1336
- }
1337
- ]
1317
+ "prettier/prettier": "off"
1338
1318
  }
1339
1319
  }
1340
- ]);
1341
- var sortTsConfig = defineConfig([
1320
+ ];
1321
+
1322
+ // src/configs/gitignore.ts
1323
+ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
1324
+ var gitignore = (options = {}) => [
1342
1325
  {
1343
- name: "ntnyq/sort/tsconfig",
1344
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1345
- rules: {
1346
- "jsonc/sort-keys": [
1347
- "error",
1348
- {
1349
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1350
- pathPattern: "^$"
1326
+ ...(0, import_eslint_config_flat_gitignore.default)(options),
1327
+ name: "ntnyq/gitignore"
1328
+ }
1329
+ ];
1330
+
1331
+ // src/configs/javascript.ts
1332
+ var import_js = __toESM(require("@eslint/js"), 1);
1333
+ var import_globals = __toESM(require("globals"), 1);
1334
+ var javascript = (options = {}) => {
1335
+ const strictRules = {
1336
+ complexity: ["error", { max: 30 }],
1337
+ "max-params": ["error", { max: 5 }],
1338
+ "max-depth": ["error", { max: 5 }],
1339
+ "max-nested-callbacks": ["error", { max: 10 }],
1340
+ "max-lines": [
1341
+ "error",
1342
+ {
1343
+ max: 1e3,
1344
+ skipComments: true,
1345
+ skipBlankLines: true
1346
+ }
1347
+ ],
1348
+ "max-lines-per-function": [
1349
+ "error",
1350
+ {
1351
+ max: 200,
1352
+ skipComments: true,
1353
+ skipBlankLines: true
1354
+ }
1355
+ ]
1356
+ };
1357
+ return [
1358
+ {
1359
+ ...import_js.default.configs.recommended,
1360
+ name: "ntnyq/js/recommended"
1361
+ },
1362
+ {
1363
+ name: "ntnyq/js/core",
1364
+ languageOptions: {
1365
+ globals: {
1366
+ ...import_globals.default.browser,
1367
+ ...import_globals.default.es2021,
1368
+ ...import_globals.default.node
1351
1369
  },
1352
- {
1353
- order: [
1354
- /* Projects */
1355
- "incremental",
1356
- "composite",
1357
- "tsBuildInfoFile",
1358
- "disableSourceOfProjectReferenceRedirect",
1359
- "disableSolutionSearching",
1360
- "disableReferencedProjectLoad",
1361
- /* Language and Environment */
1362
- "target",
1363
- "lib",
1364
- "jsx",
1365
- "experimentalDecorators",
1366
- "emitDecoratorMetadata",
1367
- "jsxFactory",
1368
- "jsxFragmentFactory",
1369
- "jsxImportSource",
1370
- "reactNamespace",
1371
- "noLib",
1372
- "useDefineForClassFields",
1373
- "moduleDetection",
1374
- /* Modules */
1375
- "module",
1376
- "rootDir",
1377
- "moduleResolution",
1378
- "baseUrl",
1379
- "paths",
1380
- "rootDirs",
1381
- "typeRoots",
1382
- "types",
1383
- "allowUmdGlobalAccess",
1384
- "moduleSuffixes",
1385
- "allowImportingTsExtensions",
1386
- "resolvePackageJsonExports",
1387
- "resolvePackageJsonImports",
1388
- "customConditions",
1389
- "resolveJsonModule",
1390
- "allowArbitraryExtensions",
1391
- "noResolve",
1392
- /* JavaScript Support */
1393
- "allowJs",
1394
- "checkJs",
1395
- "maxNodeModuleJsDepth",
1396
- /* Emit */
1397
- "declaration",
1398
- "declarationMap",
1399
- "emitDeclarationOnly",
1400
- "sourceMap",
1401
- "inlineSourceMap",
1402
- "outFile",
1403
- "outDir",
1404
- "removeComments",
1405
- "noEmit",
1406
- "importHelpers",
1407
- "importsNotUsedAsValues",
1408
- "downlevelIteration",
1409
- "sourceRoot",
1410
- "mapRoot",
1411
- "inlineSources",
1412
- "emitBOM",
1413
- "newLine",
1414
- "stripInternal",
1415
- "noEmitHelpers",
1416
- "noEmitOnError",
1417
- "preserveConstEnums",
1418
- "declarationDir",
1419
- "preserveValueImports",
1420
- /* Interop Constraints */
1421
- "isolatedModules",
1422
- "verbatimModuleSyntax",
1423
- "allowSyntheticDefaultImports",
1424
- "esModuleInterop",
1425
- "preserveSymlinks",
1426
- "forceConsistentCasingInFileNames",
1427
- /* Type Checking */
1428
- "strict",
1429
- "strictBindCallApply",
1430
- "strictFunctionTypes",
1431
- "strictNullChecks",
1432
- "strictPropertyInitialization",
1433
- "allowUnreachableCode",
1434
- "allowUnusedLabels",
1435
- "alwaysStrict",
1436
- "exactOptionalPropertyTypes",
1437
- "noFallthroughCasesInSwitch",
1438
- "noImplicitAny",
1439
- "noImplicitOverride",
1440
- "noImplicitReturns",
1441
- "noImplicitThis",
1442
- "noPropertyAccessFromIndexSignature",
1443
- "noUncheckedIndexedAccess",
1444
- "noUnusedLocals",
1445
- "noUnusedParameters",
1446
- "useUnknownInCatchVariables",
1447
- /* Completeness */
1448
- "skipDefaultLibCheck",
1449
- "skipLibCheck"
1450
- ],
1451
- pathPattern: "^compilerOptions$"
1370
+ sourceType: "module"
1371
+ },
1372
+ rules: {
1373
+ "require-await": "off",
1374
+ "no-return-assign": "off",
1375
+ "no-useless-escape": "off",
1376
+ "consistent-return": "off",
1377
+ // disabled in favor of `perfectionist/sort-named-imports`
1378
+ "sort-imports": "off",
1379
+ // standard v17.0.0
1380
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1381
+ camelcase: [
1382
+ "error",
1383
+ {
1384
+ allow: ["^UNSAFE_"],
1385
+ properties: "never",
1386
+ ignoreGlobals: true
1387
+ }
1388
+ ],
1389
+ "constructor-super": "error",
1390
+ curly: ["error", "multi-line"],
1391
+ "default-case-last": "error",
1392
+ "dot-notation": ["error", { allowKeywords: true }],
1393
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
1394
+ "no-array-constructor": "error",
1395
+ "no-async-promise-executor": "error",
1396
+ "no-caller": "error",
1397
+ "no-class-assign": "error",
1398
+ "no-compare-neg-zero": "error",
1399
+ "no-cond-assign": "error",
1400
+ "no-const-assign": "error",
1401
+ "no-constant-condition": ["error", { checkLoops: false }],
1402
+ "no-control-regex": "error",
1403
+ "no-debugger": "error",
1404
+ "no-delete-var": "error",
1405
+ "no-dupe-args": "error",
1406
+ "no-dupe-class-members": "error",
1407
+ "no-dupe-keys": "error",
1408
+ "no-duplicate-case": "error",
1409
+ "no-useless-backreference": "error",
1410
+ "no-empty": ["error", { allowEmptyCatch: true }],
1411
+ "no-empty-character-class": "error",
1412
+ "no-empty-pattern": "error",
1413
+ "no-eval": "error",
1414
+ "no-ex-assign": "error",
1415
+ "no-extend-native": "error",
1416
+ "no-extra-bind": "error",
1417
+ "no-extra-boolean-cast": "error",
1418
+ "no-fallthrough": "error",
1419
+ "no-func-assign": "error",
1420
+ "no-global-assign": "error",
1421
+ "no-implied-eval": "error",
1422
+ "no-import-assign": "error",
1423
+ "no-invalid-regexp": "error",
1424
+ "no-irregular-whitespace": "error",
1425
+ "no-iterator": "error",
1426
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
1427
+ "no-lone-blocks": "error",
1428
+ "no-loss-of-precision": "error",
1429
+ "no-misleading-character-class": "error",
1430
+ "no-prototype-builtins": "error",
1431
+ "no-useless-catch": "error",
1432
+ "no-new": "error",
1433
+ "no-new-func": "error",
1434
+ "no-new-wrappers": "error",
1435
+ "no-obj-calls": "error",
1436
+ "no-octal": "error",
1437
+ "no-octal-escape": "error",
1438
+ "no-proto": "error",
1439
+ "no-redeclare": ["error", { builtinGlobals: false }],
1440
+ "no-regex-spaces": "error",
1441
+ "no-self-assign": ["error", { props: true }],
1442
+ "no-self-compare": "error",
1443
+ "no-sequences": "error",
1444
+ "no-shadow-restricted-names": "error",
1445
+ "no-sparse-arrays": "error",
1446
+ "no-template-curly-in-string": "error",
1447
+ "no-this-before-super": "error",
1448
+ "no-throw-literal": "error",
1449
+ "no-undef": "error",
1450
+ "no-undef-init": "error",
1451
+ "no-unexpected-multiline": "error",
1452
+ "no-unmodified-loop-condition": "error",
1453
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1454
+ "no-unreachable": "error",
1455
+ "no-unreachable-loop": "error",
1456
+ "no-unsafe-finally": "error",
1457
+ "no-unsafe-negation": "error",
1458
+ "no-unused-expressions": [
1459
+ "error",
1460
+ {
1461
+ allowShortCircuit: true,
1462
+ allowTernary: true,
1463
+ allowTaggedTemplates: true
1464
+ }
1465
+ ],
1466
+ "no-unused-vars": [
1467
+ "error",
1468
+ {
1469
+ args: "none",
1470
+ caughtErrors: "none",
1471
+ ignoreRestSiblings: true,
1472
+ vars: "all"
1473
+ }
1474
+ ],
1475
+ "no-useless-call": "error",
1476
+ "no-useless-computed-key": "error",
1477
+ "no-useless-constructor": "error",
1478
+ "no-useless-rename": "error",
1479
+ "no-useless-return": "error",
1480
+ "prefer-promise-reject-errors": "error",
1481
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1482
+ "symbol-description": "error",
1483
+ "unicode-bom": ["error", "never"],
1484
+ "use-isnan": [
1485
+ "error",
1486
+ {
1487
+ enforceForSwitchCase: true,
1488
+ enforceForIndexOf: true
1489
+ }
1490
+ ],
1491
+ "valid-typeof": ["error", { requireStringLiterals: true }],
1492
+ yoda: ["error", "never"],
1493
+ // es6+
1494
+ "no-var": "error",
1495
+ "prefer-rest-params": "error",
1496
+ "prefer-spread": "error",
1497
+ "prefer-template": "error",
1498
+ "no-empty-static-block": "error",
1499
+ "no-new-native-nonconstructor": "error",
1500
+ "prefer-const": [
1501
+ "error",
1502
+ {
1503
+ destructuring: "all",
1504
+ ignoreReadBeforeAssign: true
1505
+ }
1506
+ ],
1507
+ "prefer-arrow-callback": [
1508
+ "error",
1509
+ {
1510
+ allowNamedFunctions: false,
1511
+ allowUnboundThis: true
1512
+ }
1513
+ ],
1514
+ "object-shorthand": [
1515
+ "error",
1516
+ "always",
1517
+ {
1518
+ ignoreConstructors: false,
1519
+ avoidQuotes: true
1520
+ }
1521
+ ],
1522
+ // best-practice
1523
+ eqeqeq: ["error", "smart"],
1524
+ "array-callback-return": "error",
1525
+ "block-scoped-var": "error",
1526
+ "no-alert": "error",
1527
+ "no-case-declarations": "error",
1528
+ "no-multi-str": "error",
1529
+ "no-with": "error",
1530
+ "no-void": "error",
1531
+ "vars-on-top": "error",
1532
+ "one-var": ["error", "never"],
1533
+ "no-use-before-define": [
1534
+ "error",
1535
+ {
1536
+ functions: false,
1537
+ classes: false,
1538
+ variables: true
1539
+ }
1540
+ ],
1541
+ // Strict rules
1542
+ ...options.strict ? strictRules : {},
1543
+ // Overrides built-in rules
1544
+ ...options.overrides
1545
+ }
1546
+ },
1547
+ {
1548
+ name: "ntnyq/js/scripts",
1549
+ files: ["**/scripts/*", "**/cli.*"],
1550
+ rules: {
1551
+ "no-console": "off"
1552
+ }
1553
+ },
1554
+ {
1555
+ name: "ntnyq/js/test",
1556
+ files: ["**/*.{test,spec}.js?(x)"],
1557
+ rules: {
1558
+ "no-unused-expressions": "off",
1559
+ "max-lines-per-function": "off"
1560
+ }
1561
+ }
1562
+ ];
1563
+ };
1564
+ var jsx = () => [
1565
+ {
1566
+ name: "ntnyq/jsx",
1567
+ files: ["**/*.jsx"],
1568
+ languageOptions: {
1569
+ parserOptions: {
1570
+ ecmaFeatures: {
1571
+ jsx: true
1452
1572
  }
1453
- ]
1573
+ }
1454
1574
  }
1455
1575
  }
1456
- ]);
1576
+ ];
1457
1577
 
1458
- // src/configs/jsonc.ts
1459
- var jsonc = defineConfig([
1578
+ // src/configs/perfectionist.ts
1579
+ var perfectionist = (options = {}) => [
1460
1580
  {
1461
- name: "ntnyq/jsonc",
1462
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1581
+ name: "ntnyq/perfectionist",
1463
1582
  plugins: {
1464
- jsonc: import_eslint_plugin_jsonc.default
1465
- },
1466
- languageOptions: {
1467
- parser: parserJsonc
1583
+ perfectionist: import_eslint_plugin_perfectionist.default
1468
1584
  },
1469
1585
  rules: {
1470
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
1471
- "jsonc/array-bracket-spacing": ["error", "never"],
1472
- "jsonc/comma-dangle": ["error", "never"],
1473
- "jsonc/comma-style": ["error", "last"],
1474
- "jsonc/indent": ["error", 2],
1475
- "jsonc/key-spacing": [
1586
+ "perfectionist/sort-imports": [
1476
1587
  "error",
1477
1588
  {
1478
- beforeColon: false,
1479
- afterColon: true
1589
+ groups: [
1590
+ // Side effect style imports (e.g. 'normalize.css')
1591
+ "side-effect-style",
1592
+ // Styles (e.g. *.{css,scss,less})
1593
+ "style",
1594
+ // Node.js built-in modules. (e.g. fs, path)
1595
+ "builtin",
1596
+ // External modules installed in the project (e.g. vue, lodash)
1597
+ "external",
1598
+ // Internal modules (e.g. @/utils, @/components)
1599
+ "internal",
1600
+ // Modules from parent directory (e.g. ../utils)
1601
+ "parent",
1602
+ // Modules from the same directory (e.g. ./utils)
1603
+ "sibling",
1604
+ // Main file from the current directory (e.g. ./index)
1605
+ "index",
1606
+ // TypeScript object-imports (e.g. import log = console.log)
1607
+ "object",
1608
+ // Side effect imports (e.g. import 'babel-polyfill')
1609
+ "side-effect",
1610
+ /**
1611
+ * Type import at the end
1612
+ */
1613
+ "builtin-type",
1614
+ "external-type",
1615
+ "internal-type",
1616
+ "parent-type",
1617
+ "sibling-type",
1618
+ "index-type",
1619
+ "type",
1620
+ /**
1621
+ * Imports that don’t fit into any other group
1622
+ */
1623
+ "unknown"
1624
+ ],
1625
+ order: "asc",
1626
+ type: "natural",
1627
+ ignoreCase: true,
1628
+ internalPattern: ["~/**", "@/**", "#**"],
1629
+ newlinesBetween: "ignore"
1480
1630
  }
1481
1631
  ],
1482
- "jsonc/no-octal-escape": "error",
1483
- "jsonc/object-curly-newline": [
1632
+ "perfectionist/sort-exports": [
1484
1633
  "error",
1485
1634
  {
1486
- multiline: true,
1487
- consistent: true
1635
+ order: "asc",
1636
+ type: "line-length"
1488
1637
  }
1489
1638
  ],
1490
- "jsonc/object-curly-spacing": ["error", "always"],
1491
- "jsonc/object-property-newline": [
1639
+ "perfectionist/sort-named-exports": [
1492
1640
  "error",
1493
1641
  {
1494
- allowMultiplePropertiesPerLine: true
1642
+ type: "alphabetical",
1643
+ order: "asc",
1644
+ ignoreCase: true,
1645
+ groupKind: "values-first"
1495
1646
  }
1496
- ]
1647
+ ],
1648
+ "perfectionist/sort-named-imports": [
1649
+ "error",
1650
+ {
1651
+ type: "alphabetical",
1652
+ order: "asc",
1653
+ ignoreCase: true,
1654
+ ignoreAlias: false,
1655
+ groupKind: "values-first"
1656
+ }
1657
+ ],
1658
+ // Overrides built-in rules
1659
+ ...options.overrides
1497
1660
  }
1498
1661
  }
1499
- ]);
1662
+ ];
1500
1663
 
1501
- // src/configs/markdown.ts
1502
- var markdown = defineConfig([
1503
- ...import_eslint_plugin_markdown.default.configs.recommended,
1664
+ // src/configs/unusedImports.ts
1665
+ var unusedImports = (options = {}) => [
1504
1666
  {
1505
- name: "ntnyq/markdown/extensions",
1506
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1667
+ name: "ntnyq/unused-imports",
1668
+ plugins: {
1669
+ "unused-imports": import_eslint_plugin_unused_imports.default
1670
+ },
1507
1671
  rules: {
1508
- "no-undef": "off",
1509
- "no-alert": "off",
1510
- "no-console": "off",
1511
- "no-unused-vars": "off",
1512
- "no-unused-expressions": "off",
1513
- "no-restricted-imports": "off",
1514
- "node/prefer-global/buffer": "off",
1515
- "node/prefer-global/process": "off",
1516
- "import/no-unresolved": "off",
1517
- "unused-imports/no-unused-imports": "off",
1518
- "unused-imports/no-unused-vars": "off",
1519
- "@typescript-eslint/comma-dangle": "off",
1520
- "@typescript-eslint/no-redeclare": "off",
1521
- "@typescript-eslint/no-namespace": "off",
1522
1672
  "@typescript-eslint/no-unused-vars": "off",
1523
- "@typescript-eslint/no-extraneous-class": "off",
1524
- "@typescript-eslint/no-use-before-define": "off"
1673
+ "unused-imports/no-unused-imports": "error",
1674
+ "unused-imports/no-unused-vars": [
1675
+ "warn",
1676
+ {
1677
+ vars: "all",
1678
+ varsIgnorePattern: "^_",
1679
+ args: "after-used",
1680
+ argsIgnorePattern: "^_"
1681
+ }
1682
+ ],
1683
+ // Overrides built-in rules
1684
+ ...options.overrides
1525
1685
  }
1526
1686
  }
1527
- ]);
1687
+ ];
1688
+
1689
+ // src/utils/env.ts
1690
+ var import_node_path = require("path");
1691
+ var import_node_process2 = __toESM(require("process"), 1);
1692
+ var import_local_pkg = require("local-pkg");
1693
+ var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
1694
+ var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
1695
+ 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)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
1696
+ paths: [(0, import_node_path.resolve)(import_node_process2.default.cwd(), "playground")]
1697
+ });
1698
+ 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");
1699
+
1700
+ // src/utils/toArray.ts
1701
+ function toArray(val) {
1702
+ val = val ?? [];
1703
+ return Array.isArray(val) ? val : [val];
1704
+ }
1705
+
1706
+ // src/utils/interopDefault.ts
1707
+ async function interopDefault(mod) {
1708
+ const resolved = await mod;
1709
+ return resolved.default || resolved;
1710
+ }
1711
+
1712
+ // src/utils/loadPlugin.ts
1713
+ async function loadPlugin(name) {
1714
+ const mod = await import(name).catch((err) => {
1715
+ console.error(err);
1716
+ throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1717
+ });
1718
+ return interopDefault(mod);
1719
+ }
1720
+
1721
+ // src/utils/resolveSubOptions.ts
1722
+ function resolveSubOptions(options, key) {
1723
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1724
+ }
1725
+
1726
+ // src/utils/getOverrides.ts
1727
+ function getOverrides(options, key) {
1728
+ const sub = resolveSubOptions(options, key);
1729
+ return "overrides" in sub && sub.overrides ? sub.overrides : {};
1730
+ }
1528
1731
 
1529
1732
  // src/core.ts
1530
- function ntnyq(config = [], {
1531
- vue: enableVue = hasVue,
1532
- unocss: enableUnoCSS = hasUnoCSS,
1533
- vitest: enableVitest = hasVitest,
1534
- prettier: enablePrettier = true,
1535
- markdown: enableMarkdown = true,
1536
- command: enableCommand = true
1537
- } = {}) {
1538
- const configs = defineConfig([
1539
- /**
1540
- * Basic
1541
- */
1542
- ...ignores,
1543
- ...jsdoc,
1544
- ...jsx,
1545
- ...node,
1546
- ...imports,
1547
- ...unicorn,
1548
- ...comments,
1549
- ...javascript,
1550
- ...regexp,
1551
- ...typescript,
1552
- /**
1553
- * Language extensions
1554
- */
1555
- ...yml,
1556
- ...toml,
1557
- ...jsonc,
1558
- ...sortPackageJson,
1559
- ...sortTsConfig
1560
- ]);
1561
- if (enableVue) {
1562
- configs.push(...vue);
1733
+ function ntnyq(options = {}, userConfigs = []) {
1734
+ const configs = [];
1735
+ if (options.gitignore ?? true) {
1736
+ configs.push(
1737
+ ...gitignore({
1738
+ ...resolveSubOptions(options, "gitignore")
1739
+ })
1740
+ );
1563
1741
  }
1564
- if (enableVitest) {
1565
- configs.push(...vitest);
1742
+ configs.push(
1743
+ ...ignores(options.ignores),
1744
+ ...jsx(),
1745
+ ...node({
1746
+ overrides: getOverrides(options, "node")
1747
+ }),
1748
+ ...imports({
1749
+ overrides: getOverrides(options, "imports")
1750
+ }),
1751
+ ...javascript({
1752
+ ...resolveSubOptions(options, "javascript"),
1753
+ overrides: getOverrides(options, "javascript")
1754
+ })
1755
+ );
1756
+ if (options.perfectionist ?? true) {
1757
+ configs.push(
1758
+ ...perfectionist({
1759
+ overrides: getOverrides(options, "perfectionist")
1760
+ })
1761
+ );
1566
1762
  }
1567
- if (enableUnoCSS) {
1568
- configs.push(...unocss);
1763
+ if (options.unicorn ?? true) {
1764
+ configs.push(
1765
+ ...unicorn({
1766
+ overrides: getOverrides(options, "unicorn")
1767
+ })
1768
+ );
1569
1769
  }
1570
- if (enableMarkdown) {
1571
- configs.push(...markdown);
1770
+ if (options.regexp ?? true) {
1771
+ configs.push(
1772
+ ...regexp({
1773
+ overrides: getOverrides(options, "regexp")
1774
+ })
1775
+ );
1572
1776
  }
1573
- if (enableCommand) {
1574
- configs.push(...command);
1777
+ if (options.jsdoc ?? true) {
1778
+ configs.push(
1779
+ ...jsdoc({
1780
+ overrides: getOverrides(options, "jsdoc")
1781
+ })
1782
+ );
1575
1783
  }
1576
- if (enablePrettier) {
1577
- configs.push(...prettier);
1784
+ if (options.comments ?? true) {
1785
+ configs.push(
1786
+ ...comments({
1787
+ overrides: getOverrides(options, "comments")
1788
+ })
1789
+ );
1578
1790
  }
1579
- if (Object.keys(config).length > 0) {
1580
- configs.push(...Array.isArray(config) ? config : [config]);
1791
+ if (options.typescript ?? hasTypeScript) {
1792
+ configs.push(
1793
+ ...typescript({
1794
+ ...resolveSubOptions(options, "typescript"),
1795
+ overrides: getOverrides(options, "typescript")
1796
+ })
1797
+ );
1581
1798
  }
1582
- return configs;
1799
+ if (options.sortI18nLocale ?? true) {
1800
+ configs.push(...sortI18nLocale());
1801
+ }
1802
+ if (options.sortTsConfig ?? true) {
1803
+ configs.push(...sortTsConfig());
1804
+ }
1805
+ if (options.sortPackageJson ?? true) {
1806
+ configs.push(...sortPackageJson());
1807
+ }
1808
+ if (options.yml ?? true) {
1809
+ configs.push(
1810
+ ...yml({
1811
+ overrides: getOverrides(options, "yml")
1812
+ })
1813
+ );
1814
+ }
1815
+ if (options.toml ?? true) {
1816
+ configs.push(
1817
+ ...toml({
1818
+ overrides: getOverrides(options, "toml")
1819
+ })
1820
+ );
1821
+ }
1822
+ if (options.jsonc ?? true) {
1823
+ configs.push(
1824
+ ...jsonc({
1825
+ overrides: getOverrides(options, "jsonc")
1826
+ })
1827
+ );
1828
+ }
1829
+ if (options.vue ?? hasVue) {
1830
+ configs.push(
1831
+ ...vue({
1832
+ ...resolveSubOptions(options, "vue"),
1833
+ overrides: getOverrides(options, "vue")
1834
+ })
1835
+ );
1836
+ }
1837
+ if (options.vitest ?? hasVitest) {
1838
+ configs.push(
1839
+ ...vitest({
1840
+ overrides: getOverrides(options, "vitest")
1841
+ })
1842
+ );
1843
+ }
1844
+ if (options.unocss ?? hasUnoCSS) {
1845
+ configs.push(
1846
+ ...unocss({
1847
+ overrides: getOverrides(options, "unocss")
1848
+ })
1849
+ );
1850
+ }
1851
+ if (options.markdown ?? true) {
1852
+ configs.push(
1853
+ ...markdown({
1854
+ overrides: getOverrides(options, "markdown")
1855
+ })
1856
+ );
1857
+ }
1858
+ if (options.command ?? true) {
1859
+ configs.push(
1860
+ ...command({
1861
+ ...resolveSubOptions(options, "command")
1862
+ })
1863
+ );
1864
+ }
1865
+ const configPrettier = options.prettier ?? true ? prettier({
1866
+ ...resolveSubOptions(options, "prettier"),
1867
+ overrides: getOverrides(options, "prettier")
1868
+ }) : [];
1869
+ const composer = new import_eslint_flat_config_utils.FlatConfigComposer();
1870
+ composer.append(
1871
+ ...configs,
1872
+ ...toArray(userConfigs),
1873
+ ...configPrettier
1874
+ );
1875
+ return composer;
1583
1876
  }
1584
1877
  // Annotate the CommonJS export names for ESM import in node:
1585
1878
  0 && (module.exports = {
@@ -1597,6 +1890,8 @@ function ntnyq(config = [], {
1597
1890
  GLOB_LESS,
1598
1891
  GLOB_LOCKFILE,
1599
1892
  GLOB_MARKDOWN,
1893
+ GLOB_MARKDOWN_CODE,
1894
+ GLOB_MARKDOWN_NESTED,
1600
1895
  GLOB_NODE_MODULES,
1601
1896
  GLOB_SCSS,
1602
1897
  GLOB_SRC,
@@ -1608,10 +1903,11 @@ function ntnyq(config = [], {
1608
1903
  GLOB_TSX,
1609
1904
  GLOB_VUE,
1610
1905
  GLOB_YAML,
1906
+ antfu,
1611
1907
  command,
1612
1908
  comments,
1613
- defineConfig,
1614
- getVueVersion,
1909
+ getOverrides,
1910
+ gitignore,
1615
1911
  hasTypeScript,
1616
1912
  hasUnoCSS,
1617
1913
  hasVitest,
@@ -1632,6 +1928,7 @@ function ntnyq(config = [], {
1632
1928
  parserVue,
1633
1929
  parserYaml,
1634
1930
  perfectionist,
1931
+ pluginAntfu,
1635
1932
  pluginComments,
1636
1933
  pluginImport,
1637
1934
  pluginJsdoc,
@@ -1650,8 +1947,11 @@ function ntnyq(config = [], {
1650
1947
  pluginYaml,
1651
1948
  prettier,
1652
1949
  regexp,
1950
+ resolveSubOptions,
1951
+ sortI18nLocale,
1653
1952
  sortPackageJson,
1654
1953
  sortTsConfig,
1954
+ toArray,
1655
1955
  toml,
1656
1956
  tseslint,
1657
1957
  typescript,