@ntnyq/eslint-config 2.8.1 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(src_exports, {
49
49
  GLOB_SRC: () => GLOB_SRC,
50
50
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
51
51
  GLOB_STYLE: () => GLOB_STYLE,
52
+ GLOB_TEST: () => GLOB_TEST,
52
53
  GLOB_TOML: () => GLOB_TOML,
53
54
  GLOB_TS: () => GLOB_TS,
54
55
  GLOB_TSX: () => GLOB_TSX,
@@ -56,10 +57,11 @@ __export(src_exports, {
56
57
  GLOB_YAML: () => GLOB_YAML,
57
58
  command: () => command,
58
59
  comments: () => comments,
59
- defineConfig: () => defineConfig,
60
+ getOverrides: () => getOverrides,
60
61
  getVueVersion: () => getVueVersion,
61
62
  hasTypeScript: () => hasTypeScript,
62
63
  hasUnoCSS: () => hasUnoCSS,
64
+ hasVitest: () => hasVitest,
63
65
  hasVue: () => hasVue,
64
66
  ignores: () => ignores,
65
67
  imports: () => imports,
@@ -90,12 +92,15 @@ __export(src_exports, {
90
92
  pluginUnicorn: () => import_eslint_plugin_unicorn.default,
91
93
  pluginUnoCSS: () => import_eslint_plugin.default,
92
94
  pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
95
+ pluginVitest: () => import_eslint_plugin2.default,
93
96
  pluginVue: () => import_eslint_plugin_vue.default,
94
97
  pluginYaml: () => import_eslint_plugin_yml.default,
95
98
  prettier: () => prettier,
96
99
  regexp: () => regexp,
100
+ resolveSubOptions: () => resolveSubOptions,
97
101
  sortPackageJson: () => sortPackageJson,
98
102
  sortTsConfig: () => sortTsConfig,
103
+ toArray: () => toArray,
99
104
  toml: () => toml,
100
105
  tseslint: () => import_typescript_eslint.default,
101
106
  typescript: () => typescript,
@@ -103,6 +108,7 @@ __export(src_exports, {
103
108
  unicorn: () => unicorn,
104
109
  unocss: () => unocss,
105
110
  unusedImports: () => unusedImports,
111
+ vitest: () => vitest,
106
112
  vue: () => vue,
107
113
  yml: () => yml
108
114
  });
@@ -113,11 +119,18 @@ var import_node_process = __toESM(require("process"), 1);
113
119
  var import_node_path = require("path");
114
120
  var import_local_pkg = require("local-pkg");
115
121
  var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
122
+ var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
116
123
  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", {
117
124
  paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
118
125
  });
119
126
  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");
120
127
 
128
+ // src/utils/toArray.ts
129
+ function toArray(val) {
130
+ val = val ?? [];
131
+ return Array.isArray(val) ? val : [val];
132
+ }
133
+
121
134
  // src/utils/interopDefault.ts
122
135
  async function interopDefault(mod) {
123
136
  const resolved = await mod;
@@ -133,9 +146,15 @@ async function loadPlugin(name) {
133
146
  return interopDefault(mod);
134
147
  }
135
148
 
136
- // src/utils/defineConfig.ts
137
- function defineConfig(configs = []) {
138
- return configs;
149
+ // src/utils/resolveSubOptions.ts
150
+ function resolveSubOptions(options, key) {
151
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
152
+ }
153
+
154
+ // src/utils/getOverrides.ts
155
+ function getOverrides(options, key) {
156
+ const sub = resolveSubOptions(options, key);
157
+ return "overrides" in sub && sub.overrides ? sub.overrides : {};
139
158
  }
140
159
 
141
160
  // src/globs.ts
@@ -146,6 +165,7 @@ var GLOB_JSX = "**/*.?([cm])jsx";
146
165
  var GLOB_TS = "**/*.?([cm])ts";
147
166
  var GLOB_TSX = "**/*.?([cm])tsx";
148
167
  var GLOB_DTS = "**/*.d.?([cm])ts";
168
+ var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
149
169
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
150
170
  var GLOB_CSS = "**/*.css";
151
171
  var GLOB_LESS = "**/*.less";
@@ -224,12 +244,16 @@ var GLOB_EXCLUDE = [
224
244
  ];
225
245
 
226
246
  // src/configs/ignores.ts
227
- var ignores = defineConfig([
247
+ var ignores = (customIgnores = []) => [
228
248
  {
229
249
  name: "ntnyq/ignores",
230
- ignores: GLOB_EXCLUDE
250
+ ignores: [
251
+ ...GLOB_EXCLUDE,
252
+ // Overrides built-in ignores
253
+ ...customIgnores
254
+ ]
231
255
  }
232
- ]);
256
+ ];
233
257
 
234
258
  // src/plugins.ts
235
259
  var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
@@ -241,12 +265,13 @@ var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
241
265
  var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
242
266
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
243
267
  var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
268
+ var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
244
269
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
245
270
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
246
271
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
247
272
  var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
248
273
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
249
- var import_eslint_plugin_unused_imports = __toESM(require("@antfu/eslint-plugin-unused-imports"), 1);
274
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
250
275
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
251
276
  var parserToml = __toESM(require("toml-eslint-parser"), 1);
252
277
  var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
@@ -254,7 +279,7 @@ var parserVue = __toESM(require("vue-eslint-parser"), 1);
254
279
  var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
255
280
 
256
281
  // src/configs/node.ts
257
- var node = defineConfig([
282
+ var node = (options = {}) => [
258
283
  {
259
284
  name: "ntnyq/node",
260
285
  plugins: {
@@ -268,13 +293,15 @@ var node = defineConfig([
268
293
  "node/no-path-concat": "error",
269
294
  "node/prefer-global/buffer": ["error", "never"],
270
295
  "node/prefer-global/process": ["error", "never"],
271
- "node/process-exit-as-throw": "error"
296
+ "node/process-exit-as-throw": "error",
297
+ // Overrides built-in rules
298
+ ...options.overrides
272
299
  }
273
300
  }
274
- ]);
301
+ ];
275
302
 
276
303
  // src/configs/jsdoc.ts
277
- var jsdoc = defineConfig([
304
+ var jsdoc = (options = {}) => [
278
305
  {
279
306
  name: "ntnyq/jsdoc",
280
307
  plugins: {
@@ -297,13 +324,15 @@ var jsdoc = defineConfig([
297
324
  "jsdoc/require-returns-description": "warn",
298
325
  "jsdoc/require-yields-check": "warn",
299
326
  "jsdoc/check-alignment": "warn",
300
- "jsdoc/multiline-blocks": "warn"
327
+ "jsdoc/multiline-blocks": "warn",
328
+ // Overrides built-in rules
329
+ ...options.overrides
301
330
  }
302
331
  }
303
- ]);
332
+ ];
304
333
 
305
334
  // src/configs/imports.ts
306
- var imports = defineConfig([
335
+ var imports = (options = {}) => [
307
336
  {
308
337
  name: "ntnyq/imports",
309
338
  plugins: {
@@ -340,13 +369,15 @@ var imports = defineConfig([
340
369
  pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
341
370
  pathGroupsExcludedImportTypes: ["type"]
342
371
  }
343
- ]
372
+ ],
373
+ // Overrides built-in rules
374
+ ...options.overrides
344
375
  }
345
376
  }
346
- ]);
377
+ ];
347
378
 
348
379
  // src/configs/unicorn.ts
349
- var unicorn = defineConfig([
380
+ var unicorn = (options = {}) => [
350
381
  {
351
382
  name: "ntnyq/unicorn",
352
383
  plugins: {
@@ -416,30 +447,69 @@ var unicorn = defineConfig([
416
447
  "unicorn/prefer-array-find": "error",
417
448
  "unicorn/prefer-array-some": "error",
418
449
  "unicorn/prefer-array-flat-map": "error",
419
- "unicorn/prefer-array-index-of": "error"
450
+ "unicorn/prefer-array-index-of": "error",
451
+ // Overrides built-in rules
452
+ ...options.overrides
420
453
  }
421
454
  }
422
- ]);
455
+ ];
423
456
 
424
457
  // src/configs/prettier.ts
425
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
426
- var prettier = defineConfig([
458
+ var prettier = (options = {}) => [
427
459
  {
428
460
  name: "ntnyq/prettier",
429
461
  plugins: {
430
462
  prettier: import_eslint_plugin_prettier.default
431
463
  },
432
464
  rules: {
433
- ...import_eslint_config_prettier.default.rules,
465
+ "vue/array-bracket-newline": "off",
466
+ "vue/array-bracket-spacing": "off",
467
+ "vue/array-element-newline": "off",
468
+ "vue/arrow-spacing": "off",
469
+ "vue/block-spacing": "off",
470
+ "vue/block-tag-newline": "off",
471
+ "vue/brace-style": "off",
472
+ "vue/comma-dangle": "off",
473
+ "vue/comma-spacing": "off",
474
+ "vue/comma-style": "off",
475
+ "vue/dot-location": "off",
476
+ "vue/func-call-spacing": "off",
477
+ "vue/html-closing-bracket-newline": "off",
478
+ "vue/html-closing-bracket-spacing": "off",
479
+ "vue/html-end-tags": "off",
480
+ "vue/html-indent": "off",
481
+ "vue/html-quotes": "off",
482
+ "vue/key-spacing": "off",
483
+ "vue/keyword-spacing": "off",
484
+ "vue/max-attributes-per-line": "off",
485
+ "vue/multiline-html-element-content-newline": "off",
486
+ "vue/multiline-ternary": "off",
487
+ "vue/mustache-interpolation-spacing": "off",
488
+ "vue/no-extra-parens": "off",
489
+ "vue/no-multi-spaces": "off",
490
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
491
+ "vue/object-curly-newline": "off",
492
+ "vue/object-curly-spacing": "off",
493
+ "vue/object-property-newline": "off",
494
+ "vue/operator-linebreak": "off",
495
+ "vue/quote-props": "off",
496
+ "vue/script-indent": "off",
497
+ "vue/singleline-html-element-content-newline": "off",
498
+ "vue/space-in-parens": "off",
499
+ "vue/space-infix-ops": "off",
500
+ "vue/space-unary-ops": "off",
501
+ "vue/template-curly-spacing": "off",
434
502
  ...import_eslint_plugin_prettier.default.configs.recommended.rules,
435
- "prettier/prettier": "warn"
503
+ "prettier/prettier": "warn",
504
+ // Overrides built-in rules
505
+ ...options.overrides
436
506
  }
437
507
  },
438
508
  /**
439
509
  * Languages that prettier currently does not support
440
510
  */
441
511
  {
442
- name: "ntnyq/prettier/ignore",
512
+ name: "ntnyq/prettier/disabled",
443
513
  files: [GLOB_TOML],
444
514
  plugins: {
445
515
  prettier: import_eslint_plugin_prettier.default
@@ -448,10 +518,10 @@ var prettier = defineConfig([
448
518
  "prettier/prettier": "off"
449
519
  }
450
520
  }
451
- ]);
521
+ ];
452
522
 
453
523
  // src/configs/comments.ts
454
- var comments = defineConfig([
524
+ var comments = (options = {}) => [
455
525
  {
456
526
  name: "ntnyq/eslint-comments",
457
527
  plugins: {
@@ -459,15 +529,17 @@ var comments = defineConfig([
459
529
  },
460
530
  rules: {
461
531
  ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
462
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
532
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
533
+ // Overrides built-in rules
534
+ ...options.overrides
463
535
  }
464
536
  }
465
- ]);
537
+ ];
466
538
 
467
539
  // src/configs/javascript.ts
468
540
  var import_globals = __toESM(require("globals"), 1);
469
541
  var import_js = __toESM(require("@eslint/js"), 1);
470
- var javascript = defineConfig([
542
+ var javascript = (option = {}) => [
471
543
  {
472
544
  name: "ntnyq/js/recommended",
473
545
  ...import_js.default.configs.recommended
@@ -678,7 +750,9 @@ var javascript = defineConfig([
678
750
  memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
679
751
  allowSeparatedGroups: false
680
752
  }
681
- ]
753
+ ],
754
+ // Overrides built-in rules
755
+ ...option.overrides
682
756
  }
683
757
  },
684
758
  {
@@ -696,8 +770,8 @@ var javascript = defineConfig([
696
770
  "max-lines-per-function": "off"
697
771
  }
698
772
  }
699
- ]);
700
- var jsx = defineConfig([
773
+ ];
774
+ var jsx = () => [
701
775
  {
702
776
  name: "ntnyq/jsx",
703
777
  files: ["**/*.jsx"],
@@ -709,10 +783,10 @@ var jsx = defineConfig([
709
783
  }
710
784
  }
711
785
  }
712
- ]);
786
+ ];
713
787
 
714
788
  // src/configs/typescript.ts
715
- var typescriptCore = import_typescript_eslint.default.config({
789
+ var typescriptCore = (options = {}) => import_typescript_eslint.default.config({
716
790
  name: "ntnyq/ts/core",
717
791
  extends: [...import_typescript_eslint.default.configs.recommended],
718
792
  files: [GLOB_TS, GLOB_TSX],
@@ -775,10 +849,12 @@ var typescriptCore = import_typescript_eslint.default.config({
775
849
  "@typescript-eslint/explicit-function-return-type": "off",
776
850
  "@typescript-eslint/explicit-module-boundary-types": "off",
777
851
  "@typescript-eslint/consistent-indexed-object-style": "off"
778
- }
852
+ },
853
+ // Overrides built-in rules
854
+ ...options.overrides
779
855
  });
780
- var typescript = defineConfig([
781
- ...typescriptCore,
856
+ var typescript = (options = {}) => [
857
+ ...typescriptCore(options),
782
858
  {
783
859
  name: "ntnyq/ts/dts",
784
860
  files: [GLOB_DTS],
@@ -802,10 +878,10 @@ var typescript = defineConfig([
802
878
  files: [GLOB_JS],
803
879
  rules: {}
804
880
  }
805
- ]);
881
+ ];
806
882
 
807
883
  // src/configs/unusedImports.ts
808
- var unusedImports = defineConfig([
884
+ var unusedImports = (options = {}) => [
809
885
  {
810
886
  name: "ntnyq/unused-imports",
811
887
  plugins: {
@@ -822,13 +898,15 @@ var unusedImports = defineConfig([
822
898
  args: "after-used",
823
899
  argsIgnorePattern: "^_"
824
900
  }
825
- ]
901
+ ],
902
+ // Overrides built-in rules
903
+ ...options.overrides
826
904
  }
827
905
  }
828
- ]);
906
+ ];
829
907
 
830
908
  // src/configs/perfectionist.ts
831
- var perfectionist = defineConfig([
909
+ var perfectionist = (options = {}) => [
832
910
  {
833
911
  name: "ntnyq/perfectionist",
834
912
  plugins: {
@@ -859,24 +937,28 @@ var perfectionist = defineConfig([
859
937
  }
860
938
  ],
861
939
  "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
862
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
940
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
941
+ // Overrides built-in rules
942
+ ...options.overrides
863
943
  }
864
944
  }
865
- ]);
945
+ ];
866
946
 
867
947
  // src/configs/regexp.ts
868
- var regexp = defineConfig([
948
+ var regexp = (options = {}) => [
869
949
  /**
870
950
  * https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
871
951
  */
872
952
  {
873
953
  name: "ntnyq/regexp",
874
- ...pluginRegexp.configs["flat/recommended"]
954
+ ...pluginRegexp.configs["flat/recommended"],
955
+ // Overrides built-in rules
956
+ ...options.overrides
875
957
  }
876
- ]);
958
+ ];
877
959
 
878
960
  // src/configs/unocss.ts
879
- var unocss = defineConfig([
961
+ var unocss = (options = {}) => [
880
962
  {
881
963
  name: "ntnyq/unocss",
882
964
  plugins: {
@@ -885,455 +967,133 @@ var unocss = defineConfig([
885
967
  rules: {
886
968
  "unocss/order": "error",
887
969
  // We don't use this
888
- "unocss/order-attributify": "off"
970
+ "unocss/order-attributify": "off",
971
+ // Overrides built-in rules
972
+ ...options.overrides
889
973
  }
890
974
  }
891
- ]);
975
+ ];
892
976
 
893
977
  // src/configs/command.ts
894
978
  var import_config = __toESM(require("eslint-plugin-command/config"), 1);
895
- var command = defineConfig([(0, import_config.default)()]);
896
-
897
- // src/configs/yml.ts
898
- var yml = defineConfig([
979
+ var command = () => [
899
980
  {
900
- name: "ntnyq/yaml",
901
- files: [GLOB_YAML],
902
- languageOptions: {
903
- parser: parserYaml
904
- },
905
- plugins: {
906
- yml: import_eslint_plugin_yml.default
907
- },
908
- rules: {
909
- ...import_eslint_plugin_yml.default.configs.standard.rules,
910
- ...import_eslint_plugin_yml.default.configs.prettier.rules,
911
- "yml/no-empty-mapping-value": "off",
912
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
913
- }
981
+ ...(0, import_config.default)(),
982
+ name: "ntnyq/command"
914
983
  }
915
- ]);
984
+ ];
916
985
 
917
- // src/configs/toml.ts
918
- var toml = defineConfig([
986
+ // src/configs/vitest.ts
987
+ var vitest = (options = {}) => [
919
988
  {
920
- name: "ntnyq/toml",
921
- files: [GLOB_TOML],
922
- languageOptions: {
923
- parser: parserToml
924
- },
989
+ name: "ntnyq/test",
925
990
  plugins: {
926
- toml: import_eslint_plugin_toml.default
991
+ vitest: import_eslint_plugin2.default
927
992
  },
993
+ files: [GLOB_TEST],
928
994
  rules: {
929
- "toml/comma-style": "error",
930
- "toml/keys-order": "error",
931
- "toml/no-space-dots": "error",
932
- "toml/no-unreadable-number-separator": "error",
933
- "toml/precision-of-fractional-seconds": "error",
934
- "toml/precision-of-integer": "error",
935
- "toml/tables-order": "error",
936
- "toml/indent": ["error", 2],
937
- "toml/vue-custom-block/no-parsing-error": "error",
938
- "toml/array-bracket-newline": "error",
939
- "toml/array-bracket-spacing": ["error", "never"],
940
- "toml/array-element-newline": ["error", "never"],
941
- "toml/inline-table-curly-spacing": "error",
942
- "toml/key-spacing": "error",
943
- "toml/padding-line-between-pairs": "error",
944
- "toml/padding-line-between-tables": "error",
945
- "toml/quoted-keys": "error",
946
- "toml/spaced-comment": "error",
947
- "toml/table-bracket-spacing": "error"
995
+ ...import_eslint_plugin2.default.configs.recommended.rules,
996
+ // Overrides built-in rules
997
+ ...options.overrides
948
998
  }
949
999
  }
950
- ]);
1000
+ ];
951
1001
 
952
- // src/configs/sort.ts
953
- var sortPackageJson = defineConfig([
1002
+ // src/configs/vue.ts
1003
+ var import_node_process2 = __toESM(require("process"), 1);
1004
+ var import_local_pkg2 = require("local-pkg");
1005
+ function getVueVersion() {
1006
+ const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
1007
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
1008
+ return +pkg.version[0];
1009
+ }
1010
+ return 3;
1011
+ }
1012
+ var isVue3 = getVueVersion() === 3;
1013
+ var vue2Rules = {
1014
+ ...import_eslint_plugin_vue.default.configs.base.rules,
1015
+ ...import_eslint_plugin_vue.default.configs.essential.rules,
1016
+ ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
1017
+ ...import_eslint_plugin_vue.default.configs.recommended.rules
1018
+ };
1019
+ var vue3Rules = {
1020
+ ...import_eslint_plugin_vue.default.configs.base.rules,
1021
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
1022
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1023
+ ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
1024
+ };
1025
+ var vue = (options = {}) => [
1026
+ ...import_typescript_eslint.default.config({
1027
+ name: "ntnyq/vue/ts",
1028
+ files: [GLOB_VUE],
1029
+ extends: typescriptCore()
1030
+ }),
954
1031
  {
955
- name: "ntnyq/sort/package-json",
956
- files: ["**/package.json"],
1032
+ name: "ntnyq/vue/core",
1033
+ files: [GLOB_VUE],
1034
+ plugins: {
1035
+ vue: import_eslint_plugin_vue.default,
1036
+ "@typescript-eslint": import_typescript_eslint.default.plugin
1037
+ },
1038
+ languageOptions: {
1039
+ parser: parserVue,
1040
+ parserOptions: {
1041
+ parser: "@typescript-eslint/parser",
1042
+ sourceType: "module",
1043
+ extraFileExtensions: [".vue"],
1044
+ ecmaFeatures: {
1045
+ jsx: true
1046
+ }
1047
+ }
1048
+ },
1049
+ processor: import_eslint_plugin_vue.default.processors[".vue"],
957
1050
  rules: {
958
- "jsonc/sort-keys": [
1051
+ ...isVue3 ? vue3Rules : vue2Rules,
1052
+ // OFF
1053
+ "vue/no-v-html": "off",
1054
+ "vue/require-prop-types": "off",
1055
+ "vue/require-default-prop": "off",
1056
+ "vue/multi-word-component-names": "off",
1057
+ "vue/no-setup-props-reactivity-loss": "off",
1058
+ "vue/html-self-closing": [
959
1059
  "error",
960
1060
  {
961
- pathPattern: "^$",
962
- order: [
963
- "publisher",
964
- "name",
965
- "displayName",
966
- "type",
967
- "version",
968
- "private",
969
- "packageManager",
970
- "description",
971
- "keywords",
972
- "license",
973
- "author",
974
- "homepage",
975
- "repository",
976
- "funding",
977
- "exports",
978
- "main",
979
- "module",
980
- "unpkg",
981
- "jsdelivr",
982
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
983
- "types",
984
- "typesVersions",
985
- "bin",
986
- "icon",
987
- "files",
988
- "sideEffects",
989
- "scripts",
990
- "peerDependencies",
991
- "peerDependenciesMeta",
992
- "dependencies",
993
- "optionalDependencies",
994
- "devDependencies",
995
- "activationEvents",
996
- "contributes",
997
- "categories",
998
- "engines",
999
- "pnpm",
1000
- "overrides",
1001
- "resolutions",
1002
- "husky",
1003
- "prettier",
1004
- "nano-staged",
1005
- "lint-staged",
1006
- "eslintConfig"
1007
- ]
1008
- },
1009
- {
1010
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1011
- order: { type: "asc" }
1012
- },
1013
- {
1014
- order: { type: "asc" },
1015
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1016
- },
1017
- {
1018
- pathPattern: "^exports.*$",
1019
- order: ["types", "import", "require", "default"]
1020
- },
1021
- {
1022
- pathPattern: "^scripts$",
1023
- order: { type: "asc" }
1024
- },
1061
+ html: {
1062
+ void: "always",
1063
+ normal: "always",
1064
+ component: "always"
1065
+ },
1066
+ svg: "always",
1067
+ math: "always"
1068
+ }
1069
+ ],
1070
+ "vue/block-tag-newline": [
1071
+ "error",
1025
1072
  {
1026
- order: [
1027
- // client hooks only
1028
- "pre-commit",
1029
- "prepare-commit-msg",
1030
- "commit-msg",
1031
- "post-commit",
1032
- "pre-rebase",
1033
- "post-rewrite",
1034
- "post-checkout",
1035
- "post-merge",
1036
- "pre-push",
1037
- "pre-auto-gc"
1038
- ],
1039
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1073
+ singleline: "always",
1074
+ multiline: "always"
1040
1075
  }
1041
1076
  ],
1042
- "jsonc/sort-array-values": [
1077
+ "vue/component-name-in-template-casing": [
1043
1078
  "error",
1079
+ "PascalCase",
1044
1080
  {
1045
- pathPattern: "^files$",
1046
- order: { type: "asc" }
1081
+ // Force auto-import components to be PascalCase
1082
+ registeredComponentsOnly: false,
1083
+ ignores: ["slot", "component"]
1047
1084
  }
1048
- ]
1049
- }
1050
- }
1051
- ]);
1052
- var sortTsConfig = defineConfig([
1053
- {
1054
- name: "ntnyq/sort/tsconfig",
1055
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1056
- rules: {
1057
- "jsonc/sort-keys": [
1085
+ ],
1086
+ "vue/component-options-name-casing": ["error", "PascalCase"],
1087
+ "vue/custom-event-name-casing": ["error", "camelCase"],
1088
+ "vue/define-macros-order": [
1058
1089
  "error",
1059
1090
  {
1060
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1061
- pathPattern: "^$"
1062
- },
1063
- {
1064
- order: [
1065
- /* Projects */
1066
- "incremental",
1067
- "composite",
1068
- "tsBuildInfoFile",
1069
- "disableSourceOfProjectReferenceRedirect",
1070
- "disableSolutionSearching",
1071
- "disableReferencedProjectLoad",
1072
- /* Language and Environment */
1073
- "target",
1074
- "lib",
1075
- "jsx",
1076
- "experimentalDecorators",
1077
- "emitDecoratorMetadata",
1078
- "jsxFactory",
1079
- "jsxFragmentFactory",
1080
- "jsxImportSource",
1081
- "reactNamespace",
1082
- "noLib",
1083
- "useDefineForClassFields",
1084
- "moduleDetection",
1085
- /* Modules */
1086
- "module",
1087
- "rootDir",
1088
- "moduleResolution",
1089
- "baseUrl",
1090
- "paths",
1091
- "rootDirs",
1092
- "typeRoots",
1093
- "types",
1094
- "allowUmdGlobalAccess",
1095
- "moduleSuffixes",
1096
- "allowImportingTsExtensions",
1097
- "resolvePackageJsonExports",
1098
- "resolvePackageJsonImports",
1099
- "customConditions",
1100
- "resolveJsonModule",
1101
- "allowArbitraryExtensions",
1102
- "noResolve",
1103
- /* JavaScript Support */
1104
- "allowJs",
1105
- "checkJs",
1106
- "maxNodeModuleJsDepth",
1107
- /* Emit */
1108
- "declaration",
1109
- "declarationMap",
1110
- "emitDeclarationOnly",
1111
- "sourceMap",
1112
- "inlineSourceMap",
1113
- "outFile",
1114
- "outDir",
1115
- "removeComments",
1116
- "noEmit",
1117
- "importHelpers",
1118
- "importsNotUsedAsValues",
1119
- "downlevelIteration",
1120
- "sourceRoot",
1121
- "mapRoot",
1122
- "inlineSources",
1123
- "emitBOM",
1124
- "newLine",
1125
- "stripInternal",
1126
- "noEmitHelpers",
1127
- "noEmitOnError",
1128
- "preserveConstEnums",
1129
- "declarationDir",
1130
- "preserveValueImports",
1131
- /* Interop Constraints */
1132
- "isolatedModules",
1133
- "verbatimModuleSyntax",
1134
- "allowSyntheticDefaultImports",
1135
- "esModuleInterop",
1136
- "preserveSymlinks",
1137
- "forceConsistentCasingInFileNames",
1138
- /* Type Checking */
1139
- "strict",
1140
- "strictBindCallApply",
1141
- "strictFunctionTypes",
1142
- "strictNullChecks",
1143
- "strictPropertyInitialization",
1144
- "allowUnreachableCode",
1145
- "allowUnusedLabels",
1146
- "alwaysStrict",
1147
- "exactOptionalPropertyTypes",
1148
- "noFallthroughCasesInSwitch",
1149
- "noImplicitAny",
1150
- "noImplicitOverride",
1151
- "noImplicitReturns",
1152
- "noImplicitThis",
1153
- "noPropertyAccessFromIndexSignature",
1154
- "noUncheckedIndexedAccess",
1155
- "noUnusedLocals",
1156
- "noUnusedParameters",
1157
- "useUnknownInCatchVariables",
1158
- /* Completeness */
1159
- "skipDefaultLibCheck",
1160
- "skipLibCheck"
1161
- ],
1162
- pathPattern: "^compilerOptions$"
1163
- }
1164
- ]
1165
- }
1166
- }
1167
- ]);
1168
-
1169
- // src/configs/jsonc.ts
1170
- var jsonc = defineConfig([
1171
- {
1172
- name: "ntnyq/jsonc",
1173
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1174
- plugins: {
1175
- jsonc: import_eslint_plugin_jsonc.default
1176
- },
1177
- languageOptions: {
1178
- parser: parserJsonc
1179
- },
1180
- rules: {
1181
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
1182
- "jsonc/array-bracket-spacing": ["error", "never"],
1183
- "jsonc/comma-dangle": ["error", "never"],
1184
- "jsonc/comma-style": ["error", "last"],
1185
- "jsonc/indent": ["error", 2],
1186
- "jsonc/key-spacing": [
1187
- "error",
1188
- {
1189
- beforeColon: false,
1190
- afterColon: true
1191
- }
1192
- ],
1193
- "jsonc/no-octal-escape": "error",
1194
- "jsonc/object-curly-newline": [
1195
- "error",
1196
- {
1197
- multiline: true,
1198
- consistent: true
1199
- }
1200
- ],
1201
- "jsonc/object-curly-spacing": ["error", "always"],
1202
- "jsonc/object-property-newline": [
1203
- "error",
1204
- {
1205
- allowMultiplePropertiesPerLine: true
1206
- }
1207
- ]
1208
- }
1209
- }
1210
- ]);
1211
-
1212
- // src/configs/markdown.ts
1213
- var markdown = defineConfig([
1214
- ...import_eslint_plugin_markdown.default.configs.recommended,
1215
- {
1216
- name: "ntnyq/markdown/extensions",
1217
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1218
- rules: {
1219
- "no-undef": "off",
1220
- "no-alert": "off",
1221
- "no-console": "off",
1222
- "no-unused-vars": "off",
1223
- "no-unused-expressions": "off",
1224
- "no-restricted-imports": "off",
1225
- "node/prefer-global/buffer": "off",
1226
- "node/prefer-global/process": "off",
1227
- "import/no-unresolved": "off",
1228
- "unused-imports/no-unused-imports": "off",
1229
- "unused-imports/no-unused-vars": "off",
1230
- "@typescript-eslint/comma-dangle": "off",
1231
- "@typescript-eslint/no-redeclare": "off",
1232
- "@typescript-eslint/no-namespace": "off",
1233
- "@typescript-eslint/no-unused-vars": "off",
1234
- "@typescript-eslint/no-extraneous-class": "off",
1235
- "@typescript-eslint/no-use-before-define": "off"
1236
- }
1237
- }
1238
- ]);
1239
-
1240
- // src/configs/vue.ts
1241
- var import_node_process2 = __toESM(require("process"), 1);
1242
- var import_local_pkg2 = require("local-pkg");
1243
- function getVueVersion() {
1244
- const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
1245
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
1246
- return +pkg.version[0];
1247
- }
1248
- return 3;
1249
- }
1250
- var isVue3 = getVueVersion() === 3;
1251
- var vue2Rules = {
1252
- ...import_eslint_plugin_vue.default.configs.base.rules,
1253
- ...import_eslint_plugin_vue.default.configs.essential.rules,
1254
- ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
1255
- ...import_eslint_plugin_vue.default.configs.recommended.rules
1256
- };
1257
- var vue3Rules = {
1258
- ...import_eslint_plugin_vue.default.configs.base.rules,
1259
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
1260
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1261
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
1262
- };
1263
- var vue = defineConfig([
1264
- ...import_typescript_eslint.default.config({
1265
- name: "ntnyq/vue/ts",
1266
- files: [GLOB_VUE],
1267
- // TODO: Remove this when `typescript-eslint` is aligned with `eslint`
1268
- // @ts-expect-error - `typescript-eslint` is not aligned with eslint
1269
- extends: typescriptCore
1270
- }),
1271
- {
1272
- name: "ntnyq/vue/core",
1273
- files: [GLOB_VUE],
1274
- plugins: {
1275
- vue: import_eslint_plugin_vue.default,
1276
- "@typescript-eslint": import_typescript_eslint.default.plugin
1277
- },
1278
- languageOptions: {
1279
- parser: parserVue,
1280
- parserOptions: {
1281
- parser: "@typescript-eslint/parser",
1282
- sourceType: "module",
1283
- extraFileExtensions: [".vue"],
1284
- ecmaFeatures: {
1285
- jsx: true
1286
- }
1287
- }
1288
- },
1289
- processor: import_eslint_plugin_vue.default.processors[".vue"],
1290
- rules: {
1291
- ...isVue3 ? vue3Rules : vue2Rules,
1292
- // OFF
1293
- "vue/no-v-html": "off",
1294
- "vue/require-prop-types": "off",
1295
- "vue/require-default-prop": "off",
1296
- "vue/multi-word-component-names": "off",
1297
- "vue/no-setup-props-reactivity-loss": "off",
1298
- "vue/html-self-closing": [
1299
- "error",
1300
- {
1301
- html: {
1302
- void: "always",
1303
- normal: "always",
1304
- component: "always"
1305
- },
1306
- svg: "always",
1307
- math: "always"
1308
- }
1309
- ],
1310
- "vue/block-tag-newline": [
1311
- "error",
1312
- {
1313
- singleline: "always",
1314
- multiline: "always"
1315
- }
1316
- ],
1317
- "vue/component-name-in-template-casing": [
1318
- "error",
1319
- "PascalCase",
1320
- {
1321
- // Force auto-import components to be PascalCase
1322
- registeredComponentsOnly: false,
1323
- ignores: ["slot", "component"]
1324
- }
1325
- ],
1326
- "vue/component-options-name-casing": ["error", "PascalCase"],
1327
- "vue/custom-event-name-casing": ["error", "camelCase"],
1328
- "vue/define-macros-order": [
1329
- "error",
1330
- {
1331
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
1332
- }
1333
- ],
1334
- "vue/html-comment-content-spacing": [
1335
- "error",
1336
- "always",
1091
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
1092
+ }
1093
+ ],
1094
+ "vue/html-comment-content-spacing": [
1095
+ "error",
1096
+ "always",
1337
1097
  {
1338
1098
  exceptions: ["-"]
1339
1099
  }
@@ -1500,59 +1260,482 @@ var vue = defineConfig([
1500
1260
  singleline: 1,
1501
1261
  multiline: 1
1502
1262
  }
1503
- ]
1263
+ ],
1264
+ // Overrides built-in rules
1265
+ ...options.overrides
1504
1266
  }
1505
1267
  }
1506
- ]);
1268
+ ];
1269
+
1270
+ // src/configs/yml.ts
1271
+ var yml = (options = {}) => [
1272
+ {
1273
+ name: "ntnyq/yaml",
1274
+ files: [GLOB_YAML],
1275
+ languageOptions: {
1276
+ parser: parserYaml
1277
+ },
1278
+ plugins: {
1279
+ yml: import_eslint_plugin_yml.default
1280
+ },
1281
+ rules: {
1282
+ ...import_eslint_plugin_yml.default.configs.standard.rules,
1283
+ ...import_eslint_plugin_yml.default.configs.prettier.rules,
1284
+ "yml/no-empty-mapping-value": "off",
1285
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
1286
+ // Overrides built-in rules
1287
+ ...options.overrides
1288
+ }
1289
+ }
1290
+ ];
1291
+
1292
+ // src/configs/toml.ts
1293
+ var toml = (options = {}) => [
1294
+ {
1295
+ name: "ntnyq/toml",
1296
+ files: [GLOB_TOML],
1297
+ languageOptions: {
1298
+ parser: parserToml
1299
+ },
1300
+ plugins: {
1301
+ toml: import_eslint_plugin_toml.default
1302
+ },
1303
+ rules: {
1304
+ "toml/comma-style": "error",
1305
+ "toml/keys-order": "error",
1306
+ "toml/no-space-dots": "error",
1307
+ "toml/no-unreadable-number-separator": "error",
1308
+ "toml/precision-of-fractional-seconds": "error",
1309
+ "toml/precision-of-integer": "error",
1310
+ "toml/tables-order": "error",
1311
+ "toml/indent": ["error", 2],
1312
+ "toml/vue-custom-block/no-parsing-error": "error",
1313
+ "toml/array-bracket-newline": "error",
1314
+ "toml/array-bracket-spacing": ["error", "never"],
1315
+ "toml/array-element-newline": ["error", "never"],
1316
+ "toml/inline-table-curly-spacing": "error",
1317
+ "toml/key-spacing": "error",
1318
+ "toml/padding-line-between-pairs": "error",
1319
+ "toml/padding-line-between-tables": "error",
1320
+ "toml/quoted-keys": "error",
1321
+ "toml/spaced-comment": "error",
1322
+ "toml/table-bracket-spacing": "error",
1323
+ // Overrides built-in rules
1324
+ ...options.overrides
1325
+ }
1326
+ }
1327
+ ];
1328
+
1329
+ // src/configs/sort.ts
1330
+ var sortPackageJson = () => [
1331
+ {
1332
+ name: "ntnyq/sort/package-json",
1333
+ files: ["**/package.json"],
1334
+ rules: {
1335
+ "jsonc/sort-keys": [
1336
+ "error",
1337
+ {
1338
+ pathPattern: "^$",
1339
+ order: [
1340
+ "publisher",
1341
+ "name",
1342
+ "displayName",
1343
+ "type",
1344
+ "version",
1345
+ "private",
1346
+ "packageManager",
1347
+ "description",
1348
+ "keywords",
1349
+ "license",
1350
+ "author",
1351
+ "homepage",
1352
+ "repository",
1353
+ "funding",
1354
+ "exports",
1355
+ "main",
1356
+ "module",
1357
+ "unpkg",
1358
+ "jsdelivr",
1359
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
1360
+ "types",
1361
+ "typesVersions",
1362
+ "bin",
1363
+ "icon",
1364
+ "files",
1365
+ "sideEffects",
1366
+ "scripts",
1367
+ "peerDependencies",
1368
+ "peerDependenciesMeta",
1369
+ "dependencies",
1370
+ "optionalDependencies",
1371
+ "devDependencies",
1372
+ "activationEvents",
1373
+ "contributes",
1374
+ "categories",
1375
+ "engines",
1376
+ "pnpm",
1377
+ "overrides",
1378
+ "resolutions",
1379
+ "husky",
1380
+ "prettier",
1381
+ "nano-staged",
1382
+ "lint-staged",
1383
+ "eslintConfig"
1384
+ ]
1385
+ },
1386
+ {
1387
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1388
+ order: { type: "asc" }
1389
+ },
1390
+ {
1391
+ order: { type: "asc" },
1392
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1393
+ },
1394
+ {
1395
+ pathPattern: "^exports.*$",
1396
+ order: ["types", "import", "require", "default"]
1397
+ },
1398
+ {
1399
+ pathPattern: "^scripts$",
1400
+ order: { type: "asc" }
1401
+ },
1402
+ {
1403
+ order: [
1404
+ // client hooks only
1405
+ "pre-commit",
1406
+ "prepare-commit-msg",
1407
+ "commit-msg",
1408
+ "post-commit",
1409
+ "pre-rebase",
1410
+ "post-rewrite",
1411
+ "post-checkout",
1412
+ "post-merge",
1413
+ "pre-push",
1414
+ "pre-auto-gc"
1415
+ ],
1416
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1417
+ }
1418
+ ],
1419
+ "jsonc/sort-array-values": [
1420
+ "error",
1421
+ {
1422
+ pathPattern: "^files$",
1423
+ order: { type: "asc" }
1424
+ }
1425
+ ]
1426
+ }
1427
+ }
1428
+ ];
1429
+ var sortTsConfig = () => [
1430
+ {
1431
+ name: "ntnyq/sort/tsconfig",
1432
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1433
+ rules: {
1434
+ "jsonc/sort-keys": [
1435
+ "error",
1436
+ {
1437
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1438
+ pathPattern: "^$"
1439
+ },
1440
+ {
1441
+ order: [
1442
+ /* Projects */
1443
+ "incremental",
1444
+ "composite",
1445
+ "tsBuildInfoFile",
1446
+ "disableSourceOfProjectReferenceRedirect",
1447
+ "disableSolutionSearching",
1448
+ "disableReferencedProjectLoad",
1449
+ /* Language and Environment */
1450
+ "target",
1451
+ "lib",
1452
+ "jsx",
1453
+ "experimentalDecorators",
1454
+ "emitDecoratorMetadata",
1455
+ "jsxFactory",
1456
+ "jsxFragmentFactory",
1457
+ "jsxImportSource",
1458
+ "reactNamespace",
1459
+ "noLib",
1460
+ "useDefineForClassFields",
1461
+ "moduleDetection",
1462
+ /* Modules */
1463
+ "module",
1464
+ "rootDir",
1465
+ "moduleResolution",
1466
+ "baseUrl",
1467
+ "paths",
1468
+ "rootDirs",
1469
+ "typeRoots",
1470
+ "types",
1471
+ "allowUmdGlobalAccess",
1472
+ "moduleSuffixes",
1473
+ "allowImportingTsExtensions",
1474
+ "resolvePackageJsonExports",
1475
+ "resolvePackageJsonImports",
1476
+ "customConditions",
1477
+ "resolveJsonModule",
1478
+ "allowArbitraryExtensions",
1479
+ "noResolve",
1480
+ /* JavaScript Support */
1481
+ "allowJs",
1482
+ "checkJs",
1483
+ "maxNodeModuleJsDepth",
1484
+ /* Emit */
1485
+ "declaration",
1486
+ "declarationMap",
1487
+ "emitDeclarationOnly",
1488
+ "sourceMap",
1489
+ "inlineSourceMap",
1490
+ "outFile",
1491
+ "outDir",
1492
+ "removeComments",
1493
+ "noEmit",
1494
+ "importHelpers",
1495
+ "importsNotUsedAsValues",
1496
+ "downlevelIteration",
1497
+ "sourceRoot",
1498
+ "mapRoot",
1499
+ "inlineSources",
1500
+ "emitBOM",
1501
+ "newLine",
1502
+ "stripInternal",
1503
+ "noEmitHelpers",
1504
+ "noEmitOnError",
1505
+ "preserveConstEnums",
1506
+ "declarationDir",
1507
+ "preserveValueImports",
1508
+ /* Interop Constraints */
1509
+ "isolatedModules",
1510
+ "verbatimModuleSyntax",
1511
+ "allowSyntheticDefaultImports",
1512
+ "esModuleInterop",
1513
+ "preserveSymlinks",
1514
+ "forceConsistentCasingInFileNames",
1515
+ /* Type Checking */
1516
+ "strict",
1517
+ "strictBindCallApply",
1518
+ "strictFunctionTypes",
1519
+ "strictNullChecks",
1520
+ "strictPropertyInitialization",
1521
+ "allowUnreachableCode",
1522
+ "allowUnusedLabels",
1523
+ "alwaysStrict",
1524
+ "exactOptionalPropertyTypes",
1525
+ "noFallthroughCasesInSwitch",
1526
+ "noImplicitAny",
1527
+ "noImplicitOverride",
1528
+ "noImplicitReturns",
1529
+ "noImplicitThis",
1530
+ "noPropertyAccessFromIndexSignature",
1531
+ "noUncheckedIndexedAccess",
1532
+ "noUnusedLocals",
1533
+ "noUnusedParameters",
1534
+ "useUnknownInCatchVariables",
1535
+ /* Completeness */
1536
+ "skipDefaultLibCheck",
1537
+ "skipLibCheck"
1538
+ ],
1539
+ pathPattern: "^compilerOptions$"
1540
+ }
1541
+ ]
1542
+ }
1543
+ }
1544
+ ];
1545
+
1546
+ // src/configs/jsonc.ts
1547
+ var jsonc = (options = {}) => [
1548
+ {
1549
+ name: "ntnyq/jsonc",
1550
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1551
+ plugins: {
1552
+ jsonc: import_eslint_plugin_jsonc.default
1553
+ },
1554
+ languageOptions: {
1555
+ parser: parserJsonc
1556
+ },
1557
+ rules: {
1558
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
1559
+ "jsonc/array-bracket-spacing": ["error", "never"],
1560
+ "jsonc/comma-dangle": ["error", "never"],
1561
+ "jsonc/comma-style": ["error", "last"],
1562
+ "jsonc/indent": ["error", 2],
1563
+ "jsonc/key-spacing": [
1564
+ "error",
1565
+ {
1566
+ beforeColon: false,
1567
+ afterColon: true
1568
+ }
1569
+ ],
1570
+ "jsonc/no-octal-escape": "error",
1571
+ "jsonc/object-curly-newline": [
1572
+ "error",
1573
+ {
1574
+ multiline: true,
1575
+ consistent: true
1576
+ }
1577
+ ],
1578
+ "jsonc/object-curly-spacing": ["error", "always"],
1579
+ "jsonc/object-property-newline": [
1580
+ "error",
1581
+ {
1582
+ allowMultiplePropertiesPerLine: true
1583
+ }
1584
+ ],
1585
+ // Overrides built-in rules
1586
+ ...options.overrides
1587
+ }
1588
+ }
1589
+ ];
1590
+
1591
+ // src/configs/markdown.ts
1592
+ var markdown = (options = {}) => [
1593
+ ...import_eslint_plugin_markdown.default.configs.recommended,
1594
+ {
1595
+ name: "ntnyq/markdown/extensions",
1596
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1597
+ rules: {
1598
+ "no-undef": "off",
1599
+ "no-alert": "off",
1600
+ "no-console": "off",
1601
+ "no-unused-vars": "off",
1602
+ "no-unused-expressions": "off",
1603
+ "no-restricted-imports": "off",
1604
+ "node/prefer-global/buffer": "off",
1605
+ "node/prefer-global/process": "off",
1606
+ "import/no-unresolved": "off",
1607
+ "unused-imports/no-unused-imports": "off",
1608
+ "unused-imports/no-unused-vars": "off",
1609
+ "@typescript-eslint/comma-dangle": "off",
1610
+ "@typescript-eslint/no-redeclare": "off",
1611
+ "@typescript-eslint/no-namespace": "off",
1612
+ "@typescript-eslint/no-unused-vars": "off",
1613
+ "@typescript-eslint/no-extraneous-class": "off",
1614
+ "@typescript-eslint/no-use-before-define": "off",
1615
+ // Overrides built-in rules
1616
+ ...options.overrides
1617
+ }
1618
+ }
1619
+ ];
1507
1620
 
1508
1621
  // src/core.ts
1509
- function ntnyq(config = [], {
1510
- vue: enableVue = hasVue,
1511
- unocss: enableUnoCSS = hasUnoCSS,
1512
- prettier: enablePrettier = true,
1513
- markdown: enableMarkdown = true,
1514
- command: enableCommand = true
1515
- } = {}) {
1516
- const configs = defineConfig([
1622
+ function ntnyq(options = {}, customConfig = []) {
1623
+ const configs = [
1517
1624
  /**
1518
1625
  * Basic
1519
1626
  */
1520
- ...ignores,
1521
- ...jsdoc,
1522
- ...jsx,
1523
- ...node,
1524
- ...imports,
1525
- ...unicorn,
1526
- ...comments,
1527
- ...javascript,
1528
- ...regexp,
1529
- ...typescript,
1530
- /**
1531
- * Language extensions
1532
- */
1533
- ...yml,
1534
- ...toml,
1535
- ...jsonc,
1536
- ...sortPackageJson,
1537
- ...sortTsConfig
1538
- ]);
1539
- if (enableVue) {
1540
- configs.push(...vue);
1627
+ ...ignores(options.ignores),
1628
+ ...jsx(),
1629
+ ...node({
1630
+ overrides: getOverrides(options, "node")
1631
+ }),
1632
+ ...imports({
1633
+ overrides: getOverrides(options, "imports")
1634
+ }),
1635
+ ...javascript({
1636
+ overrides: getOverrides(options, "javascript")
1637
+ })
1638
+ ];
1639
+ if (options.unicorn ?? true) {
1640
+ configs.push(
1641
+ ...unicorn({
1642
+ overrides: getOverrides(options, "unicorn")
1643
+ })
1644
+ );
1645
+ }
1646
+ if (options.regexp ?? true) {
1647
+ configs.push(
1648
+ ...regexp({
1649
+ overrides: getOverrides(options, "regexp")
1650
+ })
1651
+ );
1652
+ }
1653
+ if (options.jsdoc ?? true) {
1654
+ configs.push(
1655
+ ...jsdoc({
1656
+ overrides: getOverrides(options, "jsdoc")
1657
+ })
1658
+ );
1659
+ }
1660
+ if (options.comments ?? true) {
1661
+ configs.push(
1662
+ ...comments({
1663
+ overrides: getOverrides(options, "comments")
1664
+ })
1665
+ );
1666
+ }
1667
+ if (options.typescript ?? hasTypeScript) {
1668
+ configs.push(
1669
+ ...typescript({
1670
+ overrides: getOverrides(options, "typescript")
1671
+ })
1672
+ );
1673
+ }
1674
+ if (options.sortTsConfig ?? true) {
1675
+ configs.push(...sortTsConfig());
1676
+ }
1677
+ if (options.sortPackageJson ?? true) {
1678
+ configs.push(...sortPackageJson());
1679
+ }
1680
+ if (options.yml ?? true) {
1681
+ configs.push(
1682
+ ...yml({
1683
+ overrides: getOverrides(options, "yml")
1684
+ })
1685
+ );
1686
+ }
1687
+ if (options.toml ?? true) {
1688
+ configs.push(
1689
+ ...toml({
1690
+ overrides: getOverrides(options, "toml")
1691
+ })
1692
+ );
1693
+ }
1694
+ if (options.jsonc ?? true) {
1695
+ configs.push(
1696
+ ...jsonc({
1697
+ overrides: getOverrides(options, "jsonc")
1698
+ })
1699
+ );
1700
+ }
1701
+ if (options.vue ?? hasVue) {
1702
+ configs.push(
1703
+ ...vue({
1704
+ overrides: getOverrides(options, "vue")
1705
+ })
1706
+ );
1541
1707
  }
1542
- if (enableUnoCSS) {
1543
- configs.push(...unocss);
1708
+ if (options.vitest ?? hasVitest) {
1709
+ configs.push(
1710
+ ...vitest({
1711
+ overrides: getOverrides(options, "vitest")
1712
+ })
1713
+ );
1544
1714
  }
1545
- if (enableMarkdown) {
1546
- configs.push(...markdown);
1715
+ if (options.vitest ?? hasVitest) {
1716
+ configs.push(
1717
+ ...unocss({
1718
+ overrides: getOverrides(options, "unocss")
1719
+ })
1720
+ );
1547
1721
  }
1548
- if (enableCommand) {
1549
- configs.push(...command);
1722
+ if (options.markdown ?? true) {
1723
+ configs.push(
1724
+ ...markdown({
1725
+ overrides: getOverrides(options, "markdown")
1726
+ })
1727
+ );
1550
1728
  }
1551
- if (enablePrettier) {
1552
- configs.push(...prettier);
1729
+ if (options.command ?? true) {
1730
+ configs.push(...command());
1553
1731
  }
1554
- if (Object.keys(config).length > 0) {
1555
- configs.push(...Array.isArray(config) ? config : [config]);
1732
+ configs.push(...toArray(customConfig));
1733
+ if (options.prettier ?? true) {
1734
+ configs.push(
1735
+ ...prettier({
1736
+ overrides: getOverrides(options, "prettier")
1737
+ })
1738
+ );
1556
1739
  }
1557
1740
  return configs;
1558
1741
  }
@@ -1577,6 +1760,7 @@ function ntnyq(config = [], {
1577
1760
  GLOB_SRC,
1578
1761
  GLOB_SRC_EXT,
1579
1762
  GLOB_STYLE,
1763
+ GLOB_TEST,
1580
1764
  GLOB_TOML,
1581
1765
  GLOB_TS,
1582
1766
  GLOB_TSX,
@@ -1584,10 +1768,11 @@ function ntnyq(config = [], {
1584
1768
  GLOB_YAML,
1585
1769
  command,
1586
1770
  comments,
1587
- defineConfig,
1771
+ getOverrides,
1588
1772
  getVueVersion,
1589
1773
  hasTypeScript,
1590
1774
  hasUnoCSS,
1775
+ hasVitest,
1591
1776
  hasVue,
1592
1777
  ignores,
1593
1778
  imports,
@@ -1618,12 +1803,15 @@ function ntnyq(config = [], {
1618
1803
  pluginUnicorn,
1619
1804
  pluginUnoCSS,
1620
1805
  pluginUnusedImports,
1806
+ pluginVitest,
1621
1807
  pluginVue,
1622
1808
  pluginYaml,
1623
1809
  prettier,
1624
1810
  regexp,
1811
+ resolveSubOptions,
1625
1812
  sortPackageJson,
1626
1813
  sortTsConfig,
1814
+ toArray,
1627
1815
  toml,
1628
1816
  tseslint,
1629
1817
  typescript,
@@ -1631,6 +1819,7 @@ function ntnyq(config = [], {
1631
1819
  unicorn,
1632
1820
  unocss,
1633
1821
  unusedImports,
1822
+ vitest,
1634
1823
  vue,
1635
1824
  yml
1636
1825
  });