@ntnyq/eslint-config 5.7.0 → 5.8.0
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.ts → index.d.mts} +202 -208
- package/dist/{index.js → index.mjs} +25 -13
- package/package.json +27 -27
|
@@ -547,12 +547,6 @@ function getOverrides(options, key) {
|
|
|
547
547
|
return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
//#endregion
|
|
551
|
-
//#region src/utils/combineConfigs.ts
|
|
552
|
-
async function combineConfigs(...configs) {
|
|
553
|
-
return (await Promise.all(configs)).flat();
|
|
554
|
-
}
|
|
555
|
-
|
|
556
550
|
//#endregion
|
|
557
551
|
//#region src/utils/isInGitHooksOrRunBySpecifyPackages.ts
|
|
558
552
|
const CHECKED_RUNNER_PACKAGES = [
|
|
@@ -567,6 +561,9 @@ function isInGitHooksOrRunBySpecifyPackages() {
|
|
|
567
561
|
|
|
568
562
|
//#endregion
|
|
569
563
|
//#region src/utils/ensurePackages.ts
|
|
564
|
+
/**
|
|
565
|
+
* @copyright {@link https://github.com/antfu/eslint-config}
|
|
566
|
+
*/
|
|
570
567
|
const isCwdInScope = isPackageExists("@ntnyq/eslint-config");
|
|
571
568
|
function isPackageInScope(name) {
|
|
572
569
|
return isPackageExists(name, { paths: [import.meta.dirname] });
|
|
@@ -1832,6 +1829,10 @@ const configFormat = async (options = {}) => {
|
|
|
1832
1829
|
//#endregion
|
|
1833
1830
|
//#region src/configs/regexp.ts
|
|
1834
1831
|
/**
|
|
1832
|
+
* @file config for plugin regexp
|
|
1833
|
+
* @see {@link https://github.com/ota-meshi/eslint-plugin-regexp}
|
|
1834
|
+
*/
|
|
1835
|
+
/**
|
|
1835
1836
|
* Config for regexp
|
|
1836
1837
|
*
|
|
1837
1838
|
* @see {@link https://github.com/ota-meshi/eslint-plugin-regexp}
|
|
@@ -2025,10 +2026,15 @@ const configCommand = (options = {}) => [{
|
|
|
2025
2026
|
* @param customIgnores - {@link ConfigIgnoresOptions}
|
|
2026
2027
|
* @returns ESLint configs
|
|
2027
2028
|
*/
|
|
2028
|
-
const configIgnores = (customIgnores = []) =>
|
|
2029
|
-
|
|
2030
|
-
ignores
|
|
2031
|
-
|
|
2029
|
+
const configIgnores = (customIgnores = []) => {
|
|
2030
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
2031
|
+
if (typeof customIgnores === "function") ignores = customIgnores(ignores);
|
|
2032
|
+
else ignores.push(...customIgnores);
|
|
2033
|
+
return [{
|
|
2034
|
+
name: "ntnyq/ignores",
|
|
2035
|
+
ignores
|
|
2036
|
+
}];
|
|
2037
|
+
};
|
|
2032
2038
|
|
|
2033
2039
|
//#endregion
|
|
2034
2040
|
//#region src/configs/importX.ts
|
|
@@ -2122,12 +2128,14 @@ const configUnicorn = (options = {}) => {
|
|
|
2122
2128
|
"unicorn/no-console-spaces": "error",
|
|
2123
2129
|
"unicorn/no-for-loop": "error",
|
|
2124
2130
|
"unicorn/no-hex-escape": "error",
|
|
2131
|
+
"unicorn/no-immediate-mutation": "error",
|
|
2125
2132
|
"unicorn/no-instanceof-builtins": "error",
|
|
2126
2133
|
"unicorn/no-lonely-if": "error",
|
|
2127
2134
|
"unicorn/no-new-buffer": "error",
|
|
2128
2135
|
"unicorn/no-static-only-class": "error",
|
|
2129
2136
|
"unicorn/no-typeof-undefined": "error",
|
|
2130
2137
|
"unicorn/no-unnecessary-await": "error",
|
|
2138
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
2131
2139
|
"unicorn/prefer-class-fields": "error",
|
|
2132
2140
|
"unicorn/prefer-import-meta-properties": "error",
|
|
2133
2141
|
"unicorn/prefer-includes": "error",
|
|
@@ -2140,6 +2148,7 @@ const configUnicorn = (options = {}) => {
|
|
|
2140
2148
|
"unicorn/prefer-optional-catch-binding": "error",
|
|
2141
2149
|
"unicorn/prefer-prototype-methods": "error",
|
|
2142
2150
|
"unicorn/prefer-reflect-apply": "error",
|
|
2151
|
+
"unicorn/prefer-response-static-json": "error",
|
|
2143
2152
|
"unicorn/prefer-structured-clone": "error",
|
|
2144
2153
|
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
2145
2154
|
"unicorn/catch-error-name": ["error", {
|
|
@@ -3120,17 +3129,20 @@ const configESLintComments = (options = {}) => [{
|
|
|
3120
3129
|
//#endregion
|
|
3121
3130
|
//#region src/core.ts
|
|
3122
3131
|
/**
|
|
3132
|
+
* @file factory function to create ESLint config
|
|
3133
|
+
*/
|
|
3134
|
+
/**
|
|
3123
3135
|
* Config factory
|
|
3124
3136
|
*/
|
|
3125
3137
|
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
3126
|
-
const { shareable = {}, vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = hasTypeScript(), 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, prettier: enablePrettier = 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;
|
|
3138
|
+
const { shareable = {}, ignores: userIgnores = [], vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = hasTypeScript(), 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, prettier: enablePrettier = 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;
|
|
3127
3139
|
const configs = [];
|
|
3128
3140
|
const { ecmaVersion = "latest", extraFileExtensions = [] } = shareable;
|
|
3129
3141
|
if (enableVue) extraFileExtensions.push(".vue");
|
|
3130
3142
|
if (enableAstro) extraFileExtensions.push(".astro");
|
|
3131
3143
|
if (enableSvelte) extraFileExtensions.push(".svelte");
|
|
3132
3144
|
if (enableGitIgnore) configs.push(configGitIgnore(resolveSubOptions(options, "gitignore")));
|
|
3133
|
-
configs.push(configIgnores(
|
|
3145
|
+
configs.push(configIgnores(userIgnores), configJSX(), configNode({ overrides: getOverrides(options, "node") }), configCommand(resolveSubOptions(options, "command")), configESLintComments({ overrides: getOverrides(options, "eslintComments") }), configJavaScript({
|
|
3134
3146
|
ecmaVersion,
|
|
3135
3147
|
...resolveSubOptions(options, "javascript"),
|
|
3136
3148
|
overrides: getOverrides(options, "javascript")
|
|
@@ -3232,4 +3244,4 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3232
3244
|
}
|
|
3233
3245
|
|
|
3234
3246
|
//#endregion
|
|
3235
|
-
export { 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_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, PERFECTIONIST, PRETTIER_DEFAULT_OPTIONS,
|
|
3247
|
+
export { 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_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, PERFECTIONIST, PRETTIER_DEFAULT_OPTIONS, configAntfu, configAstro, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configFormat, configGitHubAction, configGitIgnore, configHtml, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configSvelte, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, configsTypeScript, defineESLintConfig, ensurePackages, getOverrides, hasPinia, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergePrettierOptions, mergeProcessors, parserJsonc, parserPlain, parserToml, parserTypeScript, parserVue, parserYaml, pluginAntfu, pluginComments, pluginDeMorgan, pluginDepend, pluginGitHubAction, pluginImportX, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNoOnlyTests, pluginNode, pluginNtnyq, pluginPerfectionist, pluginPinia, pluginPrettier, pluginRegexp, pluginSvgo, pluginToml, pluginTypeScript, pluginUnicorn, pluginUnoCSS, pluginVitest, pluginVue, pluginYml, processorPassThrough, processorVueBlocks, resolveSubOptions };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.8.0",
|
|
5
5
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
"./package.json": "./package.json",
|
|
24
24
|
".": {
|
|
25
|
-
"types": "./dist/index.d.
|
|
26
|
-
"default": "./dist/index.
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"main": "./dist/index.
|
|
30
|
-
"types": "./dist/index.d.
|
|
29
|
+
"main": "./dist/index.mjs",
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@html-eslint/parser": "^0.47.0",
|
|
41
41
|
"astro-eslint-parser": "^1.2.2",
|
|
42
42
|
"eslint": "^9.20.0",
|
|
43
|
-
"eslint-plugin-astro": "^1.
|
|
44
|
-
"eslint-plugin-eslint-plugin": "^7.
|
|
43
|
+
"eslint-plugin-astro": "^1.4.0",
|
|
44
|
+
"eslint-plugin-eslint-plugin": "^7.2.0",
|
|
45
45
|
"eslint-plugin-format": "^1.0.2",
|
|
46
|
-
"eslint-plugin-pnpm": "^1.
|
|
47
|
-
"eslint-plugin-svelte": "^3.
|
|
48
|
-
"eslint-plugin-unused-imports": "^4.
|
|
49
|
-
"svelte": "^5.
|
|
50
|
-
"svelte-eslint-parser": "^1.
|
|
46
|
+
"eslint-plugin-pnpm": "^1.3.0",
|
|
47
|
+
"eslint-plugin-svelte": "^3.13.0",
|
|
48
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
49
|
+
"svelte": "^5.43.2",
|
|
50
|
+
"svelte-eslint-parser": "^1.4.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@html-eslint/eslint-plugin": {
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"@antfu/install-pkg": "^1.1.0",
|
|
89
89
|
"@clack/prompts": "^0.11.0",
|
|
90
90
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
91
|
-
"@eslint/js": "^9.
|
|
92
|
-
"@eslint/markdown": "^7.5.
|
|
93
|
-
"@unocss/eslint-plugin": "^66.5.
|
|
94
|
-
"@vitest/eslint-plugin": "^1.
|
|
91
|
+
"@eslint/js": "^9.39.1",
|
|
92
|
+
"@eslint/markdown": "^7.5.1",
|
|
93
|
+
"@unocss/eslint-plugin": "^66.5.6",
|
|
94
|
+
"@vitest/eslint-plugin": "^1.4.2",
|
|
95
95
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
96
96
|
"eslint-flat-config-utils": "^2.1.4",
|
|
97
97
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"eslint-plugin-antfu": "^3.1.1",
|
|
101
101
|
"eslint-plugin-command": "^3.3.1",
|
|
102
102
|
"eslint-plugin-de-morgan": "^2.0.0",
|
|
103
|
-
"eslint-plugin-depend": "^1.
|
|
103
|
+
"eslint-plugin-depend": "^1.4.0",
|
|
104
104
|
"eslint-plugin-github-action": "^0.0.16",
|
|
105
105
|
"eslint-plugin-import-x": "^4.16.1",
|
|
106
|
-
"eslint-plugin-jsdoc": "^61.1
|
|
106
|
+
"eslint-plugin-jsdoc": "^61.2.1",
|
|
107
107
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
108
108
|
"eslint-plugin-n": "^17.23.1",
|
|
109
109
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
@@ -114,26 +114,26 @@
|
|
|
114
114
|
"eslint-plugin-regexp": "^2.10.0",
|
|
115
115
|
"eslint-plugin-svgo": "^0.11.3",
|
|
116
116
|
"eslint-plugin-toml": "^0.12.0",
|
|
117
|
-
"eslint-plugin-unicorn": "^
|
|
117
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
118
118
|
"eslint-plugin-vue": "^10.5.1",
|
|
119
119
|
"eslint-plugin-yml": "^1.19.0",
|
|
120
120
|
"eslint-processor-vue-blocks": "^2.0.0",
|
|
121
|
-
"globals": "^16.
|
|
121
|
+
"globals": "^16.5.0",
|
|
122
122
|
"jsonc-eslint-parser": "^2.4.1",
|
|
123
123
|
"local-pkg": "^1.1.2",
|
|
124
124
|
"toml-eslint-parser": "^0.10.0",
|
|
125
|
-
"typescript-eslint": "^8.46.
|
|
125
|
+
"typescript-eslint": "^8.46.4",
|
|
126
126
|
"vue-eslint-parser": "^10.2.0",
|
|
127
127
|
"yaml-eslint-parser": "^1.3.0"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@ntnyq/prettier-config": "^3.0.1",
|
|
131
|
-
"@types/node": "^24.
|
|
132
|
-
"@typescript-eslint/types": "^8.46.
|
|
133
|
-
"@typescript-eslint/utils": "^8.46.
|
|
131
|
+
"@types/node": "^24.10.1",
|
|
132
|
+
"@typescript-eslint/types": "^8.46.4",
|
|
133
|
+
"@typescript-eslint/utils": "^8.46.4",
|
|
134
134
|
"bumpp": "^10.3.1",
|
|
135
135
|
"consola": "^3.4.2",
|
|
136
|
-
"eslint": "^9.
|
|
136
|
+
"eslint": "^9.39.1",
|
|
137
137
|
"eslint-typegen": "^2.3.0",
|
|
138
138
|
"husky": "^9.1.7",
|
|
139
139
|
"jiti": "^2.6.1",
|
|
@@ -141,11 +141,11 @@
|
|
|
141
141
|
"npm-run-all2": "^8.0.4",
|
|
142
142
|
"prettier": "^3.6.2",
|
|
143
143
|
"tinyglobby": "^0.2.15",
|
|
144
|
-
"tsdown": "^0.
|
|
144
|
+
"tsdown": "^0.16.4",
|
|
145
145
|
"tsx": "^4.20.6",
|
|
146
146
|
"typescript": "^5.9.3",
|
|
147
147
|
"uncase": "^0.2.0",
|
|
148
|
-
"vitest": "^4.0.
|
|
148
|
+
"vitest": "^4.0.9"
|
|
149
149
|
},
|
|
150
150
|
"engines": {
|
|
151
151
|
"node": "^20.11.0 || >=21.1.0"
|