@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.js CHANGED
@@ -3,11 +3,18 @@ import process from "node:process";
3
3
  import { resolve } from "node:path";
4
4
  import { isPackageExists } from "local-pkg";
5
5
  var hasTypeScript = isPackageExists("typescript");
6
+ var hasVitest = isPackageExists("vitest");
6
7
  var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
7
8
  paths: [resolve(process.cwd(), "playground")]
8
9
  });
9
10
  var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
10
11
 
12
+ // src/utils/toArray.ts
13
+ function toArray(val) {
14
+ val = val ?? [];
15
+ return Array.isArray(val) ? val : [val];
16
+ }
17
+
11
18
  // src/utils/interopDefault.ts
12
19
  async function interopDefault(mod) {
13
20
  const resolved = await mod;
@@ -23,9 +30,15 @@ async function loadPlugin(name) {
23
30
  return interopDefault(mod);
24
31
  }
25
32
 
26
- // src/utils/defineConfig.ts
27
- function defineConfig(configs = []) {
28
- return configs;
33
+ // src/utils/resolveSubOptions.ts
34
+ function resolveSubOptions(options, key) {
35
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
36
+ }
37
+
38
+ // src/utils/getOverrides.ts
39
+ function getOverrides(options, key) {
40
+ const sub = resolveSubOptions(options, key);
41
+ return "overrides" in sub && sub.overrides ? sub.overrides : {};
29
42
  }
30
43
 
31
44
  // src/globs.ts
@@ -36,6 +49,7 @@ var GLOB_JSX = "**/*.?([cm])jsx";
36
49
  var GLOB_TS = "**/*.?([cm])ts";
37
50
  var GLOB_TSX = "**/*.?([cm])tsx";
38
51
  var GLOB_DTS = "**/*.d.?([cm])ts";
52
+ var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
39
53
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
40
54
  var GLOB_CSS = "**/*.css";
41
55
  var GLOB_LESS = "**/*.less";
@@ -114,12 +128,16 @@ var GLOB_EXCLUDE = [
114
128
  ];
115
129
 
116
130
  // src/configs/ignores.ts
117
- var ignores = defineConfig([
131
+ var ignores = (customIgnores = []) => [
118
132
  {
119
133
  name: "ntnyq/ignores",
120
- ignores: GLOB_EXCLUDE
134
+ ignores: [
135
+ ...GLOB_EXCLUDE,
136
+ // Overrides built-in ignores
137
+ ...customIgnores
138
+ ]
121
139
  }
122
- ]);
140
+ ];
123
141
 
124
142
  // src/plugins.ts
125
143
  import tseslint from "typescript-eslint";
@@ -131,20 +149,21 @@ import { default as default5 } from "eslint-plugin-toml";
131
149
  import { default as default6 } from "eslint-plugin-jsonc";
132
150
  import { default as default7 } from "eslint-plugin-jsdoc";
133
151
  import { default as default8 } from "@unocss/eslint-plugin";
134
- import { default as default9 } from "eslint-plugin-unicorn";
135
- import { default as default10 } from "eslint-plugin-import-x";
136
- import { default as default11 } from "eslint-plugin-prettier";
137
- import { default as default12 } from "eslint-plugin-markdown";
138
- import { default as default13 } from "eslint-plugin-perfectionist";
139
- import { default as default14 } from "@antfu/eslint-plugin-unused-imports";
140
- import { default as default15 } from "@eslint-community/eslint-plugin-eslint-comments";
152
+ import { default as default9 } from "@vitest/eslint-plugin";
153
+ import { default as default10 } from "eslint-plugin-unicorn";
154
+ import { default as default11 } from "eslint-plugin-import-x";
155
+ import { default as default12 } from "eslint-plugin-prettier";
156
+ import { default as default13 } from "eslint-plugin-markdown";
157
+ import { default as default14 } from "eslint-plugin-perfectionist";
158
+ import { default as default15 } from "eslint-plugin-unused-imports";
159
+ import { default as default16 } from "@eslint-community/eslint-plugin-eslint-comments";
141
160
  import * as parserToml from "toml-eslint-parser";
142
161
  import * as parserYaml from "yaml-eslint-parser";
143
162
  import * as parserVue from "vue-eslint-parser";
144
163
  import * as parserJsonc from "jsonc-eslint-parser";
145
164
 
146
165
  // src/configs/node.ts
147
- var node = defineConfig([
166
+ var node = (options = {}) => [
148
167
  {
149
168
  name: "ntnyq/node",
150
169
  plugins: {
@@ -158,13 +177,15 @@ var node = defineConfig([
158
177
  "node/no-path-concat": "error",
159
178
  "node/prefer-global/buffer": ["error", "never"],
160
179
  "node/prefer-global/process": ["error", "never"],
161
- "node/process-exit-as-throw": "error"
180
+ "node/process-exit-as-throw": "error",
181
+ // Overrides built-in rules
182
+ ...options.overrides
162
183
  }
163
184
  }
164
- ]);
185
+ ];
165
186
 
166
187
  // src/configs/jsdoc.ts
167
- var jsdoc = defineConfig([
188
+ var jsdoc = (options = {}) => [
168
189
  {
169
190
  name: "ntnyq/jsdoc",
170
191
  plugins: {
@@ -187,17 +208,19 @@ var jsdoc = defineConfig([
187
208
  "jsdoc/require-returns-description": "warn",
188
209
  "jsdoc/require-yields-check": "warn",
189
210
  "jsdoc/check-alignment": "warn",
190
- "jsdoc/multiline-blocks": "warn"
211
+ "jsdoc/multiline-blocks": "warn",
212
+ // Overrides built-in rules
213
+ ...options.overrides
191
214
  }
192
215
  }
193
- ]);
216
+ ];
194
217
 
195
218
  // src/configs/imports.ts
196
- var imports = defineConfig([
219
+ var imports = (options = {}) => [
197
220
  {
198
221
  name: "ntnyq/imports",
199
222
  plugins: {
200
- import: default10
223
+ import: default11
201
224
  },
202
225
  settings: {
203
226
  "import/resolver": {
@@ -230,17 +253,19 @@ var imports = defineConfig([
230
253
  pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }],
231
254
  pathGroupsExcludedImportTypes: ["type"]
232
255
  }
233
- ]
256
+ ],
257
+ // Overrides built-in rules
258
+ ...options.overrides
234
259
  }
235
260
  }
236
- ]);
261
+ ];
237
262
 
238
263
  // src/configs/unicorn.ts
239
- var unicorn = defineConfig([
264
+ var unicorn = (options = {}) => [
240
265
  {
241
266
  name: "ntnyq/unicorn",
242
267
  plugins: {
243
- unicorn: default9
268
+ unicorn: default10
244
269
  },
245
270
  rules: {
246
271
  // Disabled for now
@@ -306,58 +331,99 @@ var unicorn = defineConfig([
306
331
  "unicorn/prefer-array-find": "error",
307
332
  "unicorn/prefer-array-some": "error",
308
333
  "unicorn/prefer-array-flat-map": "error",
309
- "unicorn/prefer-array-index-of": "error"
334
+ "unicorn/prefer-array-index-of": "error",
335
+ // Overrides built-in rules
336
+ ...options.overrides
310
337
  }
311
338
  }
312
- ]);
339
+ ];
313
340
 
314
341
  // src/configs/prettier.ts
315
- import prettierConfig from "eslint-config-prettier";
316
- var prettier = defineConfig([
342
+ var prettier = (options = {}) => [
317
343
  {
318
344
  name: "ntnyq/prettier",
319
345
  plugins: {
320
- prettier: default11
346
+ prettier: default12
321
347
  },
322
348
  rules: {
323
- ...prettierConfig.rules,
324
- ...default11.configs.recommended.rules,
325
- "prettier/prettier": "warn"
349
+ "vue/array-bracket-newline": "off",
350
+ "vue/array-bracket-spacing": "off",
351
+ "vue/array-element-newline": "off",
352
+ "vue/arrow-spacing": "off",
353
+ "vue/block-spacing": "off",
354
+ "vue/block-tag-newline": "off",
355
+ "vue/brace-style": "off",
356
+ "vue/comma-dangle": "off",
357
+ "vue/comma-spacing": "off",
358
+ "vue/comma-style": "off",
359
+ "vue/dot-location": "off",
360
+ "vue/func-call-spacing": "off",
361
+ "vue/html-closing-bracket-newline": "off",
362
+ "vue/html-closing-bracket-spacing": "off",
363
+ "vue/html-end-tags": "off",
364
+ "vue/html-indent": "off",
365
+ "vue/html-quotes": "off",
366
+ "vue/key-spacing": "off",
367
+ "vue/keyword-spacing": "off",
368
+ "vue/max-attributes-per-line": "off",
369
+ "vue/multiline-html-element-content-newline": "off",
370
+ "vue/multiline-ternary": "off",
371
+ "vue/mustache-interpolation-spacing": "off",
372
+ "vue/no-extra-parens": "off",
373
+ "vue/no-multi-spaces": "off",
374
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
375
+ "vue/object-curly-newline": "off",
376
+ "vue/object-curly-spacing": "off",
377
+ "vue/object-property-newline": "off",
378
+ "vue/operator-linebreak": "off",
379
+ "vue/quote-props": "off",
380
+ "vue/script-indent": "off",
381
+ "vue/singleline-html-element-content-newline": "off",
382
+ "vue/space-in-parens": "off",
383
+ "vue/space-infix-ops": "off",
384
+ "vue/space-unary-ops": "off",
385
+ "vue/template-curly-spacing": "off",
386
+ ...default12.configs.recommended.rules,
387
+ "prettier/prettier": "warn",
388
+ // Overrides built-in rules
389
+ ...options.overrides
326
390
  }
327
391
  },
328
392
  /**
329
393
  * Languages that prettier currently does not support
330
394
  */
331
395
  {
332
- name: "ntnyq/prettier/ignore",
396
+ name: "ntnyq/prettier/disabled",
333
397
  files: [GLOB_TOML],
334
398
  plugins: {
335
- prettier: default11
399
+ prettier: default12
336
400
  },
337
401
  rules: {
338
402
  "prettier/prettier": "off"
339
403
  }
340
404
  }
341
- ]);
405
+ ];
342
406
 
343
407
  // src/configs/comments.ts
344
- var comments = defineConfig([
408
+ var comments = (options = {}) => [
345
409
  {
346
410
  name: "ntnyq/eslint-comments",
347
411
  plugins: {
348
- "@eslint-community/eslint-comments": default15
412
+ "@eslint-community/eslint-comments": default16
349
413
  },
350
414
  rules: {
351
- ...default15.configs.recommended.rules,
352
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
415
+ ...default16.configs.recommended.rules,
416
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
417
+ // Overrides built-in rules
418
+ ...options.overrides
353
419
  }
354
420
  }
355
- ]);
421
+ ];
356
422
 
357
423
  // src/configs/javascript.ts
358
424
  import globals from "globals";
359
425
  import jsConfig from "@eslint/js";
360
- var javascript = defineConfig([
426
+ var javascript = (option = {}) => [
361
427
  {
362
428
  name: "ntnyq/js/recommended",
363
429
  ...jsConfig.configs.recommended
@@ -568,7 +634,9 @@ var javascript = defineConfig([
568
634
  memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
569
635
  allowSeparatedGroups: false
570
636
  }
571
- ]
637
+ ],
638
+ // Overrides built-in rules
639
+ ...option.overrides
572
640
  }
573
641
  },
574
642
  {
@@ -586,8 +654,8 @@ var javascript = defineConfig([
586
654
  "max-lines-per-function": "off"
587
655
  }
588
656
  }
589
- ]);
590
- var jsx = defineConfig([
657
+ ];
658
+ var jsx = () => [
591
659
  {
592
660
  name: "ntnyq/jsx",
593
661
  files: ["**/*.jsx"],
@@ -599,10 +667,10 @@ var jsx = defineConfig([
599
667
  }
600
668
  }
601
669
  }
602
- ]);
670
+ ];
603
671
 
604
672
  // src/configs/typescript.ts
605
- var typescriptCore = tseslint.config({
673
+ var typescriptCore = (options = {}) => tseslint.config({
606
674
  name: "ntnyq/ts/core",
607
675
  extends: [...tseslint.configs.recommended],
608
676
  files: [GLOB_TS, GLOB_TSX],
@@ -665,10 +733,12 @@ var typescriptCore = tseslint.config({
665
733
  "@typescript-eslint/explicit-function-return-type": "off",
666
734
  "@typescript-eslint/explicit-module-boundary-types": "off",
667
735
  "@typescript-eslint/consistent-indexed-object-style": "off"
668
- }
736
+ },
737
+ // Overrides built-in rules
738
+ ...options.overrides
669
739
  });
670
- var typescript = defineConfig([
671
- ...typescriptCore,
740
+ var typescript = (options = {}) => [
741
+ ...typescriptCore(options),
672
742
  {
673
743
  name: "ntnyq/ts/dts",
674
744
  files: [GLOB_DTS],
@@ -692,14 +762,14 @@ var typescript = defineConfig([
692
762
  files: [GLOB_JS],
693
763
  rules: {}
694
764
  }
695
- ]);
765
+ ];
696
766
 
697
767
  // src/configs/unusedImports.ts
698
- var unusedImports = defineConfig([
768
+ var unusedImports = (options = {}) => [
699
769
  {
700
770
  name: "ntnyq/unused-imports",
701
771
  plugins: {
702
- "unused-imports": default14
772
+ "unused-imports": default15
703
773
  },
704
774
  rules: {
705
775
  "@typescript-eslint/no-unused-vars": "off",
@@ -712,17 +782,19 @@ var unusedImports = defineConfig([
712
782
  args: "after-used",
713
783
  argsIgnorePattern: "^_"
714
784
  }
715
- ]
785
+ ],
786
+ // Overrides built-in rules
787
+ ...options.overrides
716
788
  }
717
789
  }
718
- ]);
790
+ ];
719
791
 
720
792
  // src/configs/perfectionist.ts
721
- var perfectionist = defineConfig([
793
+ var perfectionist = (options = {}) => [
722
794
  {
723
795
  name: "ntnyq/perfectionist",
724
796
  plugins: {
725
- perfectionist: default13
797
+ perfectionist: default14
726
798
  },
727
799
  rules: {
728
800
  "perfectionist/sort-imports": [
@@ -749,24 +821,28 @@ var perfectionist = defineConfig([
749
821
  }
750
822
  ],
751
823
  "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
752
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
824
+ "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
825
+ // Overrides built-in rules
826
+ ...options.overrides
753
827
  }
754
828
  }
755
- ]);
829
+ ];
756
830
 
757
831
  // src/configs/regexp.ts
758
- var regexp = defineConfig([
832
+ var regexp = (options = {}) => [
759
833
  /**
760
834
  * https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
761
835
  */
762
836
  {
763
837
  name: "ntnyq/regexp",
764
- ...pluginRegexp.configs["flat/recommended"]
838
+ ...pluginRegexp.configs["flat/recommended"],
839
+ // Overrides built-in rules
840
+ ...options.overrides
765
841
  }
766
- ]);
842
+ ];
767
843
 
768
844
  // src/configs/unocss.ts
769
- var unocss = defineConfig([
845
+ var unocss = (options = {}) => [
770
846
  {
771
847
  name: "ntnyq/unocss",
772
848
  plugins: {
@@ -775,455 +851,133 @@ var unocss = defineConfig([
775
851
  rules: {
776
852
  "unocss/order": "error",
777
853
  // We don't use this
778
- "unocss/order-attributify": "off"
854
+ "unocss/order-attributify": "off",
855
+ // Overrides built-in rules
856
+ ...options.overrides
779
857
  }
780
858
  }
781
- ]);
859
+ ];
782
860
 
783
861
  // src/configs/command.ts
784
862
  import createCommandPlugin from "eslint-plugin-command/config";
785
- var command = defineConfig([createCommandPlugin()]);
786
-
787
- // src/configs/yml.ts
788
- var yml = defineConfig([
863
+ var command = () => [
789
864
  {
790
- name: "ntnyq/yaml",
791
- files: [GLOB_YAML],
792
- languageOptions: {
793
- parser: parserYaml
794
- },
795
- plugins: {
796
- yml: default4
797
- },
798
- rules: {
799
- ...default4.configs.standard.rules,
800
- ...default4.configs.prettier.rules,
801
- "yml/no-empty-mapping-value": "off",
802
- "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
803
- }
865
+ ...createCommandPlugin(),
866
+ name: "ntnyq/command"
804
867
  }
805
- ]);
868
+ ];
806
869
 
807
- // src/configs/toml.ts
808
- var toml = defineConfig([
870
+ // src/configs/vitest.ts
871
+ var vitest = (options = {}) => [
809
872
  {
810
- name: "ntnyq/toml",
811
- files: [GLOB_TOML],
812
- languageOptions: {
813
- parser: parserToml
814
- },
873
+ name: "ntnyq/test",
815
874
  plugins: {
816
- toml: default5
875
+ vitest: default9
817
876
  },
877
+ files: [GLOB_TEST],
818
878
  rules: {
819
- "toml/comma-style": "error",
820
- "toml/keys-order": "error",
821
- "toml/no-space-dots": "error",
822
- "toml/no-unreadable-number-separator": "error",
823
- "toml/precision-of-fractional-seconds": "error",
824
- "toml/precision-of-integer": "error",
825
- "toml/tables-order": "error",
826
- "toml/indent": ["error", 2],
827
- "toml/vue-custom-block/no-parsing-error": "error",
828
- "toml/array-bracket-newline": "error",
829
- "toml/array-bracket-spacing": ["error", "never"],
830
- "toml/array-element-newline": ["error", "never"],
831
- "toml/inline-table-curly-spacing": "error",
832
- "toml/key-spacing": "error",
833
- "toml/padding-line-between-pairs": "error",
834
- "toml/padding-line-between-tables": "error",
835
- "toml/quoted-keys": "error",
836
- "toml/spaced-comment": "error",
837
- "toml/table-bracket-spacing": "error"
879
+ ...default9.configs.recommended.rules,
880
+ // Overrides built-in rules
881
+ ...options.overrides
838
882
  }
839
883
  }
840
- ]);
884
+ ];
841
885
 
842
- // src/configs/sort.ts
843
- var sortPackageJson = defineConfig([
886
+ // src/configs/vue.ts
887
+ import process2 from "node:process";
888
+ import { getPackageInfoSync } from "local-pkg";
889
+ function getVueVersion() {
890
+ const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
891
+ if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
892
+ return +pkg.version[0];
893
+ }
894
+ return 3;
895
+ }
896
+ var isVue3 = getVueVersion() === 3;
897
+ var vue2Rules = {
898
+ ...default3.configs.base.rules,
899
+ ...default3.configs.essential.rules,
900
+ ...default3.configs["strongly-recommended"].rules,
901
+ ...default3.configs.recommended.rules
902
+ };
903
+ var vue3Rules = {
904
+ ...default3.configs.base.rules,
905
+ ...default3.configs["vue3-essential"].rules,
906
+ ...default3.configs["vue3-strongly-recommended"].rules,
907
+ ...default3.configs["vue3-recommended"].rules
908
+ };
909
+ var vue = (options = {}) => [
910
+ ...tseslint.config({
911
+ name: "ntnyq/vue/ts",
912
+ files: [GLOB_VUE],
913
+ extends: typescriptCore()
914
+ }),
844
915
  {
845
- name: "ntnyq/sort/package-json",
846
- files: ["**/package.json"],
916
+ name: "ntnyq/vue/core",
917
+ files: [GLOB_VUE],
918
+ plugins: {
919
+ vue: default3,
920
+ "@typescript-eslint": tseslint.plugin
921
+ },
922
+ languageOptions: {
923
+ parser: parserVue,
924
+ parserOptions: {
925
+ parser: "@typescript-eslint/parser",
926
+ sourceType: "module",
927
+ extraFileExtensions: [".vue"],
928
+ ecmaFeatures: {
929
+ jsx: true
930
+ }
931
+ }
932
+ },
933
+ processor: default3.processors[".vue"],
847
934
  rules: {
848
- "jsonc/sort-keys": [
935
+ ...isVue3 ? vue3Rules : vue2Rules,
936
+ // OFF
937
+ "vue/no-v-html": "off",
938
+ "vue/require-prop-types": "off",
939
+ "vue/require-default-prop": "off",
940
+ "vue/multi-word-component-names": "off",
941
+ "vue/no-setup-props-reactivity-loss": "off",
942
+ "vue/html-self-closing": [
849
943
  "error",
850
944
  {
851
- pathPattern: "^$",
852
- order: [
853
- "publisher",
854
- "name",
855
- "displayName",
856
- "type",
857
- "version",
858
- "private",
859
- "packageManager",
860
- "description",
861
- "keywords",
862
- "license",
863
- "author",
864
- "homepage",
865
- "repository",
866
- "funding",
867
- "exports",
868
- "main",
869
- "module",
870
- "unpkg",
871
- "jsdelivr",
872
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
873
- "types",
874
- "typesVersions",
875
- "bin",
876
- "icon",
877
- "files",
878
- "sideEffects",
879
- "scripts",
880
- "peerDependencies",
881
- "peerDependenciesMeta",
882
- "dependencies",
883
- "optionalDependencies",
884
- "devDependencies",
885
- "activationEvents",
886
- "contributes",
887
- "categories",
888
- "engines",
889
- "pnpm",
890
- "overrides",
891
- "resolutions",
892
- "husky",
893
- "prettier",
894
- "nano-staged",
895
- "lint-staged",
896
- "eslintConfig"
897
- ]
898
- },
899
- {
900
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
901
- order: { type: "asc" }
902
- },
903
- {
904
- order: { type: "asc" },
905
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
906
- },
907
- {
908
- pathPattern: "^exports.*$",
909
- order: ["types", "import", "require", "default"]
910
- },
911
- {
912
- pathPattern: "^scripts$",
913
- order: { type: "asc" }
914
- },
945
+ html: {
946
+ void: "always",
947
+ normal: "always",
948
+ component: "always"
949
+ },
950
+ svg: "always",
951
+ math: "always"
952
+ }
953
+ ],
954
+ "vue/block-tag-newline": [
955
+ "error",
915
956
  {
916
- order: [
917
- // client hooks only
918
- "pre-commit",
919
- "prepare-commit-msg",
920
- "commit-msg",
921
- "post-commit",
922
- "pre-rebase",
923
- "post-rewrite",
924
- "post-checkout",
925
- "post-merge",
926
- "pre-push",
927
- "pre-auto-gc"
928
- ],
929
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
957
+ singleline: "always",
958
+ multiline: "always"
930
959
  }
931
960
  ],
932
- "jsonc/sort-array-values": [
961
+ "vue/component-name-in-template-casing": [
933
962
  "error",
963
+ "PascalCase",
934
964
  {
935
- pathPattern: "^files$",
936
- order: { type: "asc" }
965
+ // Force auto-import components to be PascalCase
966
+ registeredComponentsOnly: false,
967
+ ignores: ["slot", "component"]
937
968
  }
938
- ]
939
- }
940
- }
941
- ]);
942
- var sortTsConfig = defineConfig([
943
- {
944
- name: "ntnyq/sort/tsconfig",
945
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
946
- rules: {
947
- "jsonc/sort-keys": [
969
+ ],
970
+ "vue/component-options-name-casing": ["error", "PascalCase"],
971
+ "vue/custom-event-name-casing": ["error", "camelCase"],
972
+ "vue/define-macros-order": [
948
973
  "error",
949
974
  {
950
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
951
- pathPattern: "^$"
952
- },
953
- {
954
- order: [
955
- /* Projects */
956
- "incremental",
957
- "composite",
958
- "tsBuildInfoFile",
959
- "disableSourceOfProjectReferenceRedirect",
960
- "disableSolutionSearching",
961
- "disableReferencedProjectLoad",
962
- /* Language and Environment */
963
- "target",
964
- "lib",
965
- "jsx",
966
- "experimentalDecorators",
967
- "emitDecoratorMetadata",
968
- "jsxFactory",
969
- "jsxFragmentFactory",
970
- "jsxImportSource",
971
- "reactNamespace",
972
- "noLib",
973
- "useDefineForClassFields",
974
- "moduleDetection",
975
- /* Modules */
976
- "module",
977
- "rootDir",
978
- "moduleResolution",
979
- "baseUrl",
980
- "paths",
981
- "rootDirs",
982
- "typeRoots",
983
- "types",
984
- "allowUmdGlobalAccess",
985
- "moduleSuffixes",
986
- "allowImportingTsExtensions",
987
- "resolvePackageJsonExports",
988
- "resolvePackageJsonImports",
989
- "customConditions",
990
- "resolveJsonModule",
991
- "allowArbitraryExtensions",
992
- "noResolve",
993
- /* JavaScript Support */
994
- "allowJs",
995
- "checkJs",
996
- "maxNodeModuleJsDepth",
997
- /* Emit */
998
- "declaration",
999
- "declarationMap",
1000
- "emitDeclarationOnly",
1001
- "sourceMap",
1002
- "inlineSourceMap",
1003
- "outFile",
1004
- "outDir",
1005
- "removeComments",
1006
- "noEmit",
1007
- "importHelpers",
1008
- "importsNotUsedAsValues",
1009
- "downlevelIteration",
1010
- "sourceRoot",
1011
- "mapRoot",
1012
- "inlineSources",
1013
- "emitBOM",
1014
- "newLine",
1015
- "stripInternal",
1016
- "noEmitHelpers",
1017
- "noEmitOnError",
1018
- "preserveConstEnums",
1019
- "declarationDir",
1020
- "preserveValueImports",
1021
- /* Interop Constraints */
1022
- "isolatedModules",
1023
- "verbatimModuleSyntax",
1024
- "allowSyntheticDefaultImports",
1025
- "esModuleInterop",
1026
- "preserveSymlinks",
1027
- "forceConsistentCasingInFileNames",
1028
- /* Type Checking */
1029
- "strict",
1030
- "strictBindCallApply",
1031
- "strictFunctionTypes",
1032
- "strictNullChecks",
1033
- "strictPropertyInitialization",
1034
- "allowUnreachableCode",
1035
- "allowUnusedLabels",
1036
- "alwaysStrict",
1037
- "exactOptionalPropertyTypes",
1038
- "noFallthroughCasesInSwitch",
1039
- "noImplicitAny",
1040
- "noImplicitOverride",
1041
- "noImplicitReturns",
1042
- "noImplicitThis",
1043
- "noPropertyAccessFromIndexSignature",
1044
- "noUncheckedIndexedAccess",
1045
- "noUnusedLocals",
1046
- "noUnusedParameters",
1047
- "useUnknownInCatchVariables",
1048
- /* Completeness */
1049
- "skipDefaultLibCheck",
1050
- "skipLibCheck"
1051
- ],
1052
- pathPattern: "^compilerOptions$"
1053
- }
1054
- ]
1055
- }
1056
- }
1057
- ]);
1058
-
1059
- // src/configs/jsonc.ts
1060
- var jsonc = defineConfig([
1061
- {
1062
- name: "ntnyq/jsonc",
1063
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1064
- plugins: {
1065
- jsonc: default6
1066
- },
1067
- languageOptions: {
1068
- parser: parserJsonc
1069
- },
1070
- rules: {
1071
- ...default6.configs["recommended-with-jsonc"].rules,
1072
- "jsonc/array-bracket-spacing": ["error", "never"],
1073
- "jsonc/comma-dangle": ["error", "never"],
1074
- "jsonc/comma-style": ["error", "last"],
1075
- "jsonc/indent": ["error", 2],
1076
- "jsonc/key-spacing": [
1077
- "error",
1078
- {
1079
- beforeColon: false,
1080
- afterColon: true
1081
- }
1082
- ],
1083
- "jsonc/no-octal-escape": "error",
1084
- "jsonc/object-curly-newline": [
1085
- "error",
1086
- {
1087
- multiline: true,
1088
- consistent: true
1089
- }
1090
- ],
1091
- "jsonc/object-curly-spacing": ["error", "always"],
1092
- "jsonc/object-property-newline": [
1093
- "error",
1094
- {
1095
- allowMultiplePropertiesPerLine: true
1096
- }
1097
- ]
1098
- }
1099
- }
1100
- ]);
1101
-
1102
- // src/configs/markdown.ts
1103
- var markdown = defineConfig([
1104
- ...default12.configs.recommended,
1105
- {
1106
- name: "ntnyq/markdown/extensions",
1107
- files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1108
- rules: {
1109
- "no-undef": "off",
1110
- "no-alert": "off",
1111
- "no-console": "off",
1112
- "no-unused-vars": "off",
1113
- "no-unused-expressions": "off",
1114
- "no-restricted-imports": "off",
1115
- "node/prefer-global/buffer": "off",
1116
- "node/prefer-global/process": "off",
1117
- "import/no-unresolved": "off",
1118
- "unused-imports/no-unused-imports": "off",
1119
- "unused-imports/no-unused-vars": "off",
1120
- "@typescript-eslint/comma-dangle": "off",
1121
- "@typescript-eslint/no-redeclare": "off",
1122
- "@typescript-eslint/no-namespace": "off",
1123
- "@typescript-eslint/no-unused-vars": "off",
1124
- "@typescript-eslint/no-extraneous-class": "off",
1125
- "@typescript-eslint/no-use-before-define": "off"
1126
- }
1127
- }
1128
- ]);
1129
-
1130
- // src/configs/vue.ts
1131
- import process2 from "node:process";
1132
- import { getPackageInfoSync } from "local-pkg";
1133
- function getVueVersion() {
1134
- const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
1135
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
1136
- return +pkg.version[0];
1137
- }
1138
- return 3;
1139
- }
1140
- var isVue3 = getVueVersion() === 3;
1141
- var vue2Rules = {
1142
- ...default3.configs.base.rules,
1143
- ...default3.configs.essential.rules,
1144
- ...default3.configs["strongly-recommended"].rules,
1145
- ...default3.configs.recommended.rules
1146
- };
1147
- var vue3Rules = {
1148
- ...default3.configs.base.rules,
1149
- ...default3.configs["vue3-essential"].rules,
1150
- ...default3.configs["vue3-strongly-recommended"].rules,
1151
- ...default3.configs["vue3-recommended"].rules
1152
- };
1153
- var vue = defineConfig([
1154
- ...tseslint.config({
1155
- name: "ntnyq/vue/ts",
1156
- files: [GLOB_VUE],
1157
- // TODO: Remove this when `typescript-eslint` is aligned with `eslint`
1158
- // @ts-expect-error - `typescript-eslint` is not aligned with eslint
1159
- extends: typescriptCore
1160
- }),
1161
- {
1162
- name: "ntnyq/vue/core",
1163
- files: [GLOB_VUE],
1164
- plugins: {
1165
- vue: default3,
1166
- "@typescript-eslint": tseslint.plugin
1167
- },
1168
- languageOptions: {
1169
- parser: parserVue,
1170
- parserOptions: {
1171
- parser: "@typescript-eslint/parser",
1172
- sourceType: "module",
1173
- extraFileExtensions: [".vue"],
1174
- ecmaFeatures: {
1175
- jsx: true
1176
- }
1177
- }
1178
- },
1179
- processor: default3.processors[".vue"],
1180
- rules: {
1181
- ...isVue3 ? vue3Rules : vue2Rules,
1182
- // OFF
1183
- "vue/no-v-html": "off",
1184
- "vue/require-prop-types": "off",
1185
- "vue/require-default-prop": "off",
1186
- "vue/multi-word-component-names": "off",
1187
- "vue/no-setup-props-reactivity-loss": "off",
1188
- "vue/html-self-closing": [
1189
- "error",
1190
- {
1191
- html: {
1192
- void: "always",
1193
- normal: "always",
1194
- component: "always"
1195
- },
1196
- svg: "always",
1197
- math: "always"
1198
- }
1199
- ],
1200
- "vue/block-tag-newline": [
1201
- "error",
1202
- {
1203
- singleline: "always",
1204
- multiline: "always"
1205
- }
1206
- ],
1207
- "vue/component-name-in-template-casing": [
1208
- "error",
1209
- "PascalCase",
1210
- {
1211
- // Force auto-import components to be PascalCase
1212
- registeredComponentsOnly: false,
1213
- ignores: ["slot", "component"]
1214
- }
1215
- ],
1216
- "vue/component-options-name-casing": ["error", "PascalCase"],
1217
- "vue/custom-event-name-casing": ["error", "camelCase"],
1218
- "vue/define-macros-order": [
1219
- "error",
1220
- {
1221
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
1222
- }
1223
- ],
1224
- "vue/html-comment-content-spacing": [
1225
- "error",
1226
- "always",
975
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
976
+ }
977
+ ],
978
+ "vue/html-comment-content-spacing": [
979
+ "error",
980
+ "always",
1227
981
  {
1228
982
  exceptions: ["-"]
1229
983
  }
@@ -1390,59 +1144,482 @@ var vue = defineConfig([
1390
1144
  singleline: 1,
1391
1145
  multiline: 1
1392
1146
  }
1393
- ]
1147
+ ],
1148
+ // Overrides built-in rules
1149
+ ...options.overrides
1394
1150
  }
1395
1151
  }
1396
- ]);
1152
+ ];
1153
+
1154
+ // src/configs/yml.ts
1155
+ var yml = (options = {}) => [
1156
+ {
1157
+ name: "ntnyq/yaml",
1158
+ files: [GLOB_YAML],
1159
+ languageOptions: {
1160
+ parser: parserYaml
1161
+ },
1162
+ plugins: {
1163
+ yml: default4
1164
+ },
1165
+ rules: {
1166
+ ...default4.configs.standard.rules,
1167
+ ...default4.configs.prettier.rules,
1168
+ "yml/no-empty-mapping-value": "off",
1169
+ "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
1170
+ // Overrides built-in rules
1171
+ ...options.overrides
1172
+ }
1173
+ }
1174
+ ];
1175
+
1176
+ // src/configs/toml.ts
1177
+ var toml = (options = {}) => [
1178
+ {
1179
+ name: "ntnyq/toml",
1180
+ files: [GLOB_TOML],
1181
+ languageOptions: {
1182
+ parser: parserToml
1183
+ },
1184
+ plugins: {
1185
+ toml: default5
1186
+ },
1187
+ rules: {
1188
+ "toml/comma-style": "error",
1189
+ "toml/keys-order": "error",
1190
+ "toml/no-space-dots": "error",
1191
+ "toml/no-unreadable-number-separator": "error",
1192
+ "toml/precision-of-fractional-seconds": "error",
1193
+ "toml/precision-of-integer": "error",
1194
+ "toml/tables-order": "error",
1195
+ "toml/indent": ["error", 2],
1196
+ "toml/vue-custom-block/no-parsing-error": "error",
1197
+ "toml/array-bracket-newline": "error",
1198
+ "toml/array-bracket-spacing": ["error", "never"],
1199
+ "toml/array-element-newline": ["error", "never"],
1200
+ "toml/inline-table-curly-spacing": "error",
1201
+ "toml/key-spacing": "error",
1202
+ "toml/padding-line-between-pairs": "error",
1203
+ "toml/padding-line-between-tables": "error",
1204
+ "toml/quoted-keys": "error",
1205
+ "toml/spaced-comment": "error",
1206
+ "toml/table-bracket-spacing": "error",
1207
+ // Overrides built-in rules
1208
+ ...options.overrides
1209
+ }
1210
+ }
1211
+ ];
1212
+
1213
+ // src/configs/sort.ts
1214
+ var sortPackageJson = () => [
1215
+ {
1216
+ name: "ntnyq/sort/package-json",
1217
+ files: ["**/package.json"],
1218
+ rules: {
1219
+ "jsonc/sort-keys": [
1220
+ "error",
1221
+ {
1222
+ pathPattern: "^$",
1223
+ order: [
1224
+ "publisher",
1225
+ "name",
1226
+ "displayName",
1227
+ "type",
1228
+ "version",
1229
+ "private",
1230
+ "packageManager",
1231
+ "description",
1232
+ "keywords",
1233
+ "license",
1234
+ "author",
1235
+ "homepage",
1236
+ "repository",
1237
+ "funding",
1238
+ "exports",
1239
+ "main",
1240
+ "module",
1241
+ "unpkg",
1242
+ "jsdelivr",
1243
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
1244
+ "types",
1245
+ "typesVersions",
1246
+ "bin",
1247
+ "icon",
1248
+ "files",
1249
+ "sideEffects",
1250
+ "scripts",
1251
+ "peerDependencies",
1252
+ "peerDependenciesMeta",
1253
+ "dependencies",
1254
+ "optionalDependencies",
1255
+ "devDependencies",
1256
+ "activationEvents",
1257
+ "contributes",
1258
+ "categories",
1259
+ "engines",
1260
+ "pnpm",
1261
+ "overrides",
1262
+ "resolutions",
1263
+ "husky",
1264
+ "prettier",
1265
+ "nano-staged",
1266
+ "lint-staged",
1267
+ "eslintConfig"
1268
+ ]
1269
+ },
1270
+ {
1271
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
1272
+ order: { type: "asc" }
1273
+ },
1274
+ {
1275
+ order: { type: "asc" },
1276
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1277
+ },
1278
+ {
1279
+ pathPattern: "^exports.*$",
1280
+ order: ["types", "import", "require", "default"]
1281
+ },
1282
+ {
1283
+ pathPattern: "^scripts$",
1284
+ order: { type: "asc" }
1285
+ },
1286
+ {
1287
+ order: [
1288
+ // client hooks only
1289
+ "pre-commit",
1290
+ "prepare-commit-msg",
1291
+ "commit-msg",
1292
+ "post-commit",
1293
+ "pre-rebase",
1294
+ "post-rewrite",
1295
+ "post-checkout",
1296
+ "post-merge",
1297
+ "pre-push",
1298
+ "pre-auto-gc"
1299
+ ],
1300
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1301
+ }
1302
+ ],
1303
+ "jsonc/sort-array-values": [
1304
+ "error",
1305
+ {
1306
+ pathPattern: "^files$",
1307
+ order: { type: "asc" }
1308
+ }
1309
+ ]
1310
+ }
1311
+ }
1312
+ ];
1313
+ var sortTsConfig = () => [
1314
+ {
1315
+ name: "ntnyq/sort/tsconfig",
1316
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1317
+ rules: {
1318
+ "jsonc/sort-keys": [
1319
+ "error",
1320
+ {
1321
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1322
+ pathPattern: "^$"
1323
+ },
1324
+ {
1325
+ order: [
1326
+ /* Projects */
1327
+ "incremental",
1328
+ "composite",
1329
+ "tsBuildInfoFile",
1330
+ "disableSourceOfProjectReferenceRedirect",
1331
+ "disableSolutionSearching",
1332
+ "disableReferencedProjectLoad",
1333
+ /* Language and Environment */
1334
+ "target",
1335
+ "lib",
1336
+ "jsx",
1337
+ "experimentalDecorators",
1338
+ "emitDecoratorMetadata",
1339
+ "jsxFactory",
1340
+ "jsxFragmentFactory",
1341
+ "jsxImportSource",
1342
+ "reactNamespace",
1343
+ "noLib",
1344
+ "useDefineForClassFields",
1345
+ "moduleDetection",
1346
+ /* Modules */
1347
+ "module",
1348
+ "rootDir",
1349
+ "moduleResolution",
1350
+ "baseUrl",
1351
+ "paths",
1352
+ "rootDirs",
1353
+ "typeRoots",
1354
+ "types",
1355
+ "allowUmdGlobalAccess",
1356
+ "moduleSuffixes",
1357
+ "allowImportingTsExtensions",
1358
+ "resolvePackageJsonExports",
1359
+ "resolvePackageJsonImports",
1360
+ "customConditions",
1361
+ "resolveJsonModule",
1362
+ "allowArbitraryExtensions",
1363
+ "noResolve",
1364
+ /* JavaScript Support */
1365
+ "allowJs",
1366
+ "checkJs",
1367
+ "maxNodeModuleJsDepth",
1368
+ /* Emit */
1369
+ "declaration",
1370
+ "declarationMap",
1371
+ "emitDeclarationOnly",
1372
+ "sourceMap",
1373
+ "inlineSourceMap",
1374
+ "outFile",
1375
+ "outDir",
1376
+ "removeComments",
1377
+ "noEmit",
1378
+ "importHelpers",
1379
+ "importsNotUsedAsValues",
1380
+ "downlevelIteration",
1381
+ "sourceRoot",
1382
+ "mapRoot",
1383
+ "inlineSources",
1384
+ "emitBOM",
1385
+ "newLine",
1386
+ "stripInternal",
1387
+ "noEmitHelpers",
1388
+ "noEmitOnError",
1389
+ "preserveConstEnums",
1390
+ "declarationDir",
1391
+ "preserveValueImports",
1392
+ /* Interop Constraints */
1393
+ "isolatedModules",
1394
+ "verbatimModuleSyntax",
1395
+ "allowSyntheticDefaultImports",
1396
+ "esModuleInterop",
1397
+ "preserveSymlinks",
1398
+ "forceConsistentCasingInFileNames",
1399
+ /* Type Checking */
1400
+ "strict",
1401
+ "strictBindCallApply",
1402
+ "strictFunctionTypes",
1403
+ "strictNullChecks",
1404
+ "strictPropertyInitialization",
1405
+ "allowUnreachableCode",
1406
+ "allowUnusedLabels",
1407
+ "alwaysStrict",
1408
+ "exactOptionalPropertyTypes",
1409
+ "noFallthroughCasesInSwitch",
1410
+ "noImplicitAny",
1411
+ "noImplicitOverride",
1412
+ "noImplicitReturns",
1413
+ "noImplicitThis",
1414
+ "noPropertyAccessFromIndexSignature",
1415
+ "noUncheckedIndexedAccess",
1416
+ "noUnusedLocals",
1417
+ "noUnusedParameters",
1418
+ "useUnknownInCatchVariables",
1419
+ /* Completeness */
1420
+ "skipDefaultLibCheck",
1421
+ "skipLibCheck"
1422
+ ],
1423
+ pathPattern: "^compilerOptions$"
1424
+ }
1425
+ ]
1426
+ }
1427
+ }
1428
+ ];
1429
+
1430
+ // src/configs/jsonc.ts
1431
+ var jsonc = (options = {}) => [
1432
+ {
1433
+ name: "ntnyq/jsonc",
1434
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1435
+ plugins: {
1436
+ jsonc: default6
1437
+ },
1438
+ languageOptions: {
1439
+ parser: parserJsonc
1440
+ },
1441
+ rules: {
1442
+ ...default6.configs["recommended-with-jsonc"].rules,
1443
+ "jsonc/array-bracket-spacing": ["error", "never"],
1444
+ "jsonc/comma-dangle": ["error", "never"],
1445
+ "jsonc/comma-style": ["error", "last"],
1446
+ "jsonc/indent": ["error", 2],
1447
+ "jsonc/key-spacing": [
1448
+ "error",
1449
+ {
1450
+ beforeColon: false,
1451
+ afterColon: true
1452
+ }
1453
+ ],
1454
+ "jsonc/no-octal-escape": "error",
1455
+ "jsonc/object-curly-newline": [
1456
+ "error",
1457
+ {
1458
+ multiline: true,
1459
+ consistent: true
1460
+ }
1461
+ ],
1462
+ "jsonc/object-curly-spacing": ["error", "always"],
1463
+ "jsonc/object-property-newline": [
1464
+ "error",
1465
+ {
1466
+ allowMultiplePropertiesPerLine: true
1467
+ }
1468
+ ],
1469
+ // Overrides built-in rules
1470
+ ...options.overrides
1471
+ }
1472
+ }
1473
+ ];
1474
+
1475
+ // src/configs/markdown.ts
1476
+ var markdown = (options = {}) => [
1477
+ ...default13.configs.recommended,
1478
+ {
1479
+ name: "ntnyq/markdown/extensions",
1480
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
1481
+ rules: {
1482
+ "no-undef": "off",
1483
+ "no-alert": "off",
1484
+ "no-console": "off",
1485
+ "no-unused-vars": "off",
1486
+ "no-unused-expressions": "off",
1487
+ "no-restricted-imports": "off",
1488
+ "node/prefer-global/buffer": "off",
1489
+ "node/prefer-global/process": "off",
1490
+ "import/no-unresolved": "off",
1491
+ "unused-imports/no-unused-imports": "off",
1492
+ "unused-imports/no-unused-vars": "off",
1493
+ "@typescript-eslint/comma-dangle": "off",
1494
+ "@typescript-eslint/no-redeclare": "off",
1495
+ "@typescript-eslint/no-namespace": "off",
1496
+ "@typescript-eslint/no-unused-vars": "off",
1497
+ "@typescript-eslint/no-extraneous-class": "off",
1498
+ "@typescript-eslint/no-use-before-define": "off",
1499
+ // Overrides built-in rules
1500
+ ...options.overrides
1501
+ }
1502
+ }
1503
+ ];
1397
1504
 
1398
1505
  // src/core.ts
1399
- function ntnyq(config = [], {
1400
- vue: enableVue = hasVue,
1401
- unocss: enableUnoCSS = hasUnoCSS,
1402
- prettier: enablePrettier = true,
1403
- markdown: enableMarkdown = true,
1404
- command: enableCommand = true
1405
- } = {}) {
1406
- const configs = defineConfig([
1506
+ function ntnyq(options = {}, customConfig = []) {
1507
+ const configs = [
1407
1508
  /**
1408
1509
  * Basic
1409
1510
  */
1410
- ...ignores,
1411
- ...jsdoc,
1412
- ...jsx,
1413
- ...node,
1414
- ...imports,
1415
- ...unicorn,
1416
- ...comments,
1417
- ...javascript,
1418
- ...regexp,
1419
- ...typescript,
1420
- /**
1421
- * Language extensions
1422
- */
1423
- ...yml,
1424
- ...toml,
1425
- ...jsonc,
1426
- ...sortPackageJson,
1427
- ...sortTsConfig
1428
- ]);
1429
- if (enableVue) {
1430
- configs.push(...vue);
1511
+ ...ignores(options.ignores),
1512
+ ...jsx(),
1513
+ ...node({
1514
+ overrides: getOverrides(options, "node")
1515
+ }),
1516
+ ...imports({
1517
+ overrides: getOverrides(options, "imports")
1518
+ }),
1519
+ ...javascript({
1520
+ overrides: getOverrides(options, "javascript")
1521
+ })
1522
+ ];
1523
+ if (options.unicorn ?? true) {
1524
+ configs.push(
1525
+ ...unicorn({
1526
+ overrides: getOverrides(options, "unicorn")
1527
+ })
1528
+ );
1529
+ }
1530
+ if (options.regexp ?? true) {
1531
+ configs.push(
1532
+ ...regexp({
1533
+ overrides: getOverrides(options, "regexp")
1534
+ })
1535
+ );
1536
+ }
1537
+ if (options.jsdoc ?? true) {
1538
+ configs.push(
1539
+ ...jsdoc({
1540
+ overrides: getOverrides(options, "jsdoc")
1541
+ })
1542
+ );
1543
+ }
1544
+ if (options.comments ?? true) {
1545
+ configs.push(
1546
+ ...comments({
1547
+ overrides: getOverrides(options, "comments")
1548
+ })
1549
+ );
1550
+ }
1551
+ if (options.typescript ?? hasTypeScript) {
1552
+ configs.push(
1553
+ ...typescript({
1554
+ overrides: getOverrides(options, "typescript")
1555
+ })
1556
+ );
1557
+ }
1558
+ if (options.sortTsConfig ?? true) {
1559
+ configs.push(...sortTsConfig());
1560
+ }
1561
+ if (options.sortPackageJson ?? true) {
1562
+ configs.push(...sortPackageJson());
1563
+ }
1564
+ if (options.yml ?? true) {
1565
+ configs.push(
1566
+ ...yml({
1567
+ overrides: getOverrides(options, "yml")
1568
+ })
1569
+ );
1570
+ }
1571
+ if (options.toml ?? true) {
1572
+ configs.push(
1573
+ ...toml({
1574
+ overrides: getOverrides(options, "toml")
1575
+ })
1576
+ );
1577
+ }
1578
+ if (options.jsonc ?? true) {
1579
+ configs.push(
1580
+ ...jsonc({
1581
+ overrides: getOverrides(options, "jsonc")
1582
+ })
1583
+ );
1584
+ }
1585
+ if (options.vue ?? hasVue) {
1586
+ configs.push(
1587
+ ...vue({
1588
+ overrides: getOverrides(options, "vue")
1589
+ })
1590
+ );
1431
1591
  }
1432
- if (enableUnoCSS) {
1433
- configs.push(...unocss);
1592
+ if (options.vitest ?? hasVitest) {
1593
+ configs.push(
1594
+ ...vitest({
1595
+ overrides: getOverrides(options, "vitest")
1596
+ })
1597
+ );
1434
1598
  }
1435
- if (enableMarkdown) {
1436
- configs.push(...markdown);
1599
+ if (options.vitest ?? hasVitest) {
1600
+ configs.push(
1601
+ ...unocss({
1602
+ overrides: getOverrides(options, "unocss")
1603
+ })
1604
+ );
1437
1605
  }
1438
- if (enableCommand) {
1439
- configs.push(...command);
1606
+ if (options.markdown ?? true) {
1607
+ configs.push(
1608
+ ...markdown({
1609
+ overrides: getOverrides(options, "markdown")
1610
+ })
1611
+ );
1440
1612
  }
1441
- if (enablePrettier) {
1442
- configs.push(...prettier);
1613
+ if (options.command ?? true) {
1614
+ configs.push(...command());
1443
1615
  }
1444
- if (Object.keys(config).length > 0) {
1445
- configs.push(...Array.isArray(config) ? config : [config]);
1616
+ configs.push(...toArray(customConfig));
1617
+ if (options.prettier ?? true) {
1618
+ configs.push(
1619
+ ...prettier({
1620
+ overrides: getOverrides(options, "prettier")
1621
+ })
1622
+ );
1446
1623
  }
1447
1624
  return configs;
1448
1625
  }
@@ -1466,6 +1643,7 @@ export {
1466
1643
  GLOB_SRC,
1467
1644
  GLOB_SRC_EXT,
1468
1645
  GLOB_STYLE,
1646
+ GLOB_TEST,
1469
1647
  GLOB_TOML,
1470
1648
  GLOB_TS,
1471
1649
  GLOB_TSX,
@@ -1473,10 +1651,11 @@ export {
1473
1651
  GLOB_YAML,
1474
1652
  command,
1475
1653
  comments,
1476
- defineConfig,
1654
+ getOverrides,
1477
1655
  getVueVersion,
1478
1656
  hasTypeScript,
1479
1657
  hasUnoCSS,
1658
+ hasVitest,
1480
1659
  hasVue,
1481
1660
  ignores,
1482
1661
  imports,
@@ -1494,25 +1673,28 @@ export {
1494
1673
  parserVue,
1495
1674
  parserYaml,
1496
1675
  perfectionist,
1497
- default15 as pluginComments,
1498
- default10 as pluginImport,
1676
+ default16 as pluginComments,
1677
+ default11 as pluginImport,
1499
1678
  default7 as pluginJsdoc,
1500
1679
  default6 as pluginJsonc,
1501
- default12 as pluginMarkdown,
1680
+ default13 as pluginMarkdown,
1502
1681
  default2 as pluginNode,
1503
- default13 as pluginPerfectionist,
1504
- default11 as pluginPrettier,
1682
+ default14 as pluginPerfectionist,
1683
+ default12 as pluginPrettier,
1505
1684
  pluginRegexp,
1506
1685
  default5 as pluginToml,
1507
- default9 as pluginUnicorn,
1686
+ default10 as pluginUnicorn,
1508
1687
  default8 as pluginUnoCSS,
1509
- default14 as pluginUnusedImports,
1688
+ default15 as pluginUnusedImports,
1689
+ default9 as pluginVitest,
1510
1690
  default3 as pluginVue,
1511
1691
  default4 as pluginYaml,
1512
1692
  prettier,
1513
1693
  regexp,
1694
+ resolveSubOptions,
1514
1695
  sortPackageJson,
1515
1696
  sortTsConfig,
1697
+ toArray,
1516
1698
  toml,
1517
1699
  tseslint,
1518
1700
  typescript,
@@ -1520,6 +1702,7 @@ export {
1520
1702
  unicorn,
1521
1703
  unocss,
1522
1704
  unusedImports,
1705
+ vitest,
1523
1706
  vue,
1524
1707
  yml
1525
1708
  };