@antfu/eslint-config 9.0.0 → 9.1.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 +4 -0
- package/dist/cli.mjs +26 -26
- package/dist/index.d.mts +1352 -279
- package/dist/index.mjs +10 -7
- package/dist/{lib-C1Uxp5ZW.mjs → lib-NWAatdeh.mjs} +249 -245
- package/package.json +59 -57
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) {
|
|
@@ -2001,7 +2001,7 @@ async function typescript(options = {}) {
|
|
|
2001
2001
|
}] : [],
|
|
2002
2002
|
...erasableOnly ? [{
|
|
2003
2003
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2004
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2004
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-NWAatdeh.mjs")) },
|
|
2005
2005
|
rules: {
|
|
2006
2006
|
"erasable-syntax-only/enums": "error",
|
|
2007
2007
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -2016,8 +2016,11 @@ async function typescript(options = {}) {
|
|
|
2016
2016
|
async function unicorn(options = {}) {
|
|
2017
2017
|
const { allRecommended = false, overrides = {} } = options;
|
|
2018
2018
|
return [{
|
|
2019
|
+
name: "antfu/unicorn/setup",
|
|
2020
|
+
plugins: { unicorn: pluginUnicorn }
|
|
2021
|
+
}, {
|
|
2022
|
+
files: [GLOB_SRC],
|
|
2019
2023
|
name: "antfu/unicorn/rules",
|
|
2020
|
-
plugins: { unicorn: pluginUnicorn },
|
|
2021
2024
|
rules: {
|
|
2022
2025
|
...allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
2023
2026
|
"unicorn/consistent-empty-array-spread": "error",
|