@ntnyq/eslint-config 6.1.0 → 6.1.2

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
@@ -1,6 +1,6 @@
1
1
  # @ntnyq/eslint-config
2
2
 
3
- > 🎨 ESLint config for JavaScript, TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG and etc.
3
+ > 🎨 ESLint config for JavaScript, TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG, and more.
4
4
 
5
5
  [![CI](https://github.com/ntnyq/eslint-config/workflows/CI/badge.svg)](https://github.com/ntnyq/eslint-config/actions)
6
6
  [![NPM VERSION](https://img.shields.io/npm/v/@ntnyq/eslint-config/latest.svg)](https://www.npmjs.com/package/@ntnyq/eslint-config/v/latest)
@@ -24,7 +24,7 @@
24
24
 
25
25
  ## ✨ Features
26
26
 
27
- - ✅ Designed to work alongside formatter e.g: [Prettier](https://prettier.io) or [oxfmt](https://oxc.rs/docs/guide/usage/formatter)
27
+ - ✅ Designed to work alongside formatters, e.g. [Prettier](https://prettier.io) or [oxfmt](https://oxc.rs/docs/guide/usage/formatter)
28
28
  - 🎯 Opinionated: single quote, no semi, trailing comma, etc
29
29
  - 🪄 Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
30
30
  - 📦 Out-of-the-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG, Astro, Svelte, etc
@@ -150,7 +150,7 @@ export default defineConfig({
150
150
  })
151
151
  ```
152
152
 
153
- ## 💻 VSCode config
153
+ ## 💻 VS Code config
154
154
 
155
155
  ```json
156
156
  {
@@ -221,13 +221,6 @@ For details, see:
221
221
  - [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
222
222
  - [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
223
223
 
224
- ## ⚙️ Advanced config
225
-
226
- For details, see:
227
-
228
- - [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
229
- - [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
230
-
231
224
  ### 📝 Config interface
232
225
 
233
226
  ```ts
@@ -283,6 +276,7 @@ export interface ConfigOptions {
283
276
  svelte?: boolean | ConfigSvelteOptions
284
277
  svgo?: boolean | ConfigSVGOOptions
285
278
  eslintPlugin?: boolean | ConfigESLintPluginOptions
279
+ unusedImports?: boolean | ConfigUnusedImportsOptions
286
280
  }
287
281
  ```
288
282
 
package/dist/index.d.mts CHANGED
@@ -4347,7 +4347,7 @@ interface RuleOptions {
4347
4347
  */
4348
4348
  'no-octal-escape'?: Linter.RuleEntry<[]>;
4349
4349
  /**
4350
- * disallow .only blocks in tests
4350
+ * disallow focused/only tests
4351
4351
  * @see https://github.com/levibuzolic/eslint-plugin-no-only-tests
4352
4352
  */
4353
4353
  'no-only-tests/no-only-tests'?: Linter.RuleEntry<NoOnlyTestsNoOnlyTests>;
@@ -12505,7 +12505,7 @@ type OxfmtOxfmt = [] | [{
12505
12505
  separateTagGroups?: boolean;
12506
12506
  });
12507
12507
  jsxSingleQuote?: boolean;
12508
- objectWrap?: ("preserve" | "collapse" | "always");
12508
+ objectWrap?: ("preserve" | "collapse");
12509
12509
  printWidth?: number;
12510
12510
  proseWrap?: ("always" | "never" | "preserve");
12511
12511
  quoteProps?: ("as-needed" | "consistent" | "preserve");
@@ -12573,7 +12573,7 @@ type OxfmtOxfmt = [] | [{
12573
12573
  separateTagGroups?: boolean;
12574
12574
  });
12575
12575
  jsxSingleQuote?: boolean;
12576
- objectWrap?: ("preserve" | "collapse" | "always");
12576
+ objectWrap?: ("preserve" | "collapse");
12577
12577
  printWidth?: number;
12578
12578
  proseWrap?: ("always" | "never" | "preserve");
12579
12579
  quoteProps?: ("as-needed" | "consistent" | "preserve");
@@ -17860,7 +17860,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
17860
17860
  exceptRange?: boolean;
17861
17861
  onlyEquality?: boolean;
17862
17862
  }]; // Names of all the configs
17863
- type ConfigNames = 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/jsx' | 'ntnyq/node' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/import-x' | 'ntnyq/jsdoc' | 'ntnyq/perfectionist/common' | 'ntnyq/perfectionist/enums' | 'ntnyq/perfectionist/types' | 'ntnyq/perfectionist/constants' | 'ntnyq/unicorn' | 'ntnyq/pinia' | 'ntnyq/de-morgan' | 'ntnyq/regexp' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/parser-type-aware' | 'ntnyq/ts/rules' | 'ntnyq/ts/rules/type-aware' | 'ntnyq/ts/types' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yml' | 'ntnyq/toml' | 'ntnyq/jsonc' | 'ntnyq/astro' | 'ntnyq/svelte' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/json-schema' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/test/setup' | 'ntnyq/test/base' | 'ntnyq/test/vitest' | 'ntnyq/unocss' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled' | 'ntnyq/antfu' | 'ntnyq/depend' | 'ntnyq/depend/package-json' | 'ntnyq/ntnyq' | 'ntnyq/github-action' | 'ntnyq/eslint-plugin' | 'ntnyq/pnpm/package-json' | 'ntnyq/pnpm/pnpm-workspace-yaml' | 'ntnyq/svgo' | 'ntnyq/html' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/bin' | 'ntnyq/specials/userscript' | 'ntnyq/specials/config-file' | 'ntnyq/specials/shadcn-vue' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/oxfmt/setup' | 'ntnyq/oxfmt/basic' | 'ntnyq/oxfmt/extensions';
17863
+ type ConfigNames = 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/jsx' | 'ntnyq/node' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/import-x' | 'ntnyq/jsdoc' | 'ntnyq/perfectionist/common' | 'ntnyq/perfectionist/enums' | 'ntnyq/perfectionist/types' | 'ntnyq/perfectionist/constants' | 'ntnyq/unicorn' | 'ntnyq/pinia' | 'ntnyq/de-morgan' | 'ntnyq/regexp' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/parser-type-aware' | 'ntnyq/ts/rules' | 'ntnyq/ts/rules/type-aware' | 'ntnyq/ts/types' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yml' | 'ntnyq/toml' | 'ntnyq/jsonc' | 'ntnyq/astro' | 'ntnyq/svelte' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/json-schema' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/test/setup' | 'ntnyq/test/base' | 'ntnyq/test/vitest' | 'ntnyq/unocss' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled' | 'ntnyq/antfu' | 'ntnyq/depend' | 'ntnyq/depend/package-json' | 'ntnyq/ntnyq' | 'ntnyq/github-action' | 'ntnyq/eslint-plugin' | 'ntnyq/pnpm/package-json' | 'ntnyq/pnpm/pnpm-workspace-yaml' | 'ntnyq/svgo' | 'ntnyq/html' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/bin' | 'ntnyq/specials/userscript' | 'ntnyq/specials/config-file' | 'ntnyq/specials/shadcn-vue' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/oxfmt/without-parser' | 'ntnyq/oxfmt/with-parser';
17864
17864
  //#endregion
17865
17865
  //#region src/types/eslint.d.ts
17866
17866
  /**
@@ -17978,13 +17978,10 @@ interface ConfigOptions {
17978
17978
  * @pg
17979
17979
  */
17980
17980
  antfu?: boolean | ConfigAntfuOptions;
17981
- astro?: boolean | ConfigAstroOptions;
17982
17981
  deMorgan?: boolean | ConfigDeMorganOptions;
17983
17982
  depend?: boolean | ConfigDependOptions;
17984
- eslintPlugin?: boolean | ConfigESLintPluginOptions;
17985
17983
  githubAction?: boolean | ConfigGitHubActionOptions;
17986
17984
  gitignore?: boolean | ConfigGitIgnoreOptions;
17987
- html?: boolean | ConfigHtmlOptions;
17988
17985
  importX?: boolean | ConfigImportXOptions;
17989
17986
  jsdoc?: boolean | ConfigJsdocOptions;
17990
17987
  jsonc?: boolean | ConfigJsoncOptions;
@@ -17993,13 +17990,10 @@ interface ConfigOptions {
17993
17990
  oxfmt?: boolean | ConfigOxfmtOptions;
17994
17991
  perfectionist?: boolean | ConfigPerfectionistOptions;
17995
17992
  pinia?: boolean | ConfigPiniaOptions;
17996
- pnpm?: boolean | ConfigPnpmOptions;
17997
17993
  prettier?: boolean | ConfigPrettierOptions;
17998
17994
  regexp?: boolean | ConfigRegexpOptions;
17999
17995
  sort?: boolean | ConfigSortOptions;
18000
17996
  specials?: boolean | ConfigSpecialsOptions;
18001
- svelte?: boolean | ConfigSvelteOptions;
18002
- svgo?: boolean | ConfigSVGOOptions;
18003
17997
  test?: boolean | ConfigTestOptions;
18004
17998
  toml?: boolean | ConfigTomlOptions;
18005
17999
  typescript?: boolean | ConfigTypeScriptOptions;
@@ -18007,11 +18001,16 @@ interface ConfigOptions {
18007
18001
  unocss?: boolean | ConfigUnoCSSOptions;
18008
18002
  vue?: boolean | ConfigVueOptions;
18009
18003
  yml?: boolean | ConfigYmlOptions;
18010
- }
18011
- /**
18012
- * Not enabled for now, maybe later
18013
- */
18014
- interface ConfigOptionsInternal {
18004
+ /**
18005
+ * Configs below are disabled by default
18006
+ * @pg
18007
+ */
18008
+ astro?: boolean | ConfigAstroOptions;
18009
+ eslintPlugin?: boolean | ConfigESLintPluginOptions;
18010
+ html?: boolean | ConfigHtmlOptions;
18011
+ pnpm?: boolean | ConfigPnpmOptions;
18012
+ svelte?: boolean | ConfigSvelteOptions;
18013
+ svgo?: boolean | ConfigSVGOOptions;
18015
18014
  unusedImports?: boolean | ConfigUnusedImportsOptions;
18016
18015
  }
18017
18016
  //#endregion
@@ -18147,4 +18146,4 @@ declare const PERFECTIONIST: Readonly<{
18147
18146
  sortObjectsGroups: string[];
18148
18147
  }>;
18149
18148
  //#endregion
18150
- export { Arrayable, Awaitable, ConfigAntfuOptions, ConfigAstroOptions, ConfigCommandOptions, ConfigDeMorganOptions, ConfigDependOptions, ConfigESLintCommentsOptions, ConfigESLintPluginOptions, ConfigGitHubActionOptions, ConfigGitIgnoreOptions, ConfigHtmlOptions, ConfigIgnoresOptions, ConfigImportXOptions, ConfigJavaScriptOptions, ConfigJsdocOptions, ConfigJsoncOptions, ConfigMarkdownOptions, ConfigNames, ConfigNodeOptions, ConfigNtnyqOptions, ConfigOptions, ConfigOptionsInternal, 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, 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 };
18149
+ export { Arrayable, Awaitable, ConfigAntfuOptions, ConfigAstroOptions, ConfigCommandOptions, ConfigDeMorganOptions, ConfigDependOptions, ConfigESLintCommentsOptions, ConfigESLintPluginOptions, ConfigGitHubActionOptions, ConfigGitIgnoreOptions, ConfigHtmlOptions, ConfigIgnoresOptions, ConfigImportXOptions, ConfigJavaScriptOptions, ConfigJsdocOptions, ConfigJsoncOptions, ConfigMarkdownOptions, 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, 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
@@ -619,12 +619,14 @@ async function ensurePackages(packages) {
619
619
  if (process.env.CI || !process.stdout.isTTY || isInGitHooksOrRunBySpecifyPackages() || !isCwdInScope) return;
620
620
  const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
621
621
  if (nonExistingPackages.length === 0) return;
622
- const { confirm } = await import("@clack/prompts");
623
- if (await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` })) try {
622
+ const { confirm, isCancel } = await import("@clack/prompts");
623
+ const confirmInstall = await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
624
+ if (isCancel(confirmInstall) || confirmInstall !== true) return;
625
+ try {
624
626
  const { installPackage } = await import("@antfu/install-pkg");
625
627
  await installPackage(nonExistingPackages, { dev: true });
626
628
  } catch (err) {
627
- console.log(err);
629
+ throw new Error(`Failed to install required packages: ${nonExistingPackages.join(", ")}`, { cause: err });
628
630
  }
629
631
  }
630
632
  //#endregion
@@ -1560,32 +1562,36 @@ const configNtnyq = (options = {}) => [{
1560
1562
  * @returns ESLint configs
1561
1563
  */
1562
1564
  const configOxfmt = (options = {}) => {
1563
- const { files = [GLOB_SRC, GLOB_VUE], ignores = [], filesExtensions = GLOB_SRC_EXTENSIONS } = options;
1564
- return [
1565
- {
1566
- name: "ntnyq/oxfmt/setup",
1567
- plugins: { oxfmt: pluginOxfmt }
1568
- },
1569
- {
1570
- name: "ntnyq/oxfmt/basic",
1571
- files,
1572
- ignores,
1573
- rules: {
1574
- "oxfmt/oxfmt": "error",
1575
- ...options.overrides
1576
- }
1577
- },
1578
- {
1579
- name: "ntnyq/oxfmt/extensions",
1580
- files: filesExtensions,
1581
- ignores: [GLOB_SRC, GLOB_VUE],
1582
- languageOptions: { parser: parserPlain },
1583
- rules: {
1584
- "oxfmt/oxfmt": "error",
1585
- ...options.overrides
1586
- }
1565
+ const { files: filesWithoutParser = [
1566
+ GLOB_SRC,
1567
+ GLOB_VUE,
1568
+ GLOB_JSON,
1569
+ GLOB_JSON5,
1570
+ GLOB_JSONC,
1571
+ GLOB_YAML,
1572
+ GLOB_TOML,
1573
+ GLOB_MARKDOWN
1574
+ ], ignores: ignoresWithoutParser = [], filesExtensions: filesWithParser = [GLOB_STYLE, GLOB_HTML] } = options;
1575
+ return [{
1576
+ name: "ntnyq/oxfmt/without-parser",
1577
+ files: filesWithoutParser,
1578
+ ignores: ignoresWithoutParser,
1579
+ plugins: { oxfmt: pluginOxfmt },
1580
+ rules: {
1581
+ "oxfmt/oxfmt": "error",
1582
+ ...options.overrides
1587
1583
  }
1588
- ];
1584
+ }, {
1585
+ name: "ntnyq/oxfmt/with-parser",
1586
+ files: filesWithParser,
1587
+ ignores: filesWithoutParser.flat(),
1588
+ plugins: { oxfmt: pluginOxfmt },
1589
+ languageOptions: { parser: parserPlain },
1590
+ rules: {
1591
+ "oxfmt/oxfmt": "error",
1592
+ ...options.overrides
1593
+ }
1594
+ }];
1589
1595
  };
1590
1596
  //#endregion
1591
1597
  //#region src/configs/pinia.ts
@@ -2989,7 +2995,7 @@ const configPerfectionist = (options = {}) => {
2989
2995
  const extraRules = {
2990
2996
  "perfectionist/sort-array-includes": ["error", {
2991
2997
  ...sharedOptionsWithNewlinesBetween,
2992
- groups: ["literal", "spread"]
2998
+ groups: ["literal"]
2993
2999
  }],
2994
3000
  "perfectionist/sort-classes": ["error", {
2995
3001
  ...sharedOptionsWithNewlinesBetween,
@@ -3002,7 +3008,10 @@ const configPerfectionist = (options = {}) => {
3002
3008
  "unknown"
3003
3009
  ] }],
3004
3010
  "perfectionist/sort-switch-case": "error",
3005
- "perfectionist/sort-variable-declarations": ["error", { partitionByComment }]
3011
+ "perfectionist/sort-variable-declarations": ["error", {
3012
+ groups: ["initialized", "uninitialized"],
3013
+ partitionByComment
3014
+ }]
3006
3015
  };
3007
3016
  const sharedConfig = {
3008
3017
  plugins: { perfectionist: pluginPerfectionist },
@@ -3116,9 +3125,10 @@ const configESLintComments = (options = {}) => [{
3116
3125
  * Config factory
3117
3126
  */
3118
3127
  function defineESLintConfig(options = {}, ...userConfigs) {
3119
- const { shareable = {}, ignores: userIgnores = [], vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = hasTypeScript(), oxfmt: enableOxfmt = hasOxfmt(), prettier: enablePrettier = hasPrettier(), yml: enableYML = true, sort: enableSort = true, toml: enableTOML = true, jsonc: enableJSONC = true, antfu: enableAntfu = true, ntnyq: enableNtnyq = true, depend: enableDepend = true, regexp: enableRegexp = true, unicorn: enableUnicorn = true, deMorgan: enableDeMorgan = true, markdown: enableMarkdown = true, gitignore: enableGitIgnore = true, jsdoc: enableJsdoc = true, importX: enableImportX = true, specials: enableSpecials = true, githubAction: enableGitHubAction = true, perfectionist: enablePerfectionist = true, pnpm: enablePnpm = false, svgo: enableSVGO = false, html: enableHTML = false, astro: enableAstro = false, svelte: enableSvelte = false, eslintPlugin: enableESLintPlugin = false } = options;
3128
+ const { shareable = {}, ignores: userIgnores = [], vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = hasTypeScript(), oxfmt: enableOxfmt = hasOxfmt(), prettier: enablePrettier = hasPrettier(), yml: enableYML = true, sort: enableSort = true, toml: enableTOML = true, jsonc: enableJSONC = true, antfu: enableAntfu = true, ntnyq: enableNtnyq = true, depend: enableDepend = true, regexp: enableRegexp = true, unicorn: enableUnicorn = true, deMorgan: enableDeMorgan = true, markdown: enableMarkdown = true, gitignore: enableGitIgnore = true, jsdoc: enableJsdoc = true, importX: enableImportX = true, specials: enableSpecials = true, githubAction: enableGitHubAction = true, perfectionist: enablePerfectionist = true, pnpm: enablePnpm = false, svgo: enableSVGO = false, html: enableHTML = false, astro: enableAstro = false, svelte: enableSvelte = false, eslintPlugin: enableESLintPlugin = false, unusedImports: enableUnusedImports = false } = options;
3120
3129
  const configs = [];
3121
- const { ecmaVersion = "latest", extraFileExtensions = [] } = shareable;
3130
+ const { ecmaVersion = "latest", extraFileExtensions: shareableExtraFileExtensions = [] } = shareable;
3131
+ const extraFileExtensions = [...shareableExtraFileExtensions];
3122
3132
  const usingFormatter = enablePrettier || enableOxfmt;
3123
3133
  if (enableVue) extraFileExtensions.push(".vue");
3124
3134
  if (enableAstro) extraFileExtensions.push(".astro");
@@ -3214,6 +3224,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3214
3224
  if (enableESLintPlugin) configs.push(configESLintPlugin({ overrides: getOverrides(options, "eslintPlugin") }));
3215
3225
  if (enablePnpm) configs.push(configPnpm(resolveSubOptions(options, "pnpm")));
3216
3226
  if (enableSVGO) configs.push(configSVGO(resolveSubOptions(options, "svgo")));
3227
+ if (enableUnusedImports) configs.push(configUnusedImports({ overrides: getOverrides(options, "unusedImports") }));
3217
3228
  if (enableHTML) configs.push(configHtml({
3218
3229
  ...resolveSubOptions(options, "html"),
3219
3230
  overrides: getOverrides(options, "html")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "6.1.0",
4
+ "version": "6.1.2",
5
5
  "description": "An opinionated ESLint config preset of ntnyq",
6
6
  "keywords": [
7
7
  "eslint",
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@antfu/install-pkg": "^1.1.0",
85
- "@clack/prompts": "^1.2.0",
85
+ "@clack/prompts": "^1.3.0",
86
86
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
87
87
  "@eslint/js": "^10.0.1",
88
88
  "@eslint/markdown": "^8.0.1",
@@ -102,9 +102,9 @@
102
102
  "eslint-plugin-jsdoc": "^62.9.0",
103
103
  "eslint-plugin-jsonc": "^3.1.2",
104
104
  "eslint-plugin-n": "^17.24.0",
105
- "eslint-plugin-no-only-tests": "^3.3.0",
105
+ "eslint-plugin-no-only-tests": "^3.4.0",
106
106
  "eslint-plugin-ntnyq": "^0.14.0",
107
- "eslint-plugin-oxfmt": "^0.4.0",
107
+ "eslint-plugin-oxfmt": "^0.5.1",
108
108
  "eslint-plugin-perfectionist": "^5.9.0",
109
109
  "eslint-plugin-pinia": "^0.4.2",
110
110
  "eslint-plugin-prettier": "^5.5.5",
@@ -119,15 +119,15 @@
119
119
  "jsonc-eslint-parser": "^3.1.0",
120
120
  "local-pkg": "^1.1.2",
121
121
  "toml-eslint-parser": "^1.0.3",
122
- "typescript-eslint": "^8.59.0",
122
+ "typescript-eslint": "^8.59.1",
123
123
  "vue-eslint-parser": "^10.4.0",
124
124
  "yaml-eslint-parser": "^2.0.0"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@types/node": "^25.6.0",
128
- "@typescript-eslint/types": "^8.59.0",
129
- "@typescript-eslint/utils": "^8.59.0",
130
- "@typescript/native-preview": "^7.0.0-dev.20260422.1",
128
+ "@typescript-eslint/types": "^8.59.1",
129
+ "@typescript-eslint/utils": "^8.59.1",
130
+ "@typescript/native-preview": "^7.0.0-dev.20260429.1",
131
131
  "bumpp": "^11.0.1",
132
132
  "consola": "^3.4.2",
133
133
  "eslint": "^10.2.1",
@@ -136,7 +136,7 @@
136
136
  "jiti": "^2.6.1",
137
137
  "nano-staged": "^1.0.2",
138
138
  "npm-run-all2": "^8.0.4",
139
- "oxfmt": "^0.46.0",
139
+ "oxfmt": "^0.47.0",
140
140
  "prettier": "^3.8.3",
141
141
  "tinyglobby": "^0.2.16",
142
142
  "tsdown": "^0.21.10",