@ntnyq/eslint-config 6.1.3 → 6.1.4
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.d.mts +88 -9
- package/dist/index.mjs +53 -1
- package/package.json +22 -22
package/dist/index.d.mts
CHANGED
|
@@ -1015,8 +1015,14 @@ interface RuleOptions {
|
|
|
1015
1015
|
/**
|
|
1016
1016
|
* Disallow extra spacing around attributes
|
|
1017
1017
|
* @see https://html-eslint.org/docs/rules/no-extra-spacing-attrs
|
|
1018
|
+
* @deprecated
|
|
1018
1019
|
*/
|
|
1019
1020
|
'@html-eslint/no-extra-spacing-attrs'?: Linter.RuleEntry<HtmlEslintNoExtraSpacingAttrs>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Disallow extra spacing inside tags
|
|
1023
|
+
* @see https://html-eslint.org/docs/rules/no-extra-spacing-tags
|
|
1024
|
+
*/
|
|
1025
|
+
'@html-eslint/no-extra-spacing-tags'?: Linter.RuleEntry<HtmlEslintNoExtraSpacingTags>;
|
|
1020
1026
|
/**
|
|
1021
1027
|
* Disallow unnecessary consecutive spaces
|
|
1022
1028
|
* @see https://html-eslint.org/docs/rules/no-extra-spacing-text
|
|
@@ -1930,12 +1936,12 @@ interface RuleOptions {
|
|
|
1930
1936
|
*/
|
|
1931
1937
|
'accessor-pairs'?: Linter.RuleEntry<AccessorPairs>;
|
|
1932
1938
|
/**
|
|
1933
|
-
*
|
|
1939
|
+
* Enforce consistent line breaks for chaining member access
|
|
1934
1940
|
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-chaining.md
|
|
1935
1941
|
*/
|
|
1936
1942
|
'antfu/consistent-chaining'?: Linter.RuleEntry<AntfuConsistentChaining>;
|
|
1937
1943
|
/**
|
|
1938
|
-
*
|
|
1944
|
+
* Enforce consistent line breaks inside braces and parentheses
|
|
1939
1945
|
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
|
|
1940
1946
|
*/
|
|
1941
1947
|
'antfu/consistent-list-newline'?: Linter.RuleEntry<AntfuConsistentListNewline>;
|
|
@@ -1961,22 +1967,22 @@ interface RuleOptions {
|
|
|
1961
1967
|
'antfu/indent-unindent'?: Linter.RuleEntry<AntfuIndentUnindent>;
|
|
1962
1968
|
/**
|
|
1963
1969
|
* Prevent importing modules in `dist` folder
|
|
1964
|
-
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.
|
|
1970
|
+
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.md
|
|
1965
1971
|
*/
|
|
1966
1972
|
'antfu/no-import-dist'?: Linter.RuleEntry<[]>;
|
|
1967
1973
|
/**
|
|
1968
1974
|
* Prevent importing modules in `node_modules` folder by relative or absolute path
|
|
1969
|
-
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.
|
|
1975
|
+
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.md
|
|
1970
1976
|
*/
|
|
1971
1977
|
'antfu/no-import-node-modules-by-path'?: Linter.RuleEntry<[]>;
|
|
1972
1978
|
/**
|
|
1973
1979
|
* Prevent using top-level await
|
|
1974
|
-
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.
|
|
1980
|
+
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.md
|
|
1975
1981
|
*/
|
|
1976
1982
|
'antfu/no-top-level-await'?: Linter.RuleEntry<[]>;
|
|
1977
1983
|
/**
|
|
1978
1984
|
* Do not use `exports =`
|
|
1979
|
-
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.
|
|
1985
|
+
* @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.md
|
|
1980
1986
|
*/
|
|
1981
1987
|
'antfu/no-ts-export-equal'?: Linter.RuleEntry<[]>;
|
|
1982
1988
|
/**
|
|
@@ -7371,7 +7377,7 @@ interface RuleOptions {
|
|
|
7371
7377
|
*/
|
|
7372
7378
|
'vitest/prefer-expect-resolves'?: Linter.RuleEntry<[]>;
|
|
7373
7379
|
/**
|
|
7374
|
-
* enforce using `
|
|
7380
|
+
* enforce using `expect(...).toBeTypeOf(...)` instead of `expect(typeof ...).toBe(...)`
|
|
7375
7381
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md
|
|
7376
7382
|
*/
|
|
7377
7383
|
'vitest/prefer-expect-type-of'?: Linter.RuleEntry<[]>;
|
|
@@ -9017,6 +9023,12 @@ type HtmlEslintNoExtraSpacingAttrs = [] | [{
|
|
|
9017
9023
|
disallowMissing?: boolean;
|
|
9018
9024
|
disallowTabs?: boolean;
|
|
9019
9025
|
enforceBeforeSelfClose?: boolean;
|
|
9026
|
+
}]; // ----- @html-eslint/no-extra-spacing-tags -----
|
|
9027
|
+
type HtmlEslintNoExtraSpacingTags = [] | [{
|
|
9028
|
+
disallowInAssignment?: boolean;
|
|
9029
|
+
disallowMissing?: boolean;
|
|
9030
|
+
disallowTabs?: boolean;
|
|
9031
|
+
enforceBeforeSelfClose?: boolean;
|
|
9020
9032
|
}]; // ----- @html-eslint/no-extra-spacing-text -----
|
|
9021
9033
|
type HtmlEslintNoExtraSpacingText = [] | [{
|
|
9022
9034
|
skip?: string[];
|
|
@@ -12540,12 +12552,25 @@ type OxfmtOxfmt = [] | [{
|
|
|
12540
12552
|
preserveWhitespace?: boolean;
|
|
12541
12553
|
stylesheet?: string;
|
|
12542
12554
|
});
|
|
12555
|
+
svelte?: (boolean | {
|
|
12556
|
+
allowShorthand?: boolean;
|
|
12557
|
+
indentScriptAndStyle?: boolean;
|
|
12558
|
+
sortOrder?: string;
|
|
12559
|
+
});
|
|
12543
12560
|
tabWidth?: number;
|
|
12544
12561
|
trailingComma?: ("all" | "es5" | "none");
|
|
12545
12562
|
useTabs?: boolean;
|
|
12546
12563
|
vueIndentScriptAndStyle?: boolean;
|
|
12547
12564
|
configPath?: string;
|
|
12565
|
+
disableNestedConfig?: boolean;
|
|
12566
|
+
editorconfig?: (boolean | {
|
|
12567
|
+
cwd?: string;
|
|
12568
|
+
onlyCwd?: boolean;
|
|
12569
|
+
});
|
|
12570
|
+
ignorePath?: (string | string[]);
|
|
12571
|
+
respectOxfmtDefaultIgnores?: boolean;
|
|
12548
12572
|
useConfig?: boolean;
|
|
12573
|
+
withNodeModules?: boolean;
|
|
12549
12574
|
overrides?: {
|
|
12550
12575
|
excludeFiles?: string[];
|
|
12551
12576
|
files: string[];
|
|
@@ -12608,6 +12633,11 @@ type OxfmtOxfmt = [] | [{
|
|
|
12608
12633
|
preserveWhitespace?: boolean;
|
|
12609
12634
|
stylesheet?: string;
|
|
12610
12635
|
});
|
|
12636
|
+
svelte?: (boolean | {
|
|
12637
|
+
allowShorthand?: boolean;
|
|
12638
|
+
indentScriptAndStyle?: boolean;
|
|
12639
|
+
sortOrder?: string;
|
|
12640
|
+
});
|
|
12611
12641
|
tabWidth?: number;
|
|
12612
12642
|
trailingComma?: ("all" | "es5" | "none");
|
|
12613
12643
|
useTabs?: boolean;
|
|
@@ -18077,25 +18107,61 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
18077
18107
|
//#endregion
|
|
18078
18108
|
//#region src/utils/env.d.ts
|
|
18079
18109
|
type ExistChecker = () => boolean;
|
|
18110
|
+
/**
|
|
18111
|
+
* Check whether Pinia is available in the current project.
|
|
18112
|
+
*/
|
|
18080
18113
|
declare const hasPinia: ExistChecker;
|
|
18114
|
+
/**
|
|
18115
|
+
* Check whether Vitest is available in the current project.
|
|
18116
|
+
*/
|
|
18081
18117
|
declare const hasVitest: ExistChecker;
|
|
18118
|
+
/**
|
|
18119
|
+
* Check whether TypeScript runtime or preview package is available.
|
|
18120
|
+
*/
|
|
18082
18121
|
declare const hasTypeScript: ExistChecker;
|
|
18122
|
+
/**
|
|
18123
|
+
* Check whether shadcn-vue related dependencies are available.
|
|
18124
|
+
*/
|
|
18083
18125
|
declare const hasShadcnVue: ExistChecker;
|
|
18126
|
+
/**
|
|
18127
|
+
* Check whether UnoCSS runtime packages are available.
|
|
18128
|
+
*/
|
|
18084
18129
|
declare const hasUnoCSS: ExistChecker;
|
|
18130
|
+
/**
|
|
18131
|
+
* Check whether Vue ecosystem packages are available.
|
|
18132
|
+
*/
|
|
18085
18133
|
declare const hasVue: ExistChecker;
|
|
18086
18134
|
/**
|
|
18087
|
-
*
|
|
18135
|
+
* Check whether oxfmt is available in the current project.
|
|
18088
18136
|
*/
|
|
18089
18137
|
declare const hasOxfmt: ExistChecker;
|
|
18138
|
+
/**
|
|
18139
|
+
* Check whether Prettier is available in the current project.
|
|
18140
|
+
*/
|
|
18090
18141
|
declare const hasPrettier: ExistChecker;
|
|
18091
18142
|
//#endregion
|
|
18092
18143
|
//#region src/utils/getOverrides.d.ts
|
|
18144
|
+
/**
|
|
18145
|
+
* Read rule overrides from a config sub-option.
|
|
18146
|
+
*
|
|
18147
|
+
* @param options - Top-level config options.
|
|
18148
|
+
* @param key - Sub-option key to read.
|
|
18149
|
+
* @returns Rule override map when provided, otherwise an empty object.
|
|
18150
|
+
*/
|
|
18093
18151
|
declare function getOverrides<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): Partial<TypedConfigItem['rules'] & RuleOptions>;
|
|
18094
18152
|
//#endregion
|
|
18095
18153
|
//#region src/utils/ensurePackages.d.ts
|
|
18096
18154
|
/**
|
|
18097
18155
|
* @copyright {@link https://github.com/antfu/eslint-config}
|
|
18098
18156
|
*/
|
|
18157
|
+
/**
|
|
18158
|
+
* Ensure required packages are installed for optional config features.
|
|
18159
|
+
*
|
|
18160
|
+
* Skips installation prompts in CI, non-TTY environments, git hooks, and
|
|
18161
|
+
* when the current project is outside the config usage scope.
|
|
18162
|
+
*
|
|
18163
|
+
* @param packages - Package names to verify and optionally install.
|
|
18164
|
+
*/
|
|
18099
18165
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
18100
18166
|
//#endregion
|
|
18101
18167
|
//#region src/utils/interopDefault.d.ts
|
|
@@ -18107,9 +18173,22 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
18107
18173
|
declare function interopDefault<T>(mod: Awaitable<T>): Promise<InteropModuleDefault<T>>;
|
|
18108
18174
|
//#endregion
|
|
18109
18175
|
//#region src/utils/resolveSubOptions.d.ts
|
|
18176
|
+
/**
|
|
18177
|
+
* Normalize a sub-option value to an object.
|
|
18178
|
+
*
|
|
18179
|
+
* Boolean `true` means enabled with default options and returns an empty
|
|
18180
|
+
* object; falsy values also fall back to an empty object.
|
|
18181
|
+
*
|
|
18182
|
+
* @param options - Options object that contains sub-options.
|
|
18183
|
+
* @param key - Sub-option key to resolve.
|
|
18184
|
+
* @returns Normalized sub-options object.
|
|
18185
|
+
*/
|
|
18110
18186
|
declare function resolveSubOptions<T extends Record<string, any>, K extends keyof T>(options: T, key: K): Partial<ResolvedOptions<T[K]>>;
|
|
18111
18187
|
//#endregion
|
|
18112
18188
|
//#region src/utils/isInGitHooksOrRunBySpecifyPackages.d.ts
|
|
18189
|
+
/**
|
|
18190
|
+
* Detect whether current execution is triggered by git hook tooling.
|
|
18191
|
+
*/
|
|
18113
18192
|
declare function isInGitHooksOrRunBySpecifyPackages(): boolean;
|
|
18114
18193
|
//#endregion
|
|
18115
18194
|
//#region src/constants/perfectionist.d.ts
|
|
@@ -18145,4 +18224,4 @@ declare const PERFECTIONIST: Readonly<{
|
|
|
18145
18224
|
sortObjectsGroups: string[];
|
|
18146
18225
|
}>;
|
|
18147
18226
|
//#endregion
|
|
18148
|
-
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 };
|
|
18227
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -573,24 +573,62 @@ const configYml = (options = {}) => {
|
|
|
573
573
|
};
|
|
574
574
|
//#endregion
|
|
575
575
|
//#region src/utils/env.ts
|
|
576
|
+
/**
|
|
577
|
+
* Check whether Pinia is available in the current project.
|
|
578
|
+
*/
|
|
576
579
|
const hasPinia = () => isPackageExists("pinia");
|
|
580
|
+
/**
|
|
581
|
+
* Check whether Vitest is available in the current project.
|
|
582
|
+
*/
|
|
577
583
|
const hasVitest = () => isPackageExists("vitest");
|
|
584
|
+
/**
|
|
585
|
+
* Check whether TypeScript runtime or preview package is available.
|
|
586
|
+
*/
|
|
578
587
|
const hasTypeScript = () => isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
|
|
588
|
+
/**
|
|
589
|
+
* Check whether shadcn-vue related dependencies are available.
|
|
590
|
+
*/
|
|
579
591
|
const hasShadcnVue = () => (isPackageExists("radix-vue") || isPackageExists("reka-ui")) && isPackageExists("class-variance-authority") && isPackageExists("clsx");
|
|
592
|
+
/**
|
|
593
|
+
* Check whether UnoCSS runtime packages are available.
|
|
594
|
+
*/
|
|
580
595
|
const hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
596
|
+
/**
|
|
597
|
+
* Check whether Vue ecosystem packages are available.
|
|
598
|
+
*/
|
|
581
599
|
const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", { paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")] });
|
|
582
600
|
/**
|
|
583
|
-
*
|
|
601
|
+
* Check whether oxfmt is available in the current project.
|
|
584
602
|
*/
|
|
585
603
|
const hasOxfmt = () => isPackageExists("oxfmt");
|
|
604
|
+
/**
|
|
605
|
+
* Check whether Prettier is available in the current project.
|
|
606
|
+
*/
|
|
586
607
|
const hasPrettier = () => isPackageExists("prettier");
|
|
587
608
|
//#endregion
|
|
588
609
|
//#region src/utils/resolveSubOptions.ts
|
|
610
|
+
/**
|
|
611
|
+
* Normalize a sub-option value to an object.
|
|
612
|
+
*
|
|
613
|
+
* Boolean `true` means enabled with default options and returns an empty
|
|
614
|
+
* object; falsy values also fall back to an empty object.
|
|
615
|
+
*
|
|
616
|
+
* @param options - Options object that contains sub-options.
|
|
617
|
+
* @param key - Sub-option key to resolve.
|
|
618
|
+
* @returns Normalized sub-options object.
|
|
619
|
+
*/
|
|
589
620
|
function resolveSubOptions(options, key) {
|
|
590
621
|
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
591
622
|
}
|
|
592
623
|
//#endregion
|
|
593
624
|
//#region src/utils/getOverrides.ts
|
|
625
|
+
/**
|
|
626
|
+
* Read rule overrides from a config sub-option.
|
|
627
|
+
*
|
|
628
|
+
* @param options - Top-level config options.
|
|
629
|
+
* @param key - Sub-option key to read.
|
|
630
|
+
* @returns Rule override map when provided, otherwise an empty object.
|
|
631
|
+
*/
|
|
594
632
|
function getOverrides(options, key) {
|
|
595
633
|
const subOptions = resolveSubOptions(options, key);
|
|
596
634
|
return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
|
|
@@ -603,6 +641,9 @@ const CHECKED_RUNNER_PACKAGES = [
|
|
|
603
641
|
"lefthook",
|
|
604
642
|
"tsx"
|
|
605
643
|
];
|
|
644
|
+
/**
|
|
645
|
+
* Detect whether current execution is triggered by git hook tooling.
|
|
646
|
+
*/
|
|
606
647
|
function isInGitHooksOrRunBySpecifyPackages() {
|
|
607
648
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || CHECKED_RUNNER_PACKAGES.some((packageName) => process.env.npm_lifecycle_script?.startsWith(packageName)));
|
|
608
649
|
}
|
|
@@ -612,9 +653,20 @@ function isInGitHooksOrRunBySpecifyPackages() {
|
|
|
612
653
|
* @copyright {@link https://github.com/antfu/eslint-config}
|
|
613
654
|
*/
|
|
614
655
|
const isCwdInScope = isPackageExists("@ntnyq/eslint-config");
|
|
656
|
+
/**
|
|
657
|
+
* Check whether a package can be resolved from this config package scope.
|
|
658
|
+
*/
|
|
615
659
|
function isPackageInScope(name) {
|
|
616
660
|
return isPackageExists(name, { paths: [import.meta.dirname] });
|
|
617
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* Ensure required packages are installed for optional config features.
|
|
664
|
+
*
|
|
665
|
+
* Skips installation prompts in CI, non-TTY environments, git hooks, and
|
|
666
|
+
* when the current project is outside the config usage scope.
|
|
667
|
+
*
|
|
668
|
+
* @param packages - Package names to verify and optionally install.
|
|
669
|
+
*/
|
|
618
670
|
async function ensurePackages(packages) {
|
|
619
671
|
if (process.env.CI || !process.stdout.isTTY || isInGitHooksOrRunBySpecifyPackages() || !isCwdInScope) return;
|
|
620
672
|
const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.1.
|
|
4
|
+
"version": "6.1.4",
|
|
5
5
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"tag": "latest"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
40
|
-
"@html-eslint/parser": "^0.
|
|
39
|
+
"@html-eslint/eslint-plugin": "^0.60.0",
|
|
40
|
+
"@html-eslint/parser": "^0.60.0",
|
|
41
41
|
"astro-eslint-parser": "^1.4.0",
|
|
42
42
|
"eslint": "^9.38.0 || ^10.0.0",
|
|
43
43
|
"eslint-plugin-astro": "^1.6.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"eslint-plugin-pnpm": "^1.6.0",
|
|
46
46
|
"eslint-plugin-svelte": "^3.17.0",
|
|
47
47
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
48
|
-
"svelte": "^5.55.
|
|
48
|
+
"svelte": "^5.55.8",
|
|
49
49
|
"svelte-eslint-parser": "^1.6.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
@@ -82,19 +82,19 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@antfu/install-pkg": "^1.1.0",
|
|
85
|
-
"@clack/prompts": "^1.
|
|
85
|
+
"@clack/prompts": "^1.4.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",
|
|
89
89
|
"@ntnyq/utils": "^0.13.2",
|
|
90
90
|
"@unocss/eslint-plugin": "^66.6.8",
|
|
91
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
91
|
+
"@vitest/eslint-plugin": "^1.6.17",
|
|
92
92
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
93
|
-
"eslint-flat-config-utils": "3.0
|
|
93
|
+
"eslint-flat-config-utils": "3.2.0",
|
|
94
94
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
95
95
|
"eslint-merge-processors": "^2.0.0",
|
|
96
96
|
"eslint-parser-plain": "^0.1.1",
|
|
97
|
-
"eslint-plugin-antfu": "^3.2.
|
|
97
|
+
"eslint-plugin-antfu": "^3.2.3",
|
|
98
98
|
"eslint-plugin-command": "^3.5.2",
|
|
99
99
|
"eslint-plugin-de-morgan": "^2.1.2",
|
|
100
100
|
"eslint-plugin-depend": "^1.5.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"eslint-plugin-n": "^18.0.1",
|
|
106
106
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
107
107
|
"eslint-plugin-ntnyq": "^0.14.0",
|
|
108
|
-
"eslint-plugin-oxfmt": "^0.
|
|
108
|
+
"eslint-plugin-oxfmt": "^0.8.0",
|
|
109
109
|
"eslint-plugin-perfectionist": "^5.9.0",
|
|
110
110
|
"eslint-plugin-pinia": "^0.4.2",
|
|
111
111
|
"eslint-plugin-prettier": "^5.5.5",
|
|
@@ -118,33 +118,33 @@
|
|
|
118
118
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
119
119
|
"globals": "^17.6.0",
|
|
120
120
|
"jsonc-eslint-parser": "^3.1.0",
|
|
121
|
-
"local-pkg": "^1.
|
|
121
|
+
"local-pkg": "^1.2.0",
|
|
122
122
|
"toml-eslint-parser": "^1.0.3",
|
|
123
|
-
"typescript-eslint": "^8.59.
|
|
123
|
+
"typescript-eslint": "^8.59.4",
|
|
124
124
|
"vue-eslint-parser": "^10.4.0",
|
|
125
125
|
"yaml-eslint-parser": "^2.0.0"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@types/node": "^25.
|
|
129
|
-
"@typescript-eslint/types": "^8.59.
|
|
130
|
-
"@typescript-eslint/utils": "^8.59.
|
|
131
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
132
|
-
"bumpp": "^11.0
|
|
128
|
+
"@types/node": "^25.9.1",
|
|
129
|
+
"@typescript-eslint/types": "^8.59.4",
|
|
130
|
+
"@typescript-eslint/utils": "^8.59.4",
|
|
131
|
+
"@typescript/native-preview": "^7.0.0-dev.20260519.1",
|
|
132
|
+
"bumpp": "^11.1.0",
|
|
133
133
|
"consola": "^3.4.2",
|
|
134
|
-
"eslint": "^10.
|
|
134
|
+
"eslint": "^10.4.0",
|
|
135
135
|
"eslint-typegen": "^2.3.1",
|
|
136
136
|
"husky": "^9.1.7",
|
|
137
137
|
"jiti": "^2.7.0",
|
|
138
138
|
"nano-staged": "^1.0.2",
|
|
139
|
-
"npm-run-all2": "^
|
|
140
|
-
"oxfmt": "^0.
|
|
139
|
+
"npm-run-all2": "^9.0.0",
|
|
140
|
+
"oxfmt": "^0.51.0",
|
|
141
141
|
"prettier": "^3.8.3",
|
|
142
142
|
"tinyglobby": "^0.2.16",
|
|
143
|
-
"tsdown": "^0.
|
|
144
|
-
"tsx": "^4.
|
|
143
|
+
"tsdown": "^0.22.0",
|
|
144
|
+
"tsx": "^4.22.3",
|
|
145
145
|
"typescript": "^6.0.3",
|
|
146
146
|
"uncase": "^0.2.0",
|
|
147
|
-
"vitest": "^4.1.
|
|
147
|
+
"vitest": "^4.1.6"
|
|
148
148
|
},
|
|
149
149
|
"engines": {
|
|
150
150
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|