@antfu/eslint-config 2.25.2 → 2.26.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.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.0",
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/)",
@@ -146,7 +146,7 @@ var package_default = {
146
146
  "@antfu/install-pkg": "^0.3.5",
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",
149
+ "@stylistic/eslint-plugin": "^2.6.4",
150
150
  "@typescript-eslint/eslint-plugin": "^8.1.0",
151
151
  "@typescript-eslint/parser": "^8.1.0",
152
152
  "@vitest/eslint-plugin": "^1.0.3",
@@ -185,13 +185,13 @@ var package_default = {
185
185
  "@eslint-react/eslint-plugin": "^1.10.1",
186
186
  "@eslint/config-inspector": "^0.5.3",
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
191
  "@types/node": "^22.3.0",
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
197
  eslint: "npm:eslint-ts-patch@9.5.0-0",
@@ -221,6 +221,8 @@ 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.1.0",
224
226
  tsx: "~4.17.0"
225
227
  },
226
228
  "simple-git-hooks": {
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.0",
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/)",
@@ -117,7 +117,7 @@ var package_default = {
117
117
  "@antfu/install-pkg": "^0.3.5",
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",
120
+ "@stylistic/eslint-plugin": "^2.6.4",
121
121
  "@typescript-eslint/eslint-plugin": "^8.1.0",
122
122
  "@typescript-eslint/parser": "^8.1.0",
123
123
  "@vitest/eslint-plugin": "^1.0.3",
@@ -156,13 +156,13 @@ var package_default = {
156
156
  "@eslint-react/eslint-plugin": "^1.10.1",
157
157
  "@eslint/config-inspector": "^0.5.3",
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
162
  "@types/node": "^22.3.0",
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
168
  eslint: "npm:eslint-ts-patch@9.5.0-0",
@@ -192,6 +192,8 @@ 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.1.0",
195
197
  tsx: "~4.17.0"
196
198
  },
197
199
  "simple-git-hooks": {
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
@@ -15478,7 +15478,8 @@ declare function toArray<T>(value: T | T[]): T[];
15478
15478
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
15479
15479
  default: infer U;
15480
15480
  } ? U : T>;
15481
+ declare function isPackageInScope(name: string): boolean;
15481
15482
  declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
15482
15483
  declare function isInEditorEnv(): boolean;
15483
15484
 
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 };
15485
+ 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
@@ -15478,7 +15478,8 @@ declare function toArray<T>(value: T | T[]): T[];
15478
15478
  declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
15479
15479
  default: infer U;
15480
15480
  } ? U : T>;
15481
+ declare function isPackageInScope(name: string): boolean;
15481
15482
  declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
15482
15483
  declare function isInEditorEnv(): boolean;
15483
15484
 
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 };
15485
+ 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.0",
5
5
  "description": "Anthony's ESLint config",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
7
7
  "license": "MIT",
@@ -84,7 +84,7 @@
84
84
  "@antfu/install-pkg": "^0.3.5",
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",
87
+ "@stylistic/eslint-plugin": "^2.6.4",
88
88
  "@typescript-eslint/eslint-plugin": "^8.1.0",
89
89
  "@typescript-eslint/parser": "^8.1.0",
90
90
  "@vitest/eslint-plugin": "^1.0.3",
@@ -122,13 +122,13 @@
122
122
  "@eslint-react/eslint-plugin": "^1.10.1",
123
123
  "@eslint/config-inspector": "^0.5.3",
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
128
  "@types/node": "^22.3.0",
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
134
  "eslint": "npm:eslint-ts-patch@9.5.0-0",
@@ -156,9 +156,11 @@
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.0"
160
160
  },
161
161
  "resolutions": {
162
+ "@eslint-community/eslint-utils": "^4.4.0",
163
+ "@typescript-eslint/utils": "^8.1.0",
162
164
  "tsx": "~4.17.0"
163
165
  },
164
166
  "simple-git-hooks": {