@ntnyq/eslint-config 6.0.1 → 6.1.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.d.mts +28 -14
- package/dist/index.mjs +81 -11
- package/package.json +17 -17
package/dist/index.d.mts
CHANGED
|
@@ -8049,7 +8049,7 @@ interface RuleOptions {
|
|
|
8049
8049
|
* disallow object, array, and function literals in template
|
|
8050
8050
|
* @see https://eslint.vuejs.org/rules/no-literals-in-template.html
|
|
8051
8051
|
*/
|
|
8052
|
-
'vue/no-literals-in-template'?: Linter.RuleEntry<
|
|
8052
|
+
'vue/no-literals-in-template'?: Linter.RuleEntry<VueNoLiteralsInTemplate>;
|
|
8053
8053
|
/**
|
|
8054
8054
|
* disallow unnecessary `<template>`
|
|
8055
8055
|
* @see https://eslint.vuejs.org/rules/no-lone-template.html
|
|
@@ -8442,6 +8442,11 @@ interface RuleOptions {
|
|
|
8442
8442
|
* @see https://eslint.vuejs.org/rules/prefer-separate-static-class.html
|
|
8443
8443
|
*/
|
|
8444
8444
|
'vue/prefer-separate-static-class'?: Linter.RuleEntry<[]>;
|
|
8445
|
+
/**
|
|
8446
|
+
* enforce passing a single argument to custom event emissions
|
|
8447
|
+
* @see https://eslint.vuejs.org/rules/prefer-single-event-payload.html
|
|
8448
|
+
*/
|
|
8449
|
+
'vue/prefer-single-event-payload'?: Linter.RuleEntry<[]>;
|
|
8445
8450
|
/**
|
|
8446
8451
|
* Require template literals instead of string concatenation in `<template>`
|
|
8447
8452
|
* @see https://eslint.vuejs.org/rules/prefer-template.html
|
|
@@ -8457,6 +8462,11 @@ interface RuleOptions {
|
|
|
8457
8462
|
* @see https://eslint.vuejs.org/rules/prefer-use-template-ref.html
|
|
8458
8463
|
*/
|
|
8459
8464
|
'vue/prefer-use-template-ref'?: Linter.RuleEntry<[]>;
|
|
8465
|
+
/**
|
|
8466
|
+
* enforce using `v-model` instead of `:prop`/`@update:prop` pair
|
|
8467
|
+
* @see https://eslint.vuejs.org/rules/prefer-v-model.html
|
|
8468
|
+
*/
|
|
8469
|
+
'vue/prefer-v-model'?: Linter.RuleEntry<[]>;
|
|
8460
8470
|
/**
|
|
8461
8471
|
* enforce specific casing for the Prop name in Vue components
|
|
8462
8472
|
* @see https://eslint.vuejs.org/rules/prop-name-casing.html
|
|
@@ -12964,6 +12974,7 @@ type PerfectionistSortClasses = {
|
|
|
12964
12974
|
matchesAstSelector?: string;
|
|
12965
12975
|
};
|
|
12966
12976
|
useExperimentalDependencyDetection?: boolean;
|
|
12977
|
+
newlinesBetweenOverloadSignatures?: ("ignore" | number);
|
|
12967
12978
|
ignoreCallbackDependenciesPatterns?: (({
|
|
12968
12979
|
pattern: string;
|
|
12969
12980
|
flags?: string;
|
|
@@ -14327,6 +14338,7 @@ type PerfectionistSortModules = [] | [{
|
|
|
14327
14338
|
})[];
|
|
14328
14339
|
newlinesBetween?: ("ignore" | number);
|
|
14329
14340
|
useExperimentalDependencyDetection?: boolean;
|
|
14341
|
+
newlinesBetweenOverloadSignatures?: ("ignore" | number);
|
|
14330
14342
|
partitionByComment?: (boolean | (({
|
|
14331
14343
|
pattern: string;
|
|
14332
14344
|
flags?: string;
|
|
@@ -17294,6 +17306,9 @@ type VueNoIrregularWhitespace = [] | [{
|
|
|
17294
17306
|
skipRegExps?: boolean;
|
|
17295
17307
|
skipHTMLAttributeValues?: boolean;
|
|
17296
17308
|
skipHTMLTextContents?: boolean;
|
|
17309
|
+
}]; // ----- vue/no-literals-in-template -----
|
|
17310
|
+
type VueNoLiteralsInTemplate = [] | [{
|
|
17311
|
+
ignores?: string[];
|
|
17297
17312
|
}]; // ----- vue/no-lone-template -----
|
|
17298
17313
|
type VueNoLoneTemplate = [] | [{
|
|
17299
17314
|
ignoreAccessible?: boolean;
|
|
@@ -17448,7 +17463,7 @@ type VueNoUnusedComponents = [] | [{
|
|
|
17448
17463
|
ignoreWhenBindingPresent?: boolean;
|
|
17449
17464
|
}]; // ----- vue/no-unused-properties -----
|
|
17450
17465
|
type VueNoUnusedProperties = [] | [{
|
|
17451
|
-
groups?: ("props" | "data" | "asyncData" | "computed" | "methods" | "setup")[];
|
|
17466
|
+
groups?: ("props" | "data" | "asyncData" | "computed" | "methods" | "setup" | "inject")[];
|
|
17452
17467
|
deepData?: boolean;
|
|
17453
17468
|
ignorePublicMembers?: boolean;
|
|
17454
17469
|
unreferencedOptions?: ("unknownMemberAsUnreferenced" | "returnAsUnreferenced")[];
|
|
@@ -17963,13 +17978,10 @@ interface ConfigOptions {
|
|
|
17963
17978
|
* @pg
|
|
17964
17979
|
*/
|
|
17965
17980
|
antfu?: boolean | ConfigAntfuOptions;
|
|
17966
|
-
astro?: boolean | ConfigAstroOptions;
|
|
17967
17981
|
deMorgan?: boolean | ConfigDeMorganOptions;
|
|
17968
17982
|
depend?: boolean | ConfigDependOptions;
|
|
17969
|
-
eslintPlugin?: boolean | ConfigESLintPluginOptions;
|
|
17970
17983
|
githubAction?: boolean | ConfigGitHubActionOptions;
|
|
17971
17984
|
gitignore?: boolean | ConfigGitIgnoreOptions;
|
|
17972
|
-
html?: boolean | ConfigHtmlOptions;
|
|
17973
17985
|
importX?: boolean | ConfigImportXOptions;
|
|
17974
17986
|
jsdoc?: boolean | ConfigJsdocOptions;
|
|
17975
17987
|
jsonc?: boolean | ConfigJsoncOptions;
|
|
@@ -17978,13 +17990,10 @@ interface ConfigOptions {
|
|
|
17978
17990
|
oxfmt?: boolean | ConfigOxfmtOptions;
|
|
17979
17991
|
perfectionist?: boolean | ConfigPerfectionistOptions;
|
|
17980
17992
|
pinia?: boolean | ConfigPiniaOptions;
|
|
17981
|
-
pnpm?: boolean | ConfigPnpmOptions;
|
|
17982
17993
|
prettier?: boolean | ConfigPrettierOptions;
|
|
17983
17994
|
regexp?: boolean | ConfigRegexpOptions;
|
|
17984
17995
|
sort?: boolean | ConfigSortOptions;
|
|
17985
17996
|
specials?: boolean | ConfigSpecialsOptions;
|
|
17986
|
-
svelte?: boolean | ConfigSvelteOptions;
|
|
17987
|
-
svgo?: boolean | ConfigSVGOOptions;
|
|
17988
17997
|
test?: boolean | ConfigTestOptions;
|
|
17989
17998
|
toml?: boolean | ConfigTomlOptions;
|
|
17990
17999
|
typescript?: boolean | ConfigTypeScriptOptions;
|
|
@@ -17992,11 +18001,16 @@ interface ConfigOptions {
|
|
|
17992
18001
|
unocss?: boolean | ConfigUnoCSSOptions;
|
|
17993
18002
|
vue?: boolean | ConfigVueOptions;
|
|
17994
18003
|
yml?: boolean | ConfigYmlOptions;
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
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;
|
|
18000
18014
|
unusedImports?: boolean | ConfigUnusedImportsOptions;
|
|
18001
18015
|
}
|
|
18002
18016
|
//#endregion
|
|
@@ -18132,4 +18146,4 @@ declare const PERFECTIONIST: Readonly<{
|
|
|
18132
18146
|
sortObjectsGroups: string[];
|
|
18133
18147
|
}>;
|
|
18134
18148
|
//#endregion
|
|
18135
|
-
export { Arrayable, Awaitable, ConfigAntfuOptions, ConfigAstroOptions, ConfigCommandOptions, ConfigDeMorganOptions, ConfigDependOptions, ConfigESLintCommentsOptions, ConfigESLintPluginOptions, ConfigGitHubActionOptions, ConfigGitIgnoreOptions, ConfigHtmlOptions, ConfigIgnoresOptions, ConfigImportXOptions, ConfigJavaScriptOptions, ConfigJsdocOptions, ConfigJsoncOptions, ConfigMarkdownOptions, ConfigNames, ConfigNodeOptions, ConfigNtnyqOptions, ConfigOptions,
|
|
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
|
@@ -155,7 +155,11 @@ const GLOB_EXCLUDE = [
|
|
|
155
155
|
"**/.yarnrc",
|
|
156
156
|
"**/.husky",
|
|
157
157
|
"**/src-tauri/gen",
|
|
158
|
-
"**/src-tauri/target"
|
|
158
|
+
"**/src-tauri/target",
|
|
159
|
+
"**/*.context",
|
|
160
|
+
"**/*.claude",
|
|
161
|
+
"**/*.agents",
|
|
162
|
+
"**/.*/skills"
|
|
159
163
|
];
|
|
160
164
|
//#endregion
|
|
161
165
|
//#region src/configs/vue.ts
|
|
@@ -571,7 +575,7 @@ const configYml = (options = {}) => {
|
|
|
571
575
|
//#region src/utils/env.ts
|
|
572
576
|
const hasPinia = () => isPackageExists("pinia");
|
|
573
577
|
const hasVitest = () => isPackageExists("vitest");
|
|
574
|
-
const hasTypeScript = () => isPackageExists("typescript");
|
|
578
|
+
const hasTypeScript = () => isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
|
|
575
579
|
const hasShadcnVue = () => (isPackageExists("radix-vue") || isPackageExists("reka-ui")) && isPackageExists("class-variance-authority") && isPackageExists("clsx");
|
|
576
580
|
const hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
577
581
|
const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", { paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")] });
|
|
@@ -615,12 +619,14 @@ async function ensurePackages(packages) {
|
|
|
615
619
|
if (process.env.CI || !process.stdout.isTTY || isInGitHooksOrRunBySpecifyPackages() || !isCwdInScope) return;
|
|
616
620
|
const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
|
|
617
621
|
if (nonExistingPackages.length === 0) return;
|
|
618
|
-
const { confirm } = await import("@clack/prompts");
|
|
619
|
-
|
|
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 {
|
|
620
626
|
const { installPackage } = await import("@antfu/install-pkg");
|
|
621
627
|
await installPackage(nonExistingPackages, { dev: true });
|
|
622
628
|
} catch (err) {
|
|
623
|
-
|
|
629
|
+
throw new Error(`Failed to install required packages: ${nonExistingPackages.join(", ")}`, { cause: err });
|
|
624
630
|
}
|
|
625
631
|
}
|
|
626
632
|
//#endregion
|
|
@@ -1344,10 +1350,16 @@ const configJsdoc = (options = {}) => [{
|
|
|
1344
1350
|
name: "ntnyq/jsdoc",
|
|
1345
1351
|
plugins: { jsdoc: pluginJsdoc },
|
|
1346
1352
|
rules: {
|
|
1353
|
+
/**
|
|
1354
|
+
* @pg Disabled rules
|
|
1355
|
+
*/
|
|
1347
1356
|
"jsdoc/prefer-import-tag": "off",
|
|
1348
1357
|
"jsdoc/require-tags": "off",
|
|
1349
1358
|
"jsdoc/tag-lines": "off",
|
|
1350
1359
|
"jsdoc/text-escaping": "off",
|
|
1360
|
+
/**
|
|
1361
|
+
* @pg Warning only rules
|
|
1362
|
+
*/
|
|
1351
1363
|
"jsdoc/check-access": "warn",
|
|
1352
1364
|
"jsdoc/implements-on-classes": "warn",
|
|
1353
1365
|
"jsdoc/require-param-name": "warn",
|
|
@@ -1358,6 +1370,9 @@ const configJsdoc = (options = {}) => [{
|
|
|
1358
1370
|
"jsdoc/require-returns-description": "warn",
|
|
1359
1371
|
"jsdoc/require-template-description": "warn",
|
|
1360
1372
|
"jsdoc/require-yields-check": "warn",
|
|
1373
|
+
/**
|
|
1374
|
+
* @pg Maybe next release
|
|
1375
|
+
*/
|
|
1361
1376
|
"jsdoc/require-next-description": "warn",
|
|
1362
1377
|
"jsdoc/require-next-type": "warn",
|
|
1363
1378
|
"jsdoc/require-throws-description": "warn",
|
|
@@ -1367,6 +1382,9 @@ const configJsdoc = (options = {}) => [{
|
|
|
1367
1382
|
"jsdoc/ts-method-signature-style": "warn",
|
|
1368
1383
|
"jsdoc/ts-no-empty-object-type": "warn",
|
|
1369
1384
|
"jsdoc/ts-no-unnecessary-template-expression": "warn",
|
|
1385
|
+
/**
|
|
1386
|
+
* @pg Enabled rules
|
|
1387
|
+
*/
|
|
1370
1388
|
"jsdoc/check-alignment": "error",
|
|
1371
1389
|
"jsdoc/check-line-alignment": "error",
|
|
1372
1390
|
"jsdoc/check-param-names": "error",
|
|
@@ -1383,6 +1401,9 @@ const configJsdoc = (options = {}) => [{
|
|
|
1383
1401
|
"internal"
|
|
1384
1402
|
] }],
|
|
1385
1403
|
"jsdoc/check-types": "error",
|
|
1404
|
+
/**
|
|
1405
|
+
* @pg Fixable rules
|
|
1406
|
+
*/
|
|
1386
1407
|
"jsdoc/empty-tags": "error",
|
|
1387
1408
|
"jsdoc/multiline-blocks": "error",
|
|
1388
1409
|
"jsdoc/no-bad-blocks": ["error", { ignore: [
|
|
@@ -1919,6 +1940,9 @@ const configUnicorn = (options = {}) => {
|
|
|
1919
1940
|
plugins: { unicorn: pluginUnicorn },
|
|
1920
1941
|
rules: {
|
|
1921
1942
|
"unicorn/explicit-length-check": "off",
|
|
1943
|
+
/**
|
|
1944
|
+
* @see https://caniuse.com/?search=globalThis
|
|
1945
|
+
*/
|
|
1922
1946
|
"unicorn/prefer-global-this": "off",
|
|
1923
1947
|
"unicorn/prefer-top-level-await": "off",
|
|
1924
1948
|
"unicorn/consistent-assert": "error",
|
|
@@ -1955,6 +1979,9 @@ const configUnicorn = (options = {}) => {
|
|
|
1955
1979
|
"unicorn/prefer-structured-clone": "error",
|
|
1956
1980
|
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1957
1981
|
"unicorn/switch-case-break-position": "error",
|
|
1982
|
+
/**
|
|
1983
|
+
* @pg Error
|
|
1984
|
+
*/
|
|
1958
1985
|
"unicorn/catch-error-name": ["error", {
|
|
1959
1986
|
name: "err",
|
|
1960
1987
|
ignore: ["^_."]
|
|
@@ -1963,19 +1990,40 @@ const configUnicorn = (options = {}) => {
|
|
|
1963
1990
|
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
1964
1991
|
"unicorn/prefer-type-error": "error",
|
|
1965
1992
|
"unicorn/throw-new-error": "error",
|
|
1993
|
+
/**
|
|
1994
|
+
* @pg Number
|
|
1995
|
+
*/
|
|
1966
1996
|
"unicorn/no-zero-fractions": "error",
|
|
1967
1997
|
"unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
|
|
1968
1998
|
"unicorn/prefer-number-properties": "error",
|
|
1999
|
+
/**
|
|
2000
|
+
* @pg BigInt
|
|
2001
|
+
*/
|
|
1969
2002
|
"unicorn/prefer-bigint-literals": "error",
|
|
2003
|
+
/**
|
|
2004
|
+
* @pg RegExp
|
|
2005
|
+
*/
|
|
2006
|
+
/**
|
|
2007
|
+
* Prefer `eslint-plugin-regexp` instead
|
|
2008
|
+
*/
|
|
1970
2009
|
"unicorn/better-regex": "off",
|
|
1971
2010
|
"unicorn/prefer-regexp-test": "error",
|
|
2011
|
+
/**
|
|
2012
|
+
* @pg Date
|
|
2013
|
+
*/
|
|
1972
2014
|
"unicorn/consistent-date-clone": "error",
|
|
1973
2015
|
"unicorn/prefer-date-now": "error",
|
|
2016
|
+
/**
|
|
2017
|
+
* @pg String
|
|
2018
|
+
*/
|
|
1974
2019
|
"unicorn/consistent-template-literal-escape": "error",
|
|
1975
2020
|
"unicorn/prefer-code-point": "error",
|
|
1976
2021
|
"unicorn/prefer-string-slice": "error",
|
|
1977
2022
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1978
2023
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
2024
|
+
/**
|
|
2025
|
+
* @pg DOM
|
|
2026
|
+
*/
|
|
1979
2027
|
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1980
2028
|
"unicorn/prefer-add-event-listener": "error",
|
|
1981
2029
|
"unicorn/prefer-classlist-toggle": "error",
|
|
@@ -1985,7 +2033,15 @@ const configUnicorn = (options = {}) => {
|
|
|
1985
2033
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1986
2034
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
1987
2035
|
"unicorn/prefer-query-selector": "error",
|
|
2036
|
+
/**
|
|
2037
|
+
* @pg Array
|
|
2038
|
+
*/
|
|
1988
2039
|
"unicorn/no-array-callback-reference": "off",
|
|
2040
|
+
/**
|
|
2041
|
+
* TODO: chrome 110, baseline 2023 required
|
|
2042
|
+
*
|
|
2043
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed#browser_compatibility
|
|
2044
|
+
*/
|
|
1989
2045
|
"unicorn/no-array-reverse": "off",
|
|
1990
2046
|
"unicorn/no-array-sort": "off",
|
|
1991
2047
|
"unicorn/no-array-method-this-argument": "error",
|
|
@@ -1999,8 +2055,14 @@ const configUnicorn = (options = {}) => {
|
|
|
1999
2055
|
"unicorn/prefer-array-some": "error",
|
|
2000
2056
|
"unicorn/prefer-single-call": "error",
|
|
2001
2057
|
"unicorn/require-array-join-separator": "error",
|
|
2058
|
+
/**
|
|
2059
|
+
* @pg Set
|
|
2060
|
+
*/
|
|
2002
2061
|
"unicorn/prefer-set-has": "error",
|
|
2003
2062
|
"unicorn/prefer-set-size": "error",
|
|
2063
|
+
/**
|
|
2064
|
+
* @pg Module
|
|
2065
|
+
*/
|
|
2004
2066
|
"unicorn/require-module-specifiers": "off",
|
|
2005
2067
|
"unicorn/require-module-attributes": "error",
|
|
2006
2068
|
...options.overrides
|
|
@@ -2149,6 +2211,10 @@ const configPrettier = (options = {}) => {
|
|
|
2149
2211
|
"vue/space-infix-ops": "off",
|
|
2150
2212
|
"vue/space-unary-ops": "off",
|
|
2151
2213
|
"vue/template-curly-spacing": "off",
|
|
2214
|
+
/**
|
|
2215
|
+
* @pg
|
|
2216
|
+
* @see {@link https://github.com/prettier/eslint-plugin-prettier/blob/cd48a275f130e515f23cebdf7c6cb588b041cd64/eslint-plugin-prettier.js#L101-L103}
|
|
2217
|
+
*/
|
|
2152
2218
|
"arrow-body-style": "off",
|
|
2153
2219
|
"prefer-arrow-callback": "off",
|
|
2154
2220
|
"prettier/prettier": options.severity || "warn",
|
|
@@ -2925,7 +2991,7 @@ const configPerfectionist = (options = {}) => {
|
|
|
2925
2991
|
const extraRules = {
|
|
2926
2992
|
"perfectionist/sort-array-includes": ["error", {
|
|
2927
2993
|
...sharedOptionsWithNewlinesBetween,
|
|
2928
|
-
groups: ["literal"
|
|
2994
|
+
groups: ["literal"]
|
|
2929
2995
|
}],
|
|
2930
2996
|
"perfectionist/sort-classes": ["error", {
|
|
2931
2997
|
...sharedOptionsWithNewlinesBetween,
|
|
@@ -2938,7 +3004,10 @@ const configPerfectionist = (options = {}) => {
|
|
|
2938
3004
|
"unknown"
|
|
2939
3005
|
] }],
|
|
2940
3006
|
"perfectionist/sort-switch-case": "error",
|
|
2941
|
-
"perfectionist/sort-variable-declarations": ["error", {
|
|
3007
|
+
"perfectionist/sort-variable-declarations": ["error", {
|
|
3008
|
+
groups: ["initialized", "uninitialized"],
|
|
3009
|
+
partitionByComment
|
|
3010
|
+
}]
|
|
2942
3011
|
};
|
|
2943
3012
|
const sharedConfig = {
|
|
2944
3013
|
plugins: { perfectionist: pluginPerfectionist },
|
|
@@ -3004,10 +3073,9 @@ const configPerfectionist = (options = {}) => {
|
|
|
3004
3073
|
*/
|
|
3005
3074
|
const configUnusedImports = async (options = {}) => {
|
|
3006
3075
|
await ensurePackages(["eslint-plugin-unused-imports"]);
|
|
3007
|
-
const pluginUnusedImports = await interopDefault(import("eslint-plugin-unused-imports"));
|
|
3008
3076
|
return [{
|
|
3009
3077
|
name: "ntnyq/unused-imports",
|
|
3010
|
-
plugins: { "unused-imports":
|
|
3078
|
+
plugins: { "unused-imports": await interopDefault(import("eslint-plugin-unused-imports")) },
|
|
3011
3079
|
rules: {
|
|
3012
3080
|
"@typescript-eslint/no-unused-vars": "off",
|
|
3013
3081
|
"unused-imports/no-unused-imports": "error",
|
|
@@ -3053,9 +3121,10 @@ const configESLintComments = (options = {}) => [{
|
|
|
3053
3121
|
* Config factory
|
|
3054
3122
|
*/
|
|
3055
3123
|
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
3056
|
-
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;
|
|
3124
|
+
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;
|
|
3057
3125
|
const configs = [];
|
|
3058
|
-
const { ecmaVersion = "latest", extraFileExtensions = [] } = shareable;
|
|
3126
|
+
const { ecmaVersion = "latest", extraFileExtensions: shareableExtraFileExtensions = [] } = shareable;
|
|
3127
|
+
const extraFileExtensions = [...shareableExtraFileExtensions];
|
|
3059
3128
|
const usingFormatter = enablePrettier || enableOxfmt;
|
|
3060
3129
|
if (enableVue) extraFileExtensions.push(".vue");
|
|
3061
3130
|
if (enableAstro) extraFileExtensions.push(".astro");
|
|
@@ -3151,6 +3220,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3151
3220
|
if (enableESLintPlugin) configs.push(configESLintPlugin({ overrides: getOverrides(options, "eslintPlugin") }));
|
|
3152
3221
|
if (enablePnpm) configs.push(configPnpm(resolveSubOptions(options, "pnpm")));
|
|
3153
3222
|
if (enableSVGO) configs.push(configSVGO(resolveSubOptions(options, "svgo")));
|
|
3223
|
+
if (enableUnusedImports) configs.push(configUnusedImports({ overrides: getOverrides(options, "unusedImports") }));
|
|
3154
3224
|
if (enableHTML) configs.push(configHtml({
|
|
3155
3225
|
...resolveSubOptions(options, "html"),
|
|
3156
3226
|
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.
|
|
4
|
+
"version": "6.1.1",
|
|
5
5
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@eslint/js": "^10.0.1",
|
|
88
88
|
"@eslint/markdown": "^8.0.1",
|
|
89
89
|
"@unocss/eslint-plugin": "^66.6.8",
|
|
90
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
90
|
+
"@vitest/eslint-plugin": "^1.6.16",
|
|
91
91
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
92
92
|
"eslint-flat-config-utils": "3.0.2",
|
|
93
93
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -104,46 +104,46 @@
|
|
|
104
104
|
"eslint-plugin-n": "^17.24.0",
|
|
105
105
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
106
106
|
"eslint-plugin-ntnyq": "^0.14.0",
|
|
107
|
-
"eslint-plugin-oxfmt": "^0.
|
|
108
|
-
"eslint-plugin-perfectionist": "^5.
|
|
107
|
+
"eslint-plugin-oxfmt": "^0.4.1",
|
|
108
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
109
109
|
"eslint-plugin-pinia": "^0.4.2",
|
|
110
110
|
"eslint-plugin-prettier": "^5.5.5",
|
|
111
111
|
"eslint-plugin-regexp": "^3.1.0",
|
|
112
112
|
"eslint-plugin-svgo": "^0.12.0",
|
|
113
113
|
"eslint-plugin-toml": "^1.3.1",
|
|
114
114
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
115
|
-
"eslint-plugin-vue": "^10.
|
|
115
|
+
"eslint-plugin-vue": "^10.9.0",
|
|
116
116
|
"eslint-plugin-yml": "^3.3.1",
|
|
117
117
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
118
|
-
"globals": "^17.
|
|
118
|
+
"globals": "^17.5.0",
|
|
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.
|
|
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
|
-
"@types/node": "^25.
|
|
128
|
-
"@typescript-eslint/types": "^8.
|
|
129
|
-
"@typescript-eslint/utils": "^8.
|
|
130
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
127
|
+
"@types/node": "^25.6.0",
|
|
128
|
+
"@typescript-eslint/types": "^8.59.1",
|
|
129
|
+
"@typescript-eslint/utils": "^8.59.1",
|
|
130
|
+
"@typescript/native-preview": "^7.0.0-dev.20260427.1",
|
|
131
131
|
"bumpp": "^11.0.1",
|
|
132
132
|
"consola": "^3.4.2",
|
|
133
|
-
"eslint": "^10.2.
|
|
133
|
+
"eslint": "^10.2.1",
|
|
134
134
|
"eslint-typegen": "^2.3.1",
|
|
135
135
|
"husky": "^9.1.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.
|
|
140
|
-
"prettier": "^3.8.
|
|
139
|
+
"oxfmt": "^0.47.0",
|
|
140
|
+
"prettier": "^3.8.3",
|
|
141
141
|
"tinyglobby": "^0.2.16",
|
|
142
|
-
"tsdown": "^0.21.
|
|
142
|
+
"tsdown": "^0.21.10",
|
|
143
143
|
"tsx": "^4.21.0",
|
|
144
|
-
"typescript": "^6.0.
|
|
144
|
+
"typescript": "^6.0.3",
|
|
145
145
|
"uncase": "^0.2.0",
|
|
146
|
-
"vitest": "^4.1.
|
|
146
|
+
"vitest": "^4.1.5"
|
|
147
147
|
},
|
|
148
148
|
"engines": {
|
|
149
149
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|