@antfu/eslint-config 2.25.2 → 2.26.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/cli.cjs CHANGED
@@ -48,7 +48,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
48
48
  var package_default = {
49
49
  name: "@antfu/eslint-config",
50
50
  type: "module",
51
- version: "2.25.2",
51
+ version: "2.26.1",
52
52
  packageManager: "pnpm@9.7.1",
53
53
  description: "Anthony's ESLint config",
54
54
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -77,7 +77,7 @@ var package_default = {
77
77
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
78
78
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
79
79
  watch: "tsup --format esm,cjs --watch",
80
- lint: "eslint .",
80
+ lint: "eslint --flag unstable_ts_config .",
81
81
  typegen: "esno scripts/typegen.ts",
82
82
  prepack: "nr build",
83
83
  release: "bumpp && pnpm publish",
@@ -143,15 +143,15 @@ var package_default = {
143
143
  }
144
144
  },
145
145
  dependencies: {
146
- "@antfu/install-pkg": "^0.3.5",
146
+ "@antfu/install-pkg": "^0.4.0",
147
147
  "@clack/prompts": "^0.7.0",
148
148
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
149
- "@stylistic/eslint-plugin": "^2.6.3",
150
- "@typescript-eslint/eslint-plugin": "^8.1.0",
151
- "@typescript-eslint/parser": "^8.1.0",
149
+ "@stylistic/eslint-plugin": "^2.6.4",
150
+ "@typescript-eslint/eslint-plugin": "^8.2.0",
151
+ "@typescript-eslint/parser": "^8.2.0",
152
152
  "@vitest/eslint-plugin": "^1.0.3",
153
153
  "eslint-config-flat-gitignore": "^0.1.8",
154
- "eslint-flat-config-utils": "^0.3.0",
154
+ "eslint-flat-config-utils": "^0.3.1",
155
155
  "eslint-merge-processors": "^0.1.0",
156
156
  "eslint-plugin-antfu": "^2.3.5",
157
157
  "eslint-plugin-command": "^0.2.3",
@@ -182,31 +182,31 @@ var package_default = {
182
182
  devDependencies: {
183
183
  "@antfu/eslint-config": "workspace:*",
184
184
  "@antfu/ni": "^0.22.4",
185
- "@eslint-react/eslint-plugin": "^1.10.1",
186
- "@eslint/config-inspector": "^0.5.3",
185
+ "@eslint-react/eslint-plugin": "^1.12.0",
186
+ "@eslint/config-inspector": "^0.5.4",
187
187
  "@prettier/plugin-xml": "^3.4.1",
188
- "@stylistic/eslint-plugin-migrate": "^2.6.3",
188
+ "@stylistic/eslint-plugin-migrate": "^2.6.4",
189
189
  "@types/eslint": "^9.6.0",
190
190
  "@types/fs-extra": "^11.0.4",
191
- "@types/node": "^22.3.0",
191
+ "@types/node": "^22.4.2",
192
192
  "@types/prompts": "^2.4.9",
193
193
  "@types/yargs": "^17.0.33",
194
- "@unocss/eslint-plugin": "^0.62.1",
194
+ "@unocss/eslint-plugin": "^0.62.2",
195
195
  "astro-eslint-parser": "^1.0.2",
196
196
  bumpp: "^9.5.1",
197
- eslint: "npm:eslint-ts-patch@9.5.0-0",
197
+ eslint: "^9.9.0",
198
198
  "eslint-plugin-astro": "^1.2.3",
199
199
  "eslint-plugin-format": "^0.1.2",
200
200
  "eslint-plugin-react-hooks": "^4.6.2",
201
- "eslint-plugin-react-refresh": "^0.4.9",
202
- "eslint-plugin-solid": "^0.14.1",
201
+ "eslint-plugin-react-refresh": "^0.4.10",
202
+ "eslint-plugin-solid": "^0.14.2",
203
203
  "eslint-plugin-svelte": "^2.43.0",
204
- "eslint-ts-patch": "9.5.0-0",
205
204
  "eslint-typegen": "^0.3.1",
206
205
  esno: "^4.7.0",
207
206
  execa: "^9.3.1",
208
207
  "fast-glob": "^3.3.2",
209
208
  "fs-extra": "^11.2.0",
209
+ jiti: "^1.21.6",
210
210
  "lint-staged": "^15.2.9",
211
211
  "prettier-plugin-astro": "^0.14.1",
212
212
  "prettier-plugin-slidev": "^1.0.5",
@@ -221,13 +221,15 @@ var package_default = {
221
221
  vue: "^3.4.38"
222
222
  },
223
223
  resolutions: {
224
+ "@eslint-community/eslint-utils": "^4.4.0",
225
+ "@typescript-eslint/utils": "^8.2.0",
224
226
  tsx: "~4.17.0"
225
227
  },
226
228
  "simple-git-hooks": {
227
229
  "pre-commit": "npx lint-staged"
228
230
  },
229
231
  "lint-staged": {
230
- "*": "eslint --fix"
232
+ "*": "eslint --flag unstable_ts_config --fix"
231
233
  }
232
234
  };
233
235
 
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import c from "picocolors";
19
19
  var package_default = {
20
20
  name: "@antfu/eslint-config",
21
21
  type: "module",
22
- version: "2.25.2",
22
+ version: "2.26.1",
23
23
  packageManager: "pnpm@9.7.1",
24
24
  description: "Anthony's ESLint config",
25
25
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -48,7 +48,7 @@ var package_default = {
48
48
  dev: "npx @eslint/config-inspector --config eslint.config.ts",
49
49
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
50
50
  watch: "tsup --format esm,cjs --watch",
51
- lint: "eslint .",
51
+ lint: "eslint --flag unstable_ts_config .",
52
52
  typegen: "esno scripts/typegen.ts",
53
53
  prepack: "nr build",
54
54
  release: "bumpp && pnpm publish",
@@ -114,15 +114,15 @@ var package_default = {
114
114
  }
115
115
  },
116
116
  dependencies: {
117
- "@antfu/install-pkg": "^0.3.5",
117
+ "@antfu/install-pkg": "^0.4.0",
118
118
  "@clack/prompts": "^0.7.0",
119
119
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
120
- "@stylistic/eslint-plugin": "^2.6.3",
121
- "@typescript-eslint/eslint-plugin": "^8.1.0",
122
- "@typescript-eslint/parser": "^8.1.0",
120
+ "@stylistic/eslint-plugin": "^2.6.4",
121
+ "@typescript-eslint/eslint-plugin": "^8.2.0",
122
+ "@typescript-eslint/parser": "^8.2.0",
123
123
  "@vitest/eslint-plugin": "^1.0.3",
124
124
  "eslint-config-flat-gitignore": "^0.1.8",
125
- "eslint-flat-config-utils": "^0.3.0",
125
+ "eslint-flat-config-utils": "^0.3.1",
126
126
  "eslint-merge-processors": "^0.1.0",
127
127
  "eslint-plugin-antfu": "^2.3.5",
128
128
  "eslint-plugin-command": "^0.2.3",
@@ -153,31 +153,31 @@ var package_default = {
153
153
  devDependencies: {
154
154
  "@antfu/eslint-config": "workspace:*",
155
155
  "@antfu/ni": "^0.22.4",
156
- "@eslint-react/eslint-plugin": "^1.10.1",
157
- "@eslint/config-inspector": "^0.5.3",
156
+ "@eslint-react/eslint-plugin": "^1.12.0",
157
+ "@eslint/config-inspector": "^0.5.4",
158
158
  "@prettier/plugin-xml": "^3.4.1",
159
- "@stylistic/eslint-plugin-migrate": "^2.6.3",
159
+ "@stylistic/eslint-plugin-migrate": "^2.6.4",
160
160
  "@types/eslint": "^9.6.0",
161
161
  "@types/fs-extra": "^11.0.4",
162
- "@types/node": "^22.3.0",
162
+ "@types/node": "^22.4.2",
163
163
  "@types/prompts": "^2.4.9",
164
164
  "@types/yargs": "^17.0.33",
165
- "@unocss/eslint-plugin": "^0.62.1",
165
+ "@unocss/eslint-plugin": "^0.62.2",
166
166
  "astro-eslint-parser": "^1.0.2",
167
167
  bumpp: "^9.5.1",
168
- eslint: "npm:eslint-ts-patch@9.5.0-0",
168
+ eslint: "^9.9.0",
169
169
  "eslint-plugin-astro": "^1.2.3",
170
170
  "eslint-plugin-format": "^0.1.2",
171
171
  "eslint-plugin-react-hooks": "^4.6.2",
172
- "eslint-plugin-react-refresh": "^0.4.9",
173
- "eslint-plugin-solid": "^0.14.1",
172
+ "eslint-plugin-react-refresh": "^0.4.10",
173
+ "eslint-plugin-solid": "^0.14.2",
174
174
  "eslint-plugin-svelte": "^2.43.0",
175
- "eslint-ts-patch": "9.5.0-0",
176
175
  "eslint-typegen": "^0.3.1",
177
176
  esno: "^4.7.0",
178
177
  execa: "^9.3.1",
179
178
  "fast-glob": "^3.3.2",
180
179
  "fs-extra": "^11.2.0",
180
+ jiti: "^1.21.6",
181
181
  "lint-staged": "^15.2.9",
182
182
  "prettier-plugin-astro": "^0.14.1",
183
183
  "prettier-plugin-slidev": "^1.0.5",
@@ -192,13 +192,15 @@ var package_default = {
192
192
  vue: "^3.4.38"
193
193
  },
194
194
  resolutions: {
195
+ "@eslint-community/eslint-utils": "^4.4.0",
196
+ "@typescript-eslint/utils": "^8.2.0",
195
197
  tsx: "~4.17.0"
196
198
  },
197
199
  "simple-git-hooks": {
198
200
  "pre-commit": "npx lint-staged"
199
201
  },
200
202
  "lint-staged": {
201
- "*": "eslint --fix"
203
+ "*": "eslint --flag unstable_ts_config --fix"
202
204
  }
203
205
  };
204
206
 
package/dist/index.cjs CHANGED
@@ -74,6 +74,7 @@ __export(src_exports, {
74
74
  imports: () => imports,
75
75
  interopDefault: () => interopDefault,
76
76
  isInEditorEnv: () => isInEditorEnv,
77
+ isPackageInScope: () => isPackageInScope,
77
78
  javascript: () => javascript,
78
79
  jsdoc: () => jsdoc,
79
80
  jsonc: () => jsonc,
@@ -103,6 +104,10 @@ __export(src_exports, {
103
104
  });
104
105
  module.exports = __toCommonJS(src_exports);
105
106
 
107
+ // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.40_tsx@4.17.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
108
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
109
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
110
+
106
111
  // src/factory.ts
107
112
  var import_local_pkg4 = require("local-pkg");
108
113
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
@@ -189,7 +194,10 @@ var GLOB_EXCLUDE = [
189
194
 
190
195
  // src/utils.ts
191
196
  var import_node_process = __toESM(require("process"), 1);
197
+ var import_node_url = require("url");
192
198
  var import_local_pkg = require("local-pkg");
199
+ var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
200
+ var isCwdInScope = (0, import_local_pkg.isPackageExists)("@antfu/eslint-config");
193
201
  var parserPlain = {
194
202
  meta: {
195
203
  name: "parser-plain"
@@ -249,10 +257,13 @@ async function interopDefault(m) {
249
257
  const resolved = await m;
250
258
  return resolved.default || resolved;
251
259
  }
260
+ function isPackageInScope(name) {
261
+ return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
262
+ }
252
263
  async function ensurePackages(packages) {
253
- if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false)
264
+ if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
254
265
  return;
255
- const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
266
+ const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
256
267
  if (nonExistingPackages.length === 0)
257
268
  return;
258
269
  const p = await import("@clack/prompts");
@@ -423,13 +434,13 @@ async function stylistic(options = {}) {
423
434
  async function formatters(options = {}, stylistic2 = {}) {
424
435
  if (options === true) {
425
436
  options = {
426
- astro: (0, import_local_pkg2.isPackageExists)("prettier-plugin-astro"),
437
+ astro: isPackageInScope("prettier-plugin-astro"),
427
438
  css: true,
428
439
  graphql: true,
429
440
  html: true,
430
441
  markdown: true,
431
442
  slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
432
- xml: (0, import_local_pkg2.isPackageExists)("@prettier/plugin-xml")
443
+ xml: isPackageInScope("@prettier/plugin-xml")
433
444
  };
434
445
  }
435
446
  await ensurePackages([
@@ -1941,8 +1952,8 @@ async function typescript(options = {}) {
1941
1952
  },
1942
1953
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
1943
1954
  ...isTypeAware ? [
1944
- makeParser(true, filesTypeAware, ignoresTypeAware),
1945
- makeParser(false, files, filesTypeAware)
1955
+ makeParser(false, files),
1956
+ makeParser(true, filesTypeAware, ignoresTypeAware)
1946
1957
  ] : [
1947
1958
  makeParser(false, files)
1948
1959
  ],
@@ -2617,6 +2628,7 @@ var src_default = antfu;
2617
2628
  imports,
2618
2629
  interopDefault,
2619
2630
  isInEditorEnv,
2631
+ isPackageInScope,
2620
2632
  javascript,
2621
2633
  jsdoc,
2622
2634
  jsonc,
package/dist/index.d.cts CHANGED
@@ -3007,12 +3007,12 @@ interface RuleOptions {
3007
3007
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
3008
3008
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
3009
3009
  /**
3010
- * avoid using shorthand boolean attribute
3010
+ * disallow using shorthand boolean attributes
3011
3011
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
3012
3012
  */
3013
3013
  'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
3014
3014
  /**
3015
- * avoid using shorthand fragment syntax
3015
+ * disallow using shorthand fragment syntax
3016
3016
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-fragment
3017
3017
  */
3018
3018
  'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
@@ -5676,7 +5676,7 @@ interface RuleOptions {
5676
5676
  */
5677
5677
  'ts/unified-signatures'?: Linter.RuleEntry<TsUnifiedSignatures>
5678
5678
  /**
5679
- * Enforce typing arguments in `.catch()` callbacks as `unknown`
5679
+ * Enforce typing arguments in Promise rejection callbacks as `unknown`
5680
5680
  * @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
5681
5681
  */
5682
5682
  'ts/use-unknown-in-catch-callback-variable'?: Linter.RuleEntry<[]>
@@ -9825,18 +9825,11 @@ type NoRestrictedImports = ((string | {
9825
9825
  importNames?: string[]
9826
9826
  allowImportNames?: string[]
9827
9827
  })[]
9828
- patterns?: (string[] | {
9829
-
9830
- importNames?: [string, ...(string)[]]
9831
-
9832
- allowImportNames?: [string, ...(string)[]]
9833
-
9834
- group: [string, ...(string)[]]
9835
- importNamePattern?: string
9836
- allowImportNamePattern?: string
9837
- message?: string
9838
- caseSensitive?: boolean
9839
- }[])
9828
+ patterns?: (string[] | ({
9829
+ [k: string]: unknown | undefined
9830
+ } | {
9831
+ [k: string]: unknown | undefined
9832
+ })[])
9840
9833
  }])
9841
9834
  // ----- no-restricted-modules -----
9842
9835
  type NoRestrictedModules = ((string | {
@@ -12978,7 +12971,8 @@ type TsNoRestrictedImports = ((string | {
12978
12971
 
12979
12972
  allowImportNames?: [string, ...(string)[]]
12980
12973
 
12981
- group: [string, ...(string)[]]
12974
+ group?: [string, ...(string)[]]
12975
+ regex?: string
12982
12976
  importNamePattern?: string
12983
12977
  allowImportNamePattern?: string
12984
12978
  message?: string
@@ -15478,7 +15472,8 @@ declare function toArray<T>(value: T | T[]): T[];
15478
15472
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
15479
15473
  default: infer U;
15480
15474
  } ? U : T>;
15475
+ declare function isPackageInScope(name: string): boolean;
15481
15476
  declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
15482
15477
  declare function isInEditorEnv(): boolean;
15483
15478
 
15484
- 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_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 OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, 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 };
15479
+ 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_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 OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, 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 };
package/dist/index.d.ts CHANGED
@@ -3007,12 +3007,12 @@ interface RuleOptions {
3007
3007
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
3008
3008
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
3009
3009
  /**
3010
- * avoid using shorthand boolean attribute
3010
+ * disallow using shorthand boolean attributes
3011
3011
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
3012
3012
  */
3013
3013
  'react/avoid-shorthand-boolean'?: Linter.RuleEntry<[]>
3014
3014
  /**
3015
- * avoid using shorthand fragment syntax
3015
+ * disallow using shorthand fragment syntax
3016
3016
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-fragment
3017
3017
  */
3018
3018
  'react/avoid-shorthand-fragment'?: Linter.RuleEntry<[]>
@@ -5676,7 +5676,7 @@ interface RuleOptions {
5676
5676
  */
5677
5677
  'ts/unified-signatures'?: Linter.RuleEntry<TsUnifiedSignatures>
5678
5678
  /**
5679
- * Enforce typing arguments in `.catch()` callbacks as `unknown`
5679
+ * Enforce typing arguments in Promise rejection callbacks as `unknown`
5680
5680
  * @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
5681
5681
  */
5682
5682
  'ts/use-unknown-in-catch-callback-variable'?: Linter.RuleEntry<[]>
@@ -9825,18 +9825,11 @@ type NoRestrictedImports = ((string | {
9825
9825
  importNames?: string[]
9826
9826
  allowImportNames?: string[]
9827
9827
  })[]
9828
- patterns?: (string[] | {
9829
-
9830
- importNames?: [string, ...(string)[]]
9831
-
9832
- allowImportNames?: [string, ...(string)[]]
9833
-
9834
- group: [string, ...(string)[]]
9835
- importNamePattern?: string
9836
- allowImportNamePattern?: string
9837
- message?: string
9838
- caseSensitive?: boolean
9839
- }[])
9828
+ patterns?: (string[] | ({
9829
+ [k: string]: unknown | undefined
9830
+ } | {
9831
+ [k: string]: unknown | undefined
9832
+ })[])
9840
9833
  }])
9841
9834
  // ----- no-restricted-modules -----
9842
9835
  type NoRestrictedModules = ((string | {
@@ -12978,7 +12971,8 @@ type TsNoRestrictedImports = ((string | {
12978
12971
 
12979
12972
  allowImportNames?: [string, ...(string)[]]
12980
12973
 
12981
- group: [string, ...(string)[]]
12974
+ group?: [string, ...(string)[]]
12975
+ regex?: string
12982
12976
  importNamePattern?: string
12983
12977
  allowImportNamePattern?: string
12984
12978
  message?: string
@@ -15478,7 +15472,8 @@ declare function toArray<T>(value: T | T[]): T[];
15478
15472
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
15479
15473
  default: infer U;
15480
15474
  } ? U : T>;
15475
+ declare function isPackageInScope(name: string): boolean;
15481
15476
  declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
15482
15477
  declare function isInEditorEnv(): boolean;
15483
15478
 
15484
- 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_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 OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, 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 };
15479
+ 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_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 OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, 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 };
package/dist/index.js CHANGED
@@ -84,7 +84,10 @@ var GLOB_EXCLUDE = [
84
84
 
85
85
  // src/utils.ts
86
86
  import process from "node:process";
87
+ import { fileURLToPath } from "node:url";
87
88
  import { isPackageExists } from "local-pkg";
89
+ var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
90
+ var isCwdInScope = isPackageExists("@antfu/eslint-config");
88
91
  var parserPlain = {
89
92
  meta: {
90
93
  name: "parser-plain"
@@ -144,10 +147,13 @@ async function interopDefault(m) {
144
147
  const resolved = await m;
145
148
  return resolved.default || resolved;
146
149
  }
150
+ function isPackageInScope(name) {
151
+ return isPackageExists(name, { paths: [scopeUrl] });
152
+ }
147
153
  async function ensurePackages(packages) {
148
- if (process.env.CI || process.stdout.isTTY === false)
154
+ if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
149
155
  return;
150
- const nonExistingPackages = packages.filter((i) => i && !isPackageExists(i));
156
+ const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
151
157
  if (nonExistingPackages.length === 0)
152
158
  return;
153
159
  const p = await import("@clack/prompts");
@@ -318,13 +324,13 @@ async function stylistic(options = {}) {
318
324
  async function formatters(options = {}, stylistic2 = {}) {
319
325
  if (options === true) {
320
326
  options = {
321
- astro: isPackageExists2("prettier-plugin-astro"),
327
+ astro: isPackageInScope("prettier-plugin-astro"),
322
328
  css: true,
323
329
  graphql: true,
324
330
  html: true,
325
331
  markdown: true,
326
332
  slidev: isPackageExists2("@slidev/cli"),
327
- xml: isPackageExists2("@prettier/plugin-xml")
333
+ xml: isPackageInScope("@prettier/plugin-xml")
328
334
  };
329
335
  }
330
336
  await ensurePackages([
@@ -1836,8 +1842,8 @@ async function typescript(options = {}) {
1836
1842
  },
1837
1843
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
1838
1844
  ...isTypeAware ? [
1839
- makeParser(true, filesTypeAware, ignoresTypeAware),
1840
- makeParser(false, files, filesTypeAware)
1845
+ makeParser(false, files),
1846
+ makeParser(true, filesTypeAware, ignoresTypeAware)
1841
1847
  ] : [
1842
1848
  makeParser(false, files)
1843
1849
  ],
@@ -2512,6 +2518,7 @@ export {
2512
2518
  imports,
2513
2519
  interopDefault,
2514
2520
  isInEditorEnv,
2521
+ isPackageInScope,
2515
2522
  javascript,
2516
2523
  jsdoc,
2517
2524
  jsonc,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "2.25.2",
4
+ "version": "2.26.1",
5
5
  "description": "Anthony's ESLint config",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
7
7
  "license": "MIT",
@@ -81,15 +81,15 @@
81
81
  }
82
82
  },
83
83
  "dependencies": {
84
- "@antfu/install-pkg": "^0.3.5",
84
+ "@antfu/install-pkg": "^0.4.0",
85
85
  "@clack/prompts": "^0.7.0",
86
86
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
87
- "@stylistic/eslint-plugin": "^2.6.3",
88
- "@typescript-eslint/eslint-plugin": "^8.1.0",
89
- "@typescript-eslint/parser": "^8.1.0",
87
+ "@stylistic/eslint-plugin": "^2.6.4",
88
+ "@typescript-eslint/eslint-plugin": "^8.2.0",
89
+ "@typescript-eslint/parser": "^8.2.0",
90
90
  "@vitest/eslint-plugin": "^1.0.3",
91
91
  "eslint-config-flat-gitignore": "^0.1.8",
92
- "eslint-flat-config-utils": "^0.3.0",
92
+ "eslint-flat-config-utils": "^0.3.1",
93
93
  "eslint-merge-processors": "^0.1.0",
94
94
  "eslint-plugin-antfu": "^2.3.5",
95
95
  "eslint-plugin-command": "^0.2.3",
@@ -119,31 +119,31 @@
119
119
  },
120
120
  "devDependencies": {
121
121
  "@antfu/ni": "^0.22.4",
122
- "@eslint-react/eslint-plugin": "^1.10.1",
123
- "@eslint/config-inspector": "^0.5.3",
122
+ "@eslint-react/eslint-plugin": "^1.12.0",
123
+ "@eslint/config-inspector": "^0.5.4",
124
124
  "@prettier/plugin-xml": "^3.4.1",
125
- "@stylistic/eslint-plugin-migrate": "^2.6.3",
125
+ "@stylistic/eslint-plugin-migrate": "^2.6.4",
126
126
  "@types/eslint": "^9.6.0",
127
127
  "@types/fs-extra": "^11.0.4",
128
- "@types/node": "^22.3.0",
128
+ "@types/node": "^22.4.2",
129
129
  "@types/prompts": "^2.4.9",
130
130
  "@types/yargs": "^17.0.33",
131
- "@unocss/eslint-plugin": "^0.62.1",
131
+ "@unocss/eslint-plugin": "^0.62.2",
132
132
  "astro-eslint-parser": "^1.0.2",
133
133
  "bumpp": "^9.5.1",
134
- "eslint": "npm:eslint-ts-patch@9.5.0-0",
134
+ "eslint": "^9.9.0",
135
135
  "eslint-plugin-astro": "^1.2.3",
136
136
  "eslint-plugin-format": "^0.1.2",
137
137
  "eslint-plugin-react-hooks": "^4.6.2",
138
- "eslint-plugin-react-refresh": "^0.4.9",
139
- "eslint-plugin-solid": "^0.14.1",
138
+ "eslint-plugin-react-refresh": "^0.4.10",
139
+ "eslint-plugin-solid": "^0.14.2",
140
140
  "eslint-plugin-svelte": "^2.43.0",
141
- "eslint-ts-patch": "9.5.0-0",
142
141
  "eslint-typegen": "^0.3.1",
143
142
  "esno": "^4.7.0",
144
143
  "execa": "^9.3.1",
145
144
  "fast-glob": "^3.3.2",
146
145
  "fs-extra": "^11.2.0",
146
+ "jiti": "^1.21.6",
147
147
  "lint-staged": "^15.2.9",
148
148
  "prettier-plugin-astro": "^0.14.1",
149
149
  "prettier-plugin-slidev": "^1.0.5",
@@ -156,16 +156,18 @@
156
156
  "typescript": "^5.5.4",
157
157
  "vitest": "^2.0.5",
158
158
  "vue": "^3.4.38",
159
- "@antfu/eslint-config": "2.25.2"
159
+ "@antfu/eslint-config": "2.26.1"
160
160
  },
161
161
  "resolutions": {
162
+ "@eslint-community/eslint-utils": "^4.4.0",
163
+ "@typescript-eslint/utils": "^8.2.0",
162
164
  "tsx": "~4.17.0"
163
165
  },
164
166
  "simple-git-hooks": {
165
167
  "pre-commit": "npx lint-staged"
166
168
  },
167
169
  "lint-staged": {
168
- "*": "eslint --fix"
170
+ "*": "eslint --flag unstable_ts_config --fix"
169
171
  },
170
172
  "scripts": {
171
173
  "build": "nr typegen && tsup --format esm,cjs --clean --dts",
@@ -173,7 +175,7 @@
173
175
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
174
176
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
175
177
  "watch": "tsup --format esm,cjs --watch",
176
- "lint": "eslint .",
178
+ "lint": "eslint --flag unstable_ts_config .",
177
179
  "typegen": "esno scripts/typegen.ts",
178
180
  "release": "bumpp && pnpm publish",
179
181
  "test": "vitest",