@ntnyq/eslint-config 7.0.0-beta.15 → 7.0.0-beta.16

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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Requirements
12
12
 
13
- - Node.js ^22.13.0 || >=24.11.0
13
+ - Node.js ^22.23.0 || >=24.15.0
14
14
  - ESLint ^10.4.0
15
15
 
16
16
  > [!TIP]
@@ -18,7 +18,7 @@
18
18
  >
19
19
  > - Node.js v18: use [v4](https://github.com/ntnyq/eslint-config/tree/v4)
20
20
  > - Node.js < 20.19.0: use [v5](https://github.com/ntnyq/eslint-config/tree/v5)
21
- > - Node.js < 22.13.0: use [v6](https://github.com/ntnyq/eslint-config/tree/v6)
21
+ > - Node.js < 22.23.0: use [v6](https://github.com/ntnyq/eslint-config/tree/v6)
22
22
 
23
23
  ## Why Frontend Teams Use It
24
24
 
package/dist/index.d.mts CHANGED
@@ -130,15 +130,25 @@ type ConfigNodeOptions = OptionsOverrides;
130
130
  declare const configNode: (options?: ConfigNodeOptions) => TypedConfigItem[];
131
131
  //#endregion
132
132
  //#region src/configs/pnpm.d.ts
133
+ /**
134
+ * Options for a pnpm config branch
135
+ */
136
+ type ConfigPnpmBranchOptions = OptionsFiles & OptionsOverrides;
133
137
  /**
134
138
  * Options type of {@link configPnpm}
135
139
  */
136
- type ConfigPnpmOptions = {
137
- filesJson?: TypedConfigItem['files'];
138
- filesYaml?: TypedConfigItem['files'];
139
- overridesJsonRules?: TypedConfigItem['rules'];
140
- overridesYamlRules?: TypedConfigItem['rules'];
141
- };
140
+ interface ConfigPnpmOptions {
141
+ /**
142
+ * Configure package.json rules
143
+ * @default true
144
+ */
145
+ json?: boolean | ConfigPnpmBranchOptions;
146
+ /**
147
+ * Configure pnpm-workspace.yaml rules
148
+ * @default true
149
+ */
150
+ yaml?: boolean | ConfigPnpmBranchOptions;
151
+ }
142
152
  /**
143
153
  * Config for pnpm package manager
144
154
  *
@@ -207,21 +217,25 @@ type ConfigSVGOOptions = OptionsFiles & OptionsIgnores & OptionsOverrides;
207
217
  declare const configSVGO: (options?: ConfigSVGOOptions) => TypedConfigItem[];
208
218
  //#endregion
209
219
  //#region src/configs/test.d.ts
220
+ /**
221
+ * Options for a test config branch
222
+ */
223
+ type ConfigTestBranchOptions = OptionsFiles & OptionsOverrides;
210
224
  /**
211
225
  * Options type of {@link configTest}
212
226
  */
213
- type ConfigTestOptions = OptionsFiles & OptionsOverrides & {
227
+ interface ConfigTestOptions extends OptionsFiles {
214
228
  /**
215
- * Overrides built-in vitest rules
229
+ * Configure base test rules
230
+ * @default true
216
231
  */
217
- overridesVitestRules?: TypedConfigItem['rules'];
232
+ base?: boolean | ConfigTestBranchOptions;
218
233
  /**
219
- * enable vitest plugin rules
220
- *
234
+ * Configure vitest plugin rules
221
235
  * @default true if vitest in deps
222
236
  */
223
- vitest?: boolean;
224
- };
237
+ vitest?: boolean | ConfigTestBranchOptions;
238
+ }
225
239
  /**
226
240
  * Config for test files
227
241
  *
@@ -602,41 +616,48 @@ interface ConfigPrettierOptions extends OptionsOverrides {
602
616
  declare const configPrettier: (options?: ConfigPrettierOptions) => TypedConfigItem[];
603
617
  //#endregion
604
618
  //#region src/configs/specials.d.ts
619
+ /**
620
+ * Options for a special config branch
621
+ */
622
+ type ConfigSpecialsBranchOptions = OptionsFiles & OptionsOverrides;
605
623
  /**
606
624
  * Options for {@link configSpecials}
607
625
  */
608
626
  interface ConfigSpecialsOptions {
609
627
  /**
610
- * Overrides cli rules
628
+ * More special case configs
611
629
  */
612
- overridesCliRules?: TypedConfigItem['rules'];
630
+ additionalConfigs?: TypedConfigItem[];
613
631
  /**
614
- * Overrides bin rules
632
+ * Configure bin files
633
+ * @default true
615
634
  */
616
- overridesBinRules?: TypedConfigItem['rules'];
635
+ bin?: boolean | ConfigSpecialsBranchOptions;
617
636
  /**
618
- * Overrides config files rules
637
+ * Configure cli files
638
+ * @default true
619
639
  */
620
- overridesConfigFileRules?: TypedConfigItem['rules'];
640
+ cli?: boolean | ConfigSpecialsBranchOptions;
621
641
  /**
622
- * Overrides scripts rules
642
+ * Configure config files
643
+ * @default true
623
644
  */
624
- overridesScriptsRules?: TypedConfigItem['rules'];
645
+ configFiles?: boolean | ConfigSpecialsBranchOptions;
625
646
  /**
626
- * Overrides user scripts rules
647
+ * Configure scripts files
648
+ * @default true
627
649
  */
628
- overridesUserScriptsRules?: TypedConfigItem['rules'];
650
+ scripts?: boolean | ConfigSpecialsBranchOptions;
629
651
  /**
630
- * More special case configs
652
+ * Configure shadcn-vue files
653
+ * @default true if shadcn-vue in deps
631
654
  */
632
- specialCaseConfigs?: TypedConfigItem[];
655
+ shadcnVue?: boolean | ConfigSpecialsBranchOptions;
633
656
  /**
634
- * ShadcnVue config
657
+ * Configure user scripts files
658
+ * @default true
635
659
  */
636
- shadcnVue?: boolean | {
637
- files?: TypedConfigItem['files'];
638
- overridesRules?: TypedConfigItem['rules'];
639
- };
660
+ userScripts?: boolean | ConfigSpecialsBranchOptions;
640
661
  }
641
662
  /**
642
663
  * Config for special files
@@ -778,10 +799,18 @@ type PerfectionistPartitionByComment = boolean | string | string[] | {
778
799
  block?: boolean | string | string[];
779
800
  line?: boolean | string | string[];
780
801
  };
802
+ /**
803
+ * Options for the common perfectionist config
804
+ */
805
+ type ConfigPerfectionistCommonOptions = OptionsOverrides;
806
+ /**
807
+ * Options for a scoped perfectionist config branch
808
+ */
809
+ type ConfigPerfectionistBranchOptions = OptionsFiles & OptionsOverrides;
781
810
  /**
782
811
  * Options type of {@link configPerfectionist}
783
812
  */
784
- type ConfigPerfectionistOptions = OptionsOverrides & {
813
+ interface ConfigPerfectionistOptions {
785
814
  /**
786
815
  * Enable all perfectionist rule
787
816
  *
@@ -791,29 +820,19 @@ type ConfigPerfectionistOptions = OptionsOverrides & {
791
820
  */
792
821
  all?: boolean;
793
822
  /**
794
- * files for `constants`, will overrides default values
795
- */
796
- filesConstants?: TypedConfigItem['files'];
797
- /**
798
- * files for `enums`, will overrides default values
799
- */
800
- filesEnums?: TypedConfigItem['files'];
801
- /**
802
- * files for `types`, will overrides default values
803
- */
804
- filesTypes?: TypedConfigItem['files'];
805
- /**
806
- * Overrides rules for `constants`
823
+ * Configure common rules
807
824
  */
808
- overridesConstantsRules?: TypedConfigItem['rules'];
825
+ common?: ConfigPerfectionistCommonOptions;
809
826
  /**
810
- * Overrides rules for `enums`
827
+ * Configure sorting for constants
828
+ * @default true
811
829
  */
812
- overridesEnumsRules?: TypedConfigItem['rules'];
830
+ constants?: boolean | ConfigPerfectionistBranchOptions;
813
831
  /**
814
- * Overrides rules for `types`
832
+ * Configure sorting for enums
833
+ * @default true
815
834
  */
816
- overridesTypesRules?: TypedConfigItem['rules'];
835
+ enums?: boolean | ConfigPerfectionistBranchOptions;
817
836
  /**
818
837
  * Shared `partitionByComment` option
819
838
  *
@@ -821,24 +840,11 @@ type ConfigPerfectionistOptions = OptionsOverrides & {
821
840
  */
822
841
  partitionByComment?: PerfectionistPartitionByComment;
823
842
  /**
824
- * Enable sort `constants`
825
- *
843
+ * Configure sorting for types
826
844
  * @default true
827
845
  */
828
- sortConstants?: boolean;
829
- /**
830
- * Enable sort `enums`
831
- *
832
- * @default true
833
- */
834
- sortEnums?: boolean;
835
- /**
836
- * Enable sort `types`
837
- *
838
- * @default true
839
- */
840
- sortTypes?: boolean;
841
- };
846
+ types?: boolean | ConfigPerfectionistBranchOptions;
847
+ }
842
848
  /**
843
849
  * Config for sorting imports, exports, objects and etc
844
850
  *
@@ -4836,7 +4842,7 @@ interface RuleOptions {
4836
4842
  */
4837
4843
  'node/no-new-require'?: Linter.RuleEntry<[]>;
4838
4844
  /**
4839
- * disallow string concatenation with `__dirname` and `__filename`
4845
+ * disallow string concatenation with `__dirname`, `__filename`, and `import.meta` paths
4840
4846
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-path-concat.md
4841
4847
  */
4842
4848
  'node/no-path-concat'?: Linter.RuleEntry<[]>;
@@ -4945,11 +4951,21 @@ interface RuleOptions {
4945
4951
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-global/url-search-params.md
4946
4952
  */
4947
4953
  'node/prefer-global/url-search-params'?: Linter.RuleEntry<NodePreferGlobalUrlSearchParams>;
4954
+ /**
4955
+ * enforce using `node:assert/strict` instead of `node:assert`.
4956
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-import/assert-strict.md
4957
+ */
4958
+ 'node/prefer-import/assert-strict'?: Linter.RuleEntry<[]>;
4948
4959
  /**
4949
4960
  * enforce using the `node:` protocol when importing Node.js builtin modules.
4950
4961
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-node-protocol.md
4951
4962
  */
4952
4963
  'node/prefer-node-protocol'?: Linter.RuleEntry<NodePreferNodeProtocol>;
4964
+ /**
4965
+ * enforce using `process.getBuiltinModule()` to load Node.js built-in modules
4966
+ * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-process-get-builtin-module.md
4967
+ */
4968
+ 'node/prefer-process-get-builtin-module'?: Linter.RuleEntry<NodePreferProcessGetBuiltinModule>;
4953
4969
  /**
4954
4970
  * enforce `require("dns").promises`
4955
4971
  * @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/prefer-promises/dns.md
@@ -13956,6 +13972,10 @@ type NodePreferGlobalUrlSearchParams = [] | [("always" | "never")];
13956
13972
  type NodePreferNodeProtocol = [] | [{
13957
13973
  version?: string;
13958
13974
  }];
13975
+ // ----- node/prefer-process-get-builtin-module -----
13976
+ type NodePreferProcessGetBuiltinModule = [] | [{
13977
+ version?: string;
13978
+ }];
13959
13979
  // ----- node/shebang -----
13960
13980
  type NodeShebang = [] | [{
13961
13981
  convertPath?: ({
@@ -20518,4 +20538,4 @@ declare const PERFECTIONIST: Readonly<{
20518
20538
  sortObjectsGroups: string[];
20519
20539
  }>;
20520
20540
  //#endregion
20521
- export { Arrayable, Awaitable, ConfigAntfuOptions, ConfigAstroOptions, ConfigCommandOptions, ConfigDeMorganOptions, ConfigDependOptions, ConfigESLintCommentsOptions, ConfigESLintPluginOptions, ConfigGitHubActionOptions, ConfigGitIgnoreOptions, ConfigHtmlOptions, ConfigIgnoresOptions, ConfigImportXOptions, ConfigJavaScriptOptions, ConfigJsdocOptions, ConfigJsoncOptions, ConfigMarkdownOptions, type ConfigNames, ConfigNodeOptions, ConfigNtnyqOptions, ConfigOptions, ConfigOxfmtOptions, ConfigPerfectionistOptions, ConfigPiniaOptions, ConfigPnpmOptions, ConfigPrettierOptions, ConfigRegexpOptions, ConfigSVGOOptions, ConfigSortOptions, ConfigSpecialsOptions, ConfigSvelteOptions, ConfigTestOptions, ConfigTomlOptions, ConfigTypeScriptOptions, ConfigUnicornOptions, ConfigUnoCSSOptions, ConfigUnusedImportsOptions, ConfigVueOptions, ConfigYmlOptions, ESLintConfig, ESLintParser, ESLintParserOptions, ESLintProcessor, ESLintRuleSeverity, ESLintRulesRecord, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_SCHEMA, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_PNPM_WORKSPACE_YAML, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_SRC_EXTENSIONS, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_YAML, InteropModuleDefault, NonEmptyArray, OptionsFiles, OptionsFormatter, OptionsIgnores, OptionsOverrides, OptionsShareable, PERFECTIONIST, PerfectionistPartitionByComment, PrettierOptions, Pretty, ResolvedOptions, type RuleOptions, TSESLintParserOptions, TypedConfigItem, configAntfu, configAstro, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configGitHubAction, configGitIgnore, configHtml, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configOxfmt, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configSvelte, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, configsTypeScript, defineESLintConfig, ensurePackages, getOverrides, hasOxfmt, hasPinia, hasPrettier, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergeProcessors, parserJsonc, parserPlain, parserToml, parserTypeScript, parserVue, parserYaml, pluginAntfu, pluginDeMorgan, pluginDepend, pluginESLintComments, pluginGitHubAction, pluginImportX, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNoOnlyTests, pluginNode, pluginNtnyq, pluginOxfmt, pluginPerfectionist, pluginPinia, pluginPrettier, pluginRegexp, pluginSvgo, pluginToml, pluginTypeScript, pluginUnicorn, pluginUnoCSS, pluginVitest, pluginVue, pluginYml, processorPassThrough, processorVueBlocks, resolveSubOptions };
20541
+ export { Arrayable, Awaitable, ConfigAntfuOptions, ConfigAstroOptions, ConfigCommandOptions, ConfigDeMorganOptions, ConfigDependOptions, ConfigESLintCommentsOptions, ConfigESLintPluginOptions, ConfigGitHubActionOptions, ConfigGitIgnoreOptions, ConfigHtmlOptions, ConfigIgnoresOptions, ConfigImportXOptions, ConfigJavaScriptOptions, ConfigJsdocOptions, ConfigJsoncOptions, ConfigMarkdownOptions, type ConfigNames, ConfigNodeOptions, ConfigNtnyqOptions, ConfigOptions, ConfigOxfmtOptions, ConfigPerfectionistBranchOptions, ConfigPerfectionistCommonOptions, ConfigPerfectionistOptions, ConfigPiniaOptions, ConfigPnpmBranchOptions, ConfigPnpmOptions, ConfigPrettierOptions, ConfigRegexpOptions, ConfigSVGOOptions, ConfigSortOptions, ConfigSpecialsBranchOptions, ConfigSpecialsOptions, ConfigSvelteOptions, ConfigTestBranchOptions, ConfigTestOptions, ConfigTomlOptions, ConfigTypeScriptOptions, ConfigUnicornOptions, ConfigUnoCSSOptions, ConfigUnusedImportsOptions, ConfigVueOptions, ConfigYmlOptions, ESLintConfig, ESLintParser, ESLintParserOptions, ESLintProcessor, ESLintRuleSeverity, ESLintRulesRecord, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_SCHEMA, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_PNPM_WORKSPACE_YAML, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_SRC_EXTENSIONS, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_YAML, InteropModuleDefault, NonEmptyArray, OptionsFiles, OptionsFormatter, OptionsIgnores, OptionsOverrides, OptionsShareable, PERFECTIONIST, PerfectionistPartitionByComment, PrettierOptions, Pretty, ResolvedOptions, type RuleOptions, TSESLintParserOptions, TypedConfigItem, configAntfu, configAstro, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configGitHubAction, configGitIgnore, configHtml, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configOxfmt, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configSvelte, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, configsTypeScript, defineESLintConfig, ensurePackages, getOverrides, hasOxfmt, hasPinia, hasPrettier, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergeProcessors, parserJsonc, parserPlain, parserToml, parserTypeScript, parserVue, parserYaml, pluginAntfu, pluginDeMorgan, pluginDepend, pluginESLintComments, pluginGitHubAction, pluginImportX, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNoOnlyTests, pluginNode, pluginNtnyq, pluginOxfmt, pluginPerfectionist, pluginPinia, pluginPrettier, pluginRegexp, pluginSvgo, pluginToml, pluginTypeScript, pluginUnicorn, pluginUnoCSS, pluginVitest, pluginVue, pluginYml, processorPassThrough, processorVueBlocks, resolveSubOptions };
package/dist/index.mjs CHANGED
@@ -717,7 +717,7 @@ const configHtml = async (options = {}) => {
717
717
  "@html-eslint/indent": "error",
718
718
  "@html-eslint/no-duplicate-attrs": "error",
719
719
  "@html-eslint/no-duplicate-id": "error",
720
- "@html-eslint/no-extra-spacing-attrs": "error",
720
+ "@html-eslint/no-extra-spacing-tags": "error",
721
721
  "@html-eslint/no-multiple-h1": "error",
722
722
  "@html-eslint/no-obsolete-tags": "error",
723
723
  "@html-eslint/quotes": "error",
@@ -753,6 +753,8 @@ const configNode = (options = {}) => [{
753
753
  "node/no-path-concat": "error",
754
754
  "node/prefer-global/buffer": ["error", "never"],
755
755
  "node/prefer-global/process": ["error", "never"],
756
+ "node/prefer-import/assert-strict": "error",
757
+ "node/prefer-process-get-builtin-module": "error",
756
758
  "node/process-exit-as-throw": "error",
757
759
  ...options.overrides
758
760
  }
@@ -768,30 +770,36 @@ const configNode = (options = {}) => [{
768
770
  * @returns ESLint configs
769
771
  */
770
772
  const configPnpm = async (options = {}) => {
773
+ const { json: enableJson = true, yaml: enableYaml = true } = options;
774
+ const jsonOptions = resolveSubOptions(options, "json");
775
+ const yamlOptions = resolveSubOptions(options, "yaml");
776
+ if (!enableJson && !enableYaml) return [];
771
777
  await ensurePackages(["eslint-plugin-pnpm"]);
772
778
  const pluginPnpm = await interopDefault(import("eslint-plugin-pnpm"));
773
- const { filesJson = [GLOB_PACKAGE_JSON], filesYaml = [GLOB_PNPM_WORKSPACE_YAML] } = options;
774
- return [{
779
+ const configs = [];
780
+ if (enableJson) configs.push({
775
781
  name: "ntnyq/pnpm/package-json",
776
- files: filesJson,
782
+ files: jsonOptions.files ?? ["**/package.json"],
777
783
  plugins: { pnpm: pluginPnpm },
778
784
  languageOptions: { parser: parserJsonc },
779
785
  rules: {
780
786
  "pnpm/json-enforce-catalog": ["error", { autofix: true }],
781
787
  "pnpm/json-valid-catalog": "error",
782
- ...options.overridesJsonRules
788
+ ...jsonOptions.overrides
783
789
  }
784
- }, {
790
+ });
791
+ if (enableYaml) configs.push({
785
792
  name: "ntnyq/pnpm/pnpm-workspace-yaml",
786
- files: filesYaml,
793
+ files: yamlOptions.files ?? ["**/pnpm-workspace.yaml"],
787
794
  plugins: { pnpm: pluginPnpm },
788
795
  languageOptions: { parser: parserYaml },
789
796
  rules: {
790
797
  "pnpm/yaml-no-duplicate-catalog-item": "error",
791
798
  "pnpm/yaml-no-unused-catalog-item": "error",
792
- ...options.overridesYamlRules
799
+ ...yamlOptions.overrides
793
800
  }
794
- }];
801
+ });
802
+ return configs;
795
803
  };
796
804
  //#endregion
797
805
  //#region src/configs/sort.ts
@@ -1229,23 +1237,26 @@ const configSVGO = (options = {}) => {
1229
1237
  * @returns ESLint configs
1230
1238
  */
1231
1239
  const configTest = (options = {}) => {
1232
- const { files = [...GLOB_TEST], vitest: enableVitest = hasVitest() } = options;
1233
- const configs = [{
1240
+ const { files = [...GLOB_TEST], base: enableBase = true, vitest: enableVitest = hasVitest() } = options;
1241
+ const baseOptions = resolveSubOptions(options, "base");
1242
+ const vitestOptions = resolveSubOptions(options, "vitest");
1243
+ const configs = [];
1244
+ if (enableBase) configs.push({
1234
1245
  name: "ntnyq/test/setup",
1235
1246
  plugins: { "no-only-tests": pluginNoOnlyTests }
1236
1247
  }, {
1237
1248
  name: "ntnyq/test/base",
1238
- files,
1249
+ files: baseOptions.files ?? files,
1239
1250
  rules: {
1240
1251
  "max-lines-per-function": "off",
1241
1252
  "no-unused-expressions": "off",
1242
1253
  "no-only-tests/no-only-tests": "error",
1243
- ...options.overrides
1254
+ ...baseOptions.overrides
1244
1255
  }
1245
- }];
1256
+ });
1246
1257
  if (enableVitest) configs.push({
1247
1258
  name: "ntnyq/test/vitest",
1248
- files,
1259
+ files: vitestOptions.files ?? files,
1249
1260
  plugins: { vitest: pluginVitest },
1250
1261
  settings: {},
1251
1262
  rules: {
@@ -1256,7 +1267,7 @@ const configTest = (options = {}) => {
1256
1267
  "expectTypeOf",
1257
1268
  "assertType"
1258
1269
  ] }],
1259
- ...options.overridesVitestRules
1270
+ ...vitestOptions.overrides
1260
1271
  }
1261
1272
  });
1262
1273
  return configs;
@@ -1433,6 +1444,7 @@ const configJsdoc = (options = {}) => {
1433
1444
  "internal"
1434
1445
  ] }],
1435
1446
  "jsdoc/check-types": "error",
1447
+ "jsdoc/escape-inline-tags": "error",
1436
1448
  /**
1437
1449
  * @pg Fixable rules
1438
1450
  */
@@ -1531,6 +1543,7 @@ const configJsonc = (options = {}) => {
1531
1543
  plugins: { jsonc: pluginJsonc },
1532
1544
  languageOptions: { parser: parserJsonc },
1533
1545
  rules: {
1546
+ "no-irregular-whitespace": "off",
1534
1547
  "jsonc/array-bracket-spacing": ["error", "never"],
1535
1548
  "jsonc/comma-dangle": ["error", "never"],
1536
1549
  "jsonc/comma-style": ["error", "last"],
@@ -1547,6 +1560,7 @@ const configJsonc = (options = {}) => {
1547
1560
  "jsonc/no-floating-decimal": "error",
1548
1561
  "jsonc/no-hexadecimal-numeric-literals": "error",
1549
1562
  "jsonc/no-infinity": "error",
1563
+ "jsonc/no-irregular-whitespace": "error",
1550
1564
  "jsonc/no-multi-str": "error",
1551
1565
  "jsonc/no-nan": "error",
1552
1566
  "jsonc/no-number-props": "error",
@@ -2122,7 +2136,6 @@ const configUnicorn = (options = {}) => {
2122
2136
  */
2123
2137
  "unicorn/consistent-template-literal-escape": "error",
2124
2138
  "unicorn/escape-case": "error",
2125
- "unicorn/no-hex-escape": "error",
2126
2139
  "unicorn/no-unnecessary-string-trim": "error",
2127
2140
  "unicorn/no-unsafe-string-replacement": "error",
2128
2141
  "unicorn/prefer-code-point": "error",
@@ -2131,6 +2144,7 @@ const configUnicorn = (options = {}) => {
2131
2144
  "unicorn/prefer-string-slice": "error",
2132
2145
  "unicorn/prefer-string-starts-ends-with": "error",
2133
2146
  "unicorn/prefer-string-trim-start-end": "error",
2147
+ "unicorn/prefer-unicode-code-point-escapes": "error",
2134
2148
  /**
2135
2149
  * @pg DOM
2136
2150
  */
@@ -2513,83 +2527,85 @@ const PERFECTIONIST = Object.freeze({
2513
2527
  * @returns ESLint configs
2514
2528
  */
2515
2529
  const configSpecials = (options = {}) => {
2516
- const { shadcnVue: enableShadcnVue = hasShadcnVue() } = options;
2517
- const configs = [
2518
- {
2519
- name: "ntnyq/specials/scripts",
2520
- files: [`**/scripts/${GLOB_SRC}`],
2521
- rules: {
2522
- "@typescript-eslint/explicit-function-return-type": "off",
2523
- "no-console": "off",
2524
- ...options.overridesScriptsRules
2525
- }
2526
- },
2527
- {
2528
- name: "ntnyq/specials/cli",
2529
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
2530
- rules: {
2531
- "@typescript-eslint/explicit-function-return-type": "off",
2532
- "no-console": "off",
2533
- ...options.overridesCliRules
2534
- }
2535
- },
2536
- {
2537
- name: "ntnyq/specials/bin",
2538
- files: [`**/bin/${GLOB_SRC}`, `**/bin.${GLOB_SRC_EXT}`],
2539
- rules: {
2540
- "@typescript-eslint/explicit-function-return-type": "off",
2541
- "antfu/no-import-dist": "off",
2542
- "no-console": "off",
2543
- ...options.overridesBinRules
2544
- }
2545
- },
2546
- {
2547
- name: "ntnyq/specials/userscript",
2548
- files: [`**/*.user.${GLOB_SRC_EXT}`],
2549
- languageOptions: { globals: { ...globals.greasemonkey } },
2550
- rules: {
2551
- camelcase: ["error", { allow: ["^GM_.+"] }],
2552
- ...options.overridesUserScriptsRules
2553
- }
2530
+ const { additionalConfigs, bin: enableBin = true, cli: enableCli = true, configFiles: enableConfigFiles = true, scripts: enableScripts = true, shadcnVue: enableShadcnVue = hasShadcnVue(), userScripts: enableUserScripts = true } = options;
2531
+ const binOptions = resolveSubOptions(options, "bin");
2532
+ const cliOptions = resolveSubOptions(options, "cli");
2533
+ const configFilesOptions = resolveSubOptions(options, "configFiles");
2534
+ const scriptsOptions = resolveSubOptions(options, "scripts");
2535
+ const shadcnVueOptions = resolveSubOptions(options, "shadcnVue");
2536
+ const userScriptsOptions = resolveSubOptions(options, "userScripts");
2537
+ const configs = [];
2538
+ if (enableScripts) configs.push({
2539
+ name: "ntnyq/specials/scripts",
2540
+ files: scriptsOptions.files ?? [`**/scripts/${GLOB_SRC}`],
2541
+ rules: {
2542
+ "@typescript-eslint/explicit-function-return-type": "off",
2543
+ "no-console": "off",
2544
+ ...scriptsOptions.overrides
2545
+ }
2546
+ });
2547
+ if (enableCli) configs.push({
2548
+ name: "ntnyq/specials/cli",
2549
+ files: cliOptions.files ?? [`**/cli/${GLOB_SRC}`, `**/cli.?([cm])[jt]s?(x)`],
2550
+ rules: {
2551
+ "@typescript-eslint/explicit-function-return-type": "off",
2552
+ "no-console": "off",
2553
+ ...cliOptions.overrides
2554
+ }
2555
+ });
2556
+ if (enableBin) configs.push({
2557
+ name: "ntnyq/specials/bin",
2558
+ files: binOptions.files ?? [`**/bin/${GLOB_SRC}`, `**/bin.?([cm])[jt]s?(x)`],
2559
+ rules: {
2560
+ "@typescript-eslint/explicit-function-return-type": "off",
2561
+ "antfu/no-import-dist": "off",
2562
+ "no-console": "off",
2563
+ ...binOptions.overrides
2564
+ }
2565
+ });
2566
+ if (enableUserScripts) configs.push({
2567
+ name: "ntnyq/specials/userscript",
2568
+ files: userScriptsOptions.files ?? [`**/*.user.?([cm])[jt]s?(x)`],
2569
+ languageOptions: { globals: { ...globals.greasemonkey } },
2570
+ rules: {
2571
+ camelcase: ["error", { allow: ["^GM_.+"] }],
2572
+ ...userScriptsOptions.overrides
2573
+ }
2574
+ });
2575
+ if (enableConfigFiles) configs.push({
2576
+ name: "ntnyq/specials/config-file",
2577
+ files: configFilesOptions.files ?? [`**/*.config*.?([cm])[jt]s?(x)`],
2578
+ plugins: {
2579
+ "import-x": pluginImportX,
2580
+ perfectionist: pluginPerfectionist
2554
2581
  },
2555
- {
2556
- name: "ntnyq/specials/config-file",
2557
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
2558
- plugins: {
2559
- "import-x": pluginImportX,
2560
- perfectionist: pluginPerfectionist
2561
- },
2562
- settings: { perfectionist: PERFECTIONIST.pluginSettings },
2563
- rules: {
2564
- "@typescript-eslint/explicit-function-return-type": "off",
2565
- "import-x/no-default-export": "off",
2566
- "no-console": "off",
2567
- "perfectionist/sort-objects": ["error", {
2568
- ...PERFECTIONIST.partialRuleOptions,
2569
- groups: PERFECTIONIST.sortObjectsGroups
2570
- }],
2571
- ...options.overridesConfigFileRules
2572
- }
2582
+ settings: { perfectionist: PERFECTIONIST.pluginSettings },
2583
+ rules: {
2584
+ "@typescript-eslint/explicit-function-return-type": "off",
2585
+ "import-x/no-default-export": "off",
2586
+ "no-console": "off",
2587
+ "perfectionist/sort-objects": ["error", {
2588
+ ...PERFECTIONIST.partialRuleOptions,
2589
+ groups: PERFECTIONIST.sortObjectsGroups
2590
+ }],
2591
+ ...configFilesOptions.overrides
2573
2592
  }
2574
- ];
2575
- if (enableShadcnVue) {
2576
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
2577
- configs.push({
2578
- name: "ntnyq/specials/shadcn-vue",
2579
- files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
2580
- rules: {
2581
- "@typescript-eslint/consistent-type-imports": "off",
2582
- "@typescript-eslint/no-unused-vars": "off",
2583
- "import-x/consistent-type-specifier-style": "off",
2584
- "vue/define-emits-declaration": "off",
2585
- "vue/html-button-has-type": "off",
2586
- "vue/no-duplicate-attr-inheritance": "off",
2587
- "vue/prefer-use-template-ref": "off",
2588
- ...shadcnOptions.overridesRules
2589
- }
2590
- });
2591
- }
2592
- if (options.specialCaseConfigs) configs.push(...options.specialCaseConfigs);
2593
+ });
2594
+ if (enableShadcnVue) configs.push({
2595
+ name: "ntnyq/specials/shadcn-vue",
2596
+ files: shadcnVueOptions.files ?? ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
2597
+ rules: {
2598
+ "@typescript-eslint/consistent-type-imports": "off",
2599
+ "@typescript-eslint/no-unused-vars": "off",
2600
+ "import-x/consistent-type-specifier-style": "off",
2601
+ "vue/define-emits-declaration": "off",
2602
+ "vue/html-button-has-type": "off",
2603
+ "vue/no-duplicate-attr-inheritance": "off",
2604
+ "vue/prefer-use-template-ref": "off",
2605
+ ...shadcnVueOptions.overrides
2606
+ }
2607
+ });
2608
+ if (additionalConfigs) configs.push(...additionalConfigs);
2593
2609
  return configs;
2594
2610
  };
2595
2611
  //#endregion
@@ -3077,7 +3093,14 @@ const configGitHubAction = (options = {}) => {
3077
3093
  * @returns ESLint configs
3078
3094
  */
3079
3095
  const configPerfectionist = (options = {}) => {
3080
- const { filesEnums = [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`], filesTypes = [...GLOB_TYPES], partitionByComment = PERFECTIONIST.partialRuleOptions.partitionByComment, sortConstants: enableSortConstants = true, sortEnums: enableSortEnums = true, sortTypes: enableSortTypes = true, filesConstants = [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`] } = options;
3096
+ const { all: enableAll = false, constants: enableSortConstants = true, enums: enableSortEnums = true, partitionByComment = PERFECTIONIST.partialRuleOptions.partitionByComment, types: enableSortTypes = true } = options;
3097
+ const commonOptions = resolveSubOptions(options, "common");
3098
+ const constantsOptions = resolveSubOptions(options, "constants");
3099
+ const enumsOptions = resolveSubOptions(options, "enums");
3100
+ const typesOptions = resolveSubOptions(options, "types");
3101
+ const filesConstants = constantsOptions.files ?? [`**/constants/${GLOB_SRC}`, `**/constants.?([cm])[jt]s?(x)`];
3102
+ const filesEnums = enumsOptions.files ?? [`**/enums/${GLOB_SRC}`, `**/enums.?([cm])[jt]s?(x)`];
3103
+ const filesTypes = typesOptions.files ?? [...GLOB_TYPES];
3081
3104
  const sharedOptionsWithNewlinesBetween = {
3082
3105
  newlinesBetween: "ignore",
3083
3106
  partitionByComment
@@ -3171,21 +3194,21 @@ const configPerfectionist = (options = {}) => {
3171
3194
  settings: { perfectionist: PERFECTIONIST.pluginSettings }
3172
3195
  };
3173
3196
  const configs = [{
3174
- name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
3197
+ name: enableAll ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
3175
3198
  ...sharedConfig,
3176
3199
  rules: {
3177
3200
  ...commonRules,
3178
- ...options.all ? {
3201
+ ...enableAll ? {
3179
3202
  ...sharedRules,
3180
3203
  ...sortEnumsRules,
3181
3204
  ...sortTypesRules,
3182
3205
  ...sortConstantsRules,
3183
3206
  ...extraRules
3184
3207
  } : {},
3185
- ...options.overrides
3208
+ ...commonOptions.overrides
3186
3209
  }
3187
3210
  }];
3188
- if (options.all) return configs;
3211
+ if (enableAll) return configs;
3189
3212
  if (enableSortEnums) configs.push({
3190
3213
  name: "ntnyq/perfectionist/enums",
3191
3214
  files: filesEnums,
@@ -3193,7 +3216,7 @@ const configPerfectionist = (options = {}) => {
3193
3216
  rules: {
3194
3217
  ...sharedRules,
3195
3218
  ...sortEnumsRules,
3196
- ...options.overridesEnumsRules
3219
+ ...enumsOptions.overrides
3197
3220
  }
3198
3221
  });
3199
3222
  if (enableSortTypes) configs.push({
@@ -3203,7 +3226,7 @@ const configPerfectionist = (options = {}) => {
3203
3226
  rules: {
3204
3227
  ...sharedRules,
3205
3228
  ...sortTypesRules,
3206
- ...options.overridesTypesRules
3229
+ ...typesOptions.overrides
3207
3230
  }
3208
3231
  });
3209
3232
  if (enableSortConstants) configs.push({
@@ -3213,7 +3236,7 @@ const configPerfectionist = (options = {}) => {
3213
3236
  rules: {
3214
3237
  ...sharedRules,
3215
3238
  ...sortConstantsRules,
3216
- ...options.overridesConstantsRules
3239
+ ...constantsOptions.overrides
3217
3240
  }
3218
3241
  });
3219
3242
  return configs;
@@ -3302,10 +3325,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3302
3325
  overrides: getOverrides(options, "jsdoc"),
3303
3326
  ...resolveSubOptions(options, "jsdoc")
3304
3327
  }));
3305
- if (enablePerfectionist) configs.push(configPerfectionist({
3306
- ...resolveSubOptions(options, "perfectionist"),
3307
- overrides: getOverrides(options, "perfectionist")
3308
- }));
3328
+ if (enablePerfectionist) configs.push(configPerfectionist(resolveSubOptions(options, "perfectionist")));
3309
3329
  if (enableUnicorn) configs.push(configUnicorn({
3310
3330
  ...resolveSubOptions(options, "unicorn"),
3311
3331
  overrides: getOverrides(options, "unicorn")
@@ -3362,10 +3382,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3362
3382
  extraFileExtensions
3363
3383
  }));
3364
3384
  if (enableSort) configs.push(configSort(resolveSubOptions(options, "sort")));
3365
- if (enableTest) configs.push(configTest({
3366
- ...resolveSubOptions(options, "test"),
3367
- overrides: getOverrides(options, "test")
3368
- }));
3385
+ if (enableTest) configs.push(configTest(resolveSubOptions(options, "test")));
3369
3386
  if (enableUnoCSS) configs.push(configUnoCSS({ overrides: getOverrides(options, "unocss") }));
3370
3387
  if (enableMarkdown) configs.push(configMarkdown({
3371
3388
  ...resolveSubOptions(options, "markdown"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "7.0.0-beta.15",
4
+ "version": "7.0.0-beta.16",
5
5
  "description": "An opinionated ESLint config preset of ntnyq",
6
6
  "keywords": [
7
7
  "eslint",
@@ -89,9 +89,9 @@
89
89
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
90
90
  "@eslint/js": "^10.0.1",
91
91
  "@eslint/markdown": "^8.0.3",
92
- "@ntnyq/utils": "^0.21.0",
92
+ "@ntnyq/utils": "^0.21.1",
93
93
  "@unocss/eslint-plugin": "^66.7.5",
94
- "@vitest/eslint-plugin": "^1.6.26",
94
+ "@vitest/eslint-plugin": "^1.6.27",
95
95
  "eslint-config-flat-gitignore": "^2.3.0",
96
96
  "eslint-flat-config-utils": "^3.2.0",
97
97
  "eslint-import-resolver-typescript": "^4.4.5",
@@ -103,9 +103,9 @@
103
103
  "eslint-plugin-depend": "^1.5.0",
104
104
  "eslint-plugin-github-action": "^0.3.0",
105
105
  "eslint-plugin-import-x": "^4.17.1",
106
- "eslint-plugin-jsdoc": "^63.3.3",
106
+ "eslint-plugin-jsdoc": "^64.1.0",
107
107
  "eslint-plugin-jsonc": "^3.4.1",
108
- "eslint-plugin-n": "^18.2.2",
108
+ "eslint-plugin-n": "^18.3.0",
109
109
  "eslint-plugin-no-only-tests": "^3.4.0",
110
110
  "eslint-plugin-ntnyq": "^0.14.0",
111
111
  "eslint-plugin-oxfmt": "^0.17.0",
@@ -117,39 +117,39 @@
117
117
  "eslint-plugin-toml": "^1.5.0",
118
118
  "eslint-plugin-unicorn": "^73.0.0",
119
119
  "eslint-plugin-vue": "^10.10.0",
120
- "eslint-plugin-yml": "^3.8.0",
120
+ "eslint-plugin-yml": "^3.8.1",
121
121
  "eslint-processor-vue-blocks": "^2.0.0",
122
122
  "globals": "^17.9.0",
123
- "jsonc-eslint-parser": "^3.1.0",
123
+ "jsonc-eslint-parser": "^3.3.0",
124
124
  "local-pkg": "^1.2.1",
125
125
  "toml-eslint-parser": "^1.0.3",
126
- "typescript-eslint": "^8.66.0",
126
+ "typescript-eslint": "^8.67.0",
127
127
  "vue-eslint-parser": "^10.4.1",
128
128
  "yaml-eslint-parser": "^2.1.0"
129
129
  },
130
130
  "devDependencies": {
131
- "@types/node": "^26.1.2",
132
- "@typescript-eslint/types": "^8.66.0",
131
+ "@types/node": "^26.2.0",
132
+ "@typescript-eslint/types": "^8.67.0",
133
133
  "@typescript/native-preview": "^7.0.0-dev.20260707.2",
134
- "bumpp": "^12.1.1",
134
+ "bumpp": "^12.2.0",
135
135
  "consola": "^3.4.2",
136
- "eslint": "^10.8.0",
136
+ "eslint": "^10.8.1",
137
137
  "eslint-typegen": "^2.3.1",
138
138
  "husky": "^9.1.7",
139
139
  "jiti": "^2.7.0",
140
140
  "nano-staged": "^1.0.2",
141
141
  "npm-run-all2": "^9.0.3",
142
- "oxfmt": "^0.62.0",
142
+ "oxfmt": "^0.63.0",
143
143
  "prettier": "^3.9.6",
144
144
  "tinyglobby": "^0.2.17",
145
145
  "tsdown": "^0.22.14",
146
- "tsx": "^4.23.5",
146
+ "tsx": "^4.23.12",
147
147
  "typescript": "^6.0.3",
148
148
  "uncase": "^0.3.0",
149
149
  "vitest": "^4.1.10"
150
150
  },
151
151
  "engines": {
152
- "node": "^22.13.0 || >=24.11.0"
152
+ "node": "^22.23.0 || >=24.15.0"
153
153
  },
154
154
  "nano-staged": {
155
155
  "*.{js,ts,tsx,mjs,md,vue,svg,yml,yaml,toml,json}": "eslint --fix",