@antfu/eslint-config 9.0.0 → 9.2.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/README.md +5 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +26 -26
- package/dist/index.d.mts +3693 -1272
- package/dist/index.mjs +11 -7
- package/dist/{lib-C1Uxp5ZW.mjs → lib-BGCOhS6c.mjs} +249 -245
- package/package.json +67 -65
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsPromises from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import fs
|
|
5
|
+
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { isPackageExists } from "local-pkg";
|
|
8
8
|
import createCommand from "eslint-plugin-command/config";
|
|
@@ -27,7 +27,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
|
|
|
27
27
|
while (directory) {
|
|
28
28
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
29
29
|
try {
|
|
30
|
-
const stats = await
|
|
30
|
+
const stats = await fsPromises.stat(filePath);
|
|
31
31
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
32
32
|
} catch {}
|
|
33
33
|
if (directory === stopAt || directory === root) break;
|
|
@@ -42,7 +42,7 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
42
42
|
while (directory) {
|
|
43
43
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
44
44
|
try {
|
|
45
|
-
const stats = fs
|
|
45
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
46
46
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
47
47
|
} catch {}
|
|
48
48
|
if (directory === stopAt || directory === root) break;
|
|
@@ -1219,7 +1219,7 @@ async function perfectionist(options) {
|
|
|
1219
1219
|
async function detectCatalogUsage() {
|
|
1220
1220
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1221
1221
|
if (!workspaceFile) return false;
|
|
1222
|
-
const yaml = await
|
|
1222
|
+
const yaml = await fsPromises.readFile(workspaceFile, "utf-8");
|
|
1223
1223
|
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1224
1224
|
}
|
|
1225
1225
|
async function pnpm(options) {
|
|
@@ -1551,6 +1551,7 @@ async function sortPackageJson() {
|
|
|
1551
1551
|
"activationEvents",
|
|
1552
1552
|
"contributes",
|
|
1553
1553
|
"scripts",
|
|
1554
|
+
"scripts-info",
|
|
1554
1555
|
"peerDependencies",
|
|
1555
1556
|
"peerDependenciesMeta",
|
|
1556
1557
|
"dependencies",
|
|
@@ -2001,7 +2002,7 @@ async function typescript(options = {}) {
|
|
|
2001
2002
|
}] : [],
|
|
2002
2003
|
...erasableOnly ? [{
|
|
2003
2004
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2004
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2005
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-BGCOhS6c.mjs")) },
|
|
2005
2006
|
rules: {
|
|
2006
2007
|
"erasable-syntax-only/enums": "error",
|
|
2007
2008
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -2016,8 +2017,11 @@ async function typescript(options = {}) {
|
|
|
2016
2017
|
async function unicorn(options = {}) {
|
|
2017
2018
|
const { allRecommended = false, overrides = {} } = options;
|
|
2018
2019
|
return [{
|
|
2020
|
+
name: "antfu/unicorn/setup",
|
|
2021
|
+
plugins: { unicorn: pluginUnicorn }
|
|
2022
|
+
}, {
|
|
2023
|
+
files: [GLOB_SRC],
|
|
2019
2024
|
name: "antfu/unicorn/rules",
|
|
2020
|
-
plugins: { unicorn: pluginUnicorn },
|
|
2021
2025
|
rules: {
|
|
2022
2026
|
...allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
2023
2027
|
"unicorn/consistent-empty-array-spread": "error",
|