@antfu/eslint-config 6.5.0 → 6.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/bin/index.mjs +2 -0
- package/dist/cli.mjs +3 -3
- package/dist/index.d.mts +8 -2
- package/dist/index.mjs +26 -4
- package/dist/{lib-_JXSfbp_.mjs → lib-orfHobL2.mjs} +220 -220
- package/package.json +16 -13
- package/bin/index.js +0 -2
package/bin/index.mjs
ADDED
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import parse from "parse-gitignore";
|
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "6.
|
|
12
|
+
var version = "6.6.0";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/cli/constants.ts
|
|
@@ -172,8 +172,8 @@ async function updateEslintFiles(result) {
|
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/cli/constants-generated.ts
|
|
174
174
|
const versionsMap = {
|
|
175
|
-
"@eslint-react/eslint-plugin": "^2.3.
|
|
176
|
-
"@next/eslint-plugin-next": "^16.0.
|
|
175
|
+
"@eslint-react/eslint-plugin": "^2.3.13",
|
|
176
|
+
"@next/eslint-plugin-next": "^16.0.8",
|
|
177
177
|
"@unocss/eslint-plugin": "^66.5.10",
|
|
178
178
|
"astro-eslint-parser": "^1.2.2",
|
|
179
179
|
"eslint": "^9.39.1",
|
package/dist/index.d.mts
CHANGED
|
@@ -18577,6 +18577,12 @@ interface OptionsRegExp {
|
|
|
18577
18577
|
interface OptionsIsInEditor {
|
|
18578
18578
|
isInEditor?: boolean;
|
|
18579
18579
|
}
|
|
18580
|
+
interface OptionsPnpm extends OptionsIsInEditor {
|
|
18581
|
+
/**
|
|
18582
|
+
* Requires catalogs usage
|
|
18583
|
+
*/
|
|
18584
|
+
catalogs?: boolean;
|
|
18585
|
+
}
|
|
18580
18586
|
interface OptionsUnoCSS extends OptionsOverrides {
|
|
18581
18587
|
/**
|
|
18582
18588
|
* Enable attributify support.
|
|
@@ -18897,7 +18903,7 @@ declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
|
18897
18903
|
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
18898
18904
|
//#endregion
|
|
18899
18905
|
//#region src/configs/pnpm.d.ts
|
|
18900
|
-
declare function pnpm(options:
|
|
18906
|
+
declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
|
|
18901
18907
|
//#endregion
|
|
18902
18908
|
//#region src/configs/react.d.ts
|
|
18903
18909
|
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsReact & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
@@ -19058,4 +19064,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
19058
19064
|
declare function isInEditorEnv(): boolean;
|
|
19059
19065
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
19060
19066
|
//#endregion
|
|
19061
|
-
export { 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, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsOverrides, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, antfu, antfu as default, astro, combine, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
19067
|
+
export { 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, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, antfu, antfu as default, astro, combine, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -19,6 +19,21 @@ import { configs } from "eslint-plugin-regexp";
|
|
|
19
19
|
|
|
20
20
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
21
21
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
22
|
+
async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
23
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
24
|
+
const { root } = path.parse(directory);
|
|
25
|
+
stopAt = path.resolve(directory, toPath(stopAt ?? root));
|
|
26
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
27
|
+
while (directory) {
|
|
28
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
29
|
+
try {
|
|
30
|
+
const stats = await fsPromises.stat(filePath);
|
|
31
|
+
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
32
|
+
} catch {}
|
|
33
|
+
if (directory === stopAt || directory === root) break;
|
|
34
|
+
directory = path.dirname(directory);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
22
37
|
function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
23
38
|
let directory = path.resolve(toPath(cwd) ?? "");
|
|
24
39
|
const { root } = path.parse(directory);
|
|
@@ -1125,12 +1140,19 @@ async function perfectionist() {
|
|
|
1125
1140
|
|
|
1126
1141
|
//#endregion
|
|
1127
1142
|
//#region src/configs/pnpm.ts
|
|
1143
|
+
async function detectCatalogUsage() {
|
|
1144
|
+
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1145
|
+
if (!workspaceFile) return false;
|
|
1146
|
+
const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
|
|
1147
|
+
return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
|
|
1148
|
+
}
|
|
1128
1149
|
async function pnpm(options) {
|
|
1129
1150
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
1130
1151
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
1131
1152
|
interopDefault(import("yaml-eslint-parser")),
|
|
1132
1153
|
interopDefault(import("jsonc-eslint-parser"))
|
|
1133
1154
|
]);
|
|
1155
|
+
const { catalogs = detectCatalogUsage(), isInEditor = false } = options;
|
|
1134
1156
|
return [
|
|
1135
1157
|
{
|
|
1136
1158
|
files: ["package.json", "**/package.json"],
|
|
@@ -1138,9 +1160,9 @@ async function pnpm(options) {
|
|
|
1138
1160
|
name: "antfu/pnpm/package-json",
|
|
1139
1161
|
plugins: { pnpm: pluginPnpm },
|
|
1140
1162
|
rules: {
|
|
1141
|
-
"pnpm/json-enforce-catalog": ["error", { autofix: !
|
|
1142
|
-
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !
|
|
1143
|
-
"pnpm/json-valid-catalog": ["error", { autofix: !
|
|
1163
|
+
...catalogs ? { "pnpm/json-enforce-catalog": ["error", { autofix: !isInEditor }] } : {},
|
|
1164
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !isInEditor }],
|
|
1165
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
|
|
1144
1166
|
}
|
|
1145
1167
|
},
|
|
1146
1168
|
{
|
|
@@ -2003,7 +2025,7 @@ async function typescript(options = {}) {
|
|
|
2003
2025
|
}] : [],
|
|
2004
2026
|
...erasableOnly ? [{
|
|
2005
2027
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2006
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2028
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-orfHobL2.mjs")) },
|
|
2007
2029
|
rules: {
|
|
2008
2030
|
"erasable-syntax-only/enums": "error",
|
|
2009
2031
|
"erasable-syntax-only/import-aliases": "error",
|