@antfu/eslint-config 4.5.0 → 4.6.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/cli.js +5 -8
- package/dist/index.d.ts +14 -1
- package/dist/index.js +33 -2
- package/package.json +6 -9
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import c from "ansis";
|
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@antfu/eslint-config",
|
|
13
13
|
type: "module",
|
|
14
|
-
version: "4.
|
|
14
|
+
version: "4.6.0",
|
|
15
15
|
packageManager: "pnpm@10.5.2",
|
|
16
16
|
description: "Anthony's ESLint config",
|
|
17
17
|
author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -124,6 +124,7 @@ var package_default = {
|
|
|
124
124
|
"eslint-plugin-n": "^17.16.2",
|
|
125
125
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
126
126
|
"eslint-plugin-perfectionist": "^4.9.0",
|
|
127
|
+
"eslint-plugin-pnpm-catalogs": "^0.1.0",
|
|
127
128
|
"eslint-plugin-regexp": "^2.7.0",
|
|
128
129
|
"eslint-plugin-toml": "^0.12.0",
|
|
129
130
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
@@ -136,7 +137,7 @@ var package_default = {
|
|
|
136
137
|
"local-pkg": "^1.1.1",
|
|
137
138
|
"parse-gitignore": "^2.0.0",
|
|
138
139
|
"toml-eslint-parser": "^0.10.0",
|
|
139
|
-
"vue-eslint-parser": "^10.
|
|
140
|
+
"vue-eslint-parser": "^10.1.1",
|
|
140
141
|
"yaml-eslint-parser": "^1.3.0"
|
|
141
142
|
},
|
|
142
143
|
devDependencies: {
|
|
@@ -146,9 +147,7 @@ var package_default = {
|
|
|
146
147
|
"@eslint/config-inspector": "^1.0.2",
|
|
147
148
|
"@prettier/plugin-xml": "^3.4.1",
|
|
148
149
|
"@stylistic/eslint-plugin-migrate": "^4.2.0",
|
|
149
|
-
"@types/fs-extra": "^11.0.4",
|
|
150
150
|
"@types/node": "^22.13.9",
|
|
151
|
-
"@types/prompts": "^2.4.9",
|
|
152
151
|
"@unocss/eslint-plugin": "^66.0.0",
|
|
153
152
|
"astro-eslint-parser": "^1.2.1",
|
|
154
153
|
bumpp: "^10.0.3",
|
|
@@ -161,16 +160,14 @@ var package_default = {
|
|
|
161
160
|
"eslint-plugin-svelte": "^3.0.3",
|
|
162
161
|
"eslint-typegen": "^2.0.0",
|
|
163
162
|
execa: "^9.5.2",
|
|
164
|
-
"fast-glob": "^3.3.3",
|
|
165
|
-
"fs-extra": "^11.3.0",
|
|
166
163
|
jiti: "^2.4.2",
|
|
167
164
|
"lint-staged": "^15.4.3",
|
|
168
165
|
"prettier-plugin-astro": "^0.14.1",
|
|
169
166
|
"prettier-plugin-slidev": "^1.0.5",
|
|
170
|
-
rimraf: "^6.0.1",
|
|
171
167
|
"simple-git-hooks": "^2.11.1",
|
|
172
|
-
svelte: "^5.22.
|
|
168
|
+
svelte: "^5.22.5",
|
|
173
169
|
"svelte-eslint-parser": "^1.0.1",
|
|
170
|
+
tinyglobby: "^0.2.12",
|
|
174
171
|
tsup: "^8.4.0",
|
|
175
172
|
tsx: "^4.19.3",
|
|
176
173
|
typescript: "^5.8.2",
|
package/dist/index.d.ts
CHANGED
|
@@ -17399,6 +17399,17 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
17399
17399
|
* @default false
|
|
17400
17400
|
*/
|
|
17401
17401
|
unocss?: boolean | OptionsUnoCSS;
|
|
17402
|
+
/**
|
|
17403
|
+
* Enable pnpm catalogs support.
|
|
17404
|
+
*
|
|
17405
|
+
* Currently it's disabled by default, as it's still experimental.
|
|
17406
|
+
* In the future it will be smartly enabled based on the project catalog usage.
|
|
17407
|
+
*
|
|
17408
|
+
* @see https://github.com/antfu/pnpm-catalogs-utils
|
|
17409
|
+
* @experimental
|
|
17410
|
+
* @default false
|
|
17411
|
+
*/
|
|
17412
|
+
pnpmCatalogs?: boolean;
|
|
17402
17413
|
/**
|
|
17403
17414
|
* Use external formatters to format files.
|
|
17404
17415
|
*
|
|
@@ -17501,6 +17512,8 @@ declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
|
17501
17512
|
*/
|
|
17502
17513
|
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
17503
17514
|
|
|
17515
|
+
declare function pnpmCatalogs(): Promise<TypedFlatConfigItem[]>;
|
|
17516
|
+
|
|
17504
17517
|
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
17505
17518
|
|
|
17506
17519
|
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -17645,4 +17658,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
17645
17658
|
declare function isInEditorEnv(): boolean;
|
|
17646
17659
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
17647
17660
|
|
|
17648
|
-
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
17661
|
+
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpmCatalogs, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -1182,6 +1182,29 @@ async function perfectionist() {
|
|
|
1182
1182
|
];
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
|
+
// src/configs/pnpm-catalogs.ts
|
|
1186
|
+
async function pnpmCatalogs() {
|
|
1187
|
+
return [
|
|
1188
|
+
{
|
|
1189
|
+
files: [
|
|
1190
|
+
"package.json",
|
|
1191
|
+
"**/package.json"
|
|
1192
|
+
],
|
|
1193
|
+
languageOptions: {
|
|
1194
|
+
parser: await interopDefault(import("jsonc-eslint-parser"))
|
|
1195
|
+
},
|
|
1196
|
+
name: "antfu/pnpm-catalogs/rules",
|
|
1197
|
+
plugins: {
|
|
1198
|
+
"pnpm-catalogs": await interopDefault(import("eslint-plugin-pnpm-catalogs"))
|
|
1199
|
+
},
|
|
1200
|
+
rules: {
|
|
1201
|
+
"pnpm-catalogs/enforce-catalog": "error",
|
|
1202
|
+
"pnpm-catalogs/valid-catalog": "error"
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
];
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1185
1208
|
// src/configs/react.ts
|
|
1186
1209
|
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
1187
1210
|
var ReactRefreshAllowConstantExportPackages = [
|
|
@@ -2078,12 +2101,12 @@ async function unicorn(options = {}) {
|
|
|
2078
2101
|
unicorn: default6
|
|
2079
2102
|
},
|
|
2080
2103
|
rules: {
|
|
2081
|
-
...options.allRecommended ? default6.configs
|
|
2104
|
+
...options.allRecommended ? default6.configs.recommended.rules : {
|
|
2082
2105
|
"unicorn/consistent-empty-array-spread": "error",
|
|
2083
2106
|
"unicorn/error-message": "error",
|
|
2084
2107
|
"unicorn/escape-case": "error",
|
|
2085
2108
|
"unicorn/new-for-builtins": "error",
|
|
2086
|
-
"unicorn/no-instanceof-
|
|
2109
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
2087
2110
|
"unicorn/no-new-array": "error",
|
|
2088
2111
|
"unicorn/no-new-buffer": "error",
|
|
2089
2112
|
"unicorn/number-literal-case": "error",
|
|
@@ -2395,6 +2418,8 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2395
2418
|
componentExts = [],
|
|
2396
2419
|
gitignore: enableGitignore = true,
|
|
2397
2420
|
jsx: enableJsx = true,
|
|
2421
|
+
pnpmCatalogs: enablePnpmCatalogs = false,
|
|
2422
|
+
// TOD: smart detect
|
|
2398
2423
|
react: enableReact = false,
|
|
2399
2424
|
regexp: enableRegexp = true,
|
|
2400
2425
|
solid: enableSolid = false,
|
|
@@ -2531,6 +2556,11 @@ function antfu(options = {}, ...userConfigs) {
|
|
|
2531
2556
|
sortTsconfig()
|
|
2532
2557
|
);
|
|
2533
2558
|
}
|
|
2559
|
+
if (enablePnpmCatalogs) {
|
|
2560
|
+
configs2.push(
|
|
2561
|
+
pnpmCatalogs()
|
|
2562
|
+
);
|
|
2563
|
+
}
|
|
2534
2564
|
if (options.yaml ?? true) {
|
|
2535
2565
|
configs2.push(yaml({
|
|
2536
2566
|
overrides: getOverrides(options, "yaml"),
|
|
@@ -2661,6 +2691,7 @@ export {
|
|
|
2661
2691
|
node,
|
|
2662
2692
|
parserPlain,
|
|
2663
2693
|
perfectionist,
|
|
2694
|
+
pnpmCatalogs,
|
|
2664
2695
|
react,
|
|
2665
2696
|
regexp,
|
|
2666
2697
|
renamePluginInConfigs,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.6.0",
|
|
5
5
|
"description": "Anthony's ESLint config",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"eslint-plugin-n": "^17.16.2",
|
|
100
100
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
101
101
|
"eslint-plugin-perfectionist": "^4.9.0",
|
|
102
|
+
"eslint-plugin-pnpm-catalogs": "^0.1.0",
|
|
102
103
|
"eslint-plugin-regexp": "^2.7.0",
|
|
103
104
|
"eslint-plugin-toml": "^0.12.0",
|
|
104
105
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"local-pkg": "^1.1.1",
|
|
112
113
|
"parse-gitignore": "^2.0.0",
|
|
113
114
|
"toml-eslint-parser": "^0.10.0",
|
|
114
|
-
"vue-eslint-parser": "^10.
|
|
115
|
+
"vue-eslint-parser": "^10.1.1",
|
|
115
116
|
"yaml-eslint-parser": "^1.3.0"
|
|
116
117
|
},
|
|
117
118
|
"devDependencies": {
|
|
@@ -120,9 +121,7 @@
|
|
|
120
121
|
"@eslint/config-inspector": "^1.0.2",
|
|
121
122
|
"@prettier/plugin-xml": "^3.4.1",
|
|
122
123
|
"@stylistic/eslint-plugin-migrate": "^4.2.0",
|
|
123
|
-
"@types/fs-extra": "^11.0.4",
|
|
124
124
|
"@types/node": "^22.13.9",
|
|
125
|
-
"@types/prompts": "^2.4.9",
|
|
126
125
|
"@unocss/eslint-plugin": "^66.0.0",
|
|
127
126
|
"astro-eslint-parser": "^1.2.1",
|
|
128
127
|
"bumpp": "^10.0.3",
|
|
@@ -135,22 +134,20 @@
|
|
|
135
134
|
"eslint-plugin-svelte": "^3.0.3",
|
|
136
135
|
"eslint-typegen": "^2.0.0",
|
|
137
136
|
"execa": "^9.5.2",
|
|
138
|
-
"fast-glob": "^3.3.3",
|
|
139
|
-
"fs-extra": "^11.3.0",
|
|
140
137
|
"jiti": "^2.4.2",
|
|
141
138
|
"lint-staged": "^15.4.3",
|
|
142
139
|
"prettier-plugin-astro": "^0.14.1",
|
|
143
140
|
"prettier-plugin-slidev": "^1.0.5",
|
|
144
|
-
"rimraf": "^6.0.1",
|
|
145
141
|
"simple-git-hooks": "^2.11.1",
|
|
146
|
-
"svelte": "^5.22.
|
|
142
|
+
"svelte": "^5.22.5",
|
|
147
143
|
"svelte-eslint-parser": "^1.0.1",
|
|
144
|
+
"tinyglobby": "^0.2.12",
|
|
148
145
|
"tsup": "^8.4.0",
|
|
149
146
|
"tsx": "^4.19.3",
|
|
150
147
|
"typescript": "^5.8.2",
|
|
151
148
|
"vitest": "^3.0.7",
|
|
152
149
|
"vue": "^3.5.13",
|
|
153
|
-
"@antfu/eslint-config": "4.
|
|
150
|
+
"@antfu/eslint-config": "4.6.0"
|
|
154
151
|
},
|
|
155
152
|
"resolutions": {
|
|
156
153
|
"@eslint-community/eslint-utils": "^4.4.1",
|