@so1ve/eslint-config 4.1.1 → 4.1.3
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/index.mjs +6 -35
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -12,10 +12,9 @@ import * as pluginRegexp from "eslint-plugin-regexp";
|
|
|
12
12
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
13
13
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
14
14
|
import globals from "globals";
|
|
15
|
-
import fs from "node:fs/promises";
|
|
16
15
|
import process$1 from "node:process";
|
|
17
16
|
import { fileURLToPath } from "node:url";
|
|
18
|
-
import fs
|
|
17
|
+
import fs from "node:fs";
|
|
19
18
|
import path from "node:path";
|
|
20
19
|
import tseslint from "typescript-eslint";
|
|
21
20
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
@@ -1505,21 +1504,6 @@ async function perfectionist() {
|
|
|
1505
1504
|
//#endregion
|
|
1506
1505
|
//#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
1507
1506
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
1508
|
-
async function findUp(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
|
|
1509
|
-
let directory = path.resolve(toPath(cwd) ?? "");
|
|
1510
|
-
const { root } = path.parse(directory);
|
|
1511
|
-
stopAt = path.resolve(directory, toPath(stopAt ?? root));
|
|
1512
|
-
const isAbsoluteName = path.isAbsolute(name$1);
|
|
1513
|
-
while (directory) {
|
|
1514
|
-
const filePath = isAbsoluteName ? name$1 : path.join(directory, name$1);
|
|
1515
|
-
try {
|
|
1516
|
-
const stats = await fs.stat(filePath);
|
|
1517
|
-
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
1518
|
-
} catch {}
|
|
1519
|
-
if (directory === stopAt || directory === root) break;
|
|
1520
|
-
directory = path.dirname(directory);
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
1507
|
function findUpSync(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
|
|
1524
1508
|
let directory = path.resolve(toPath(cwd) ?? "");
|
|
1525
1509
|
const { root } = path.parse(directory);
|
|
@@ -1528,7 +1512,7 @@ function findUpSync(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {
|
|
|
1528
1512
|
while (directory) {
|
|
1529
1513
|
const filePath = isAbsoluteName ? name$1 : path.join(directory, name$1);
|
|
1530
1514
|
try {
|
|
1531
|
-
const stats = fs
|
|
1515
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
1532
1516
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
1533
1517
|
} catch {}
|
|
1534
1518
|
if (directory === stopAt || directory === root) break;
|
|
@@ -1538,14 +1522,8 @@ function findUpSync(name$1, { cwd = process$1.cwd(), type = "file", stopAt } = {
|
|
|
1538
1522
|
|
|
1539
1523
|
//#endregion
|
|
1540
1524
|
//#region src/configs/pnpm.ts
|
|
1541
|
-
async function detectCatalogUsage() {
|
|
1542
|
-
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1543
|
-
if (!workspaceFile) return false;
|
|
1544
|
-
const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
|
|
1545
|
-
return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
|
|
1546
|
-
}
|
|
1547
1525
|
async function pnpm(options) {
|
|
1548
|
-
const {
|
|
1526
|
+
const { json = true, yaml: yaml$1 = true } = options;
|
|
1549
1527
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
1550
1528
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
1551
1529
|
yaml$1 ? interopDefault(import("yaml-eslint-parser")) : void 0,
|
|
@@ -1557,21 +1535,14 @@ async function pnpm(options) {
|
|
|
1557
1535
|
languageOptions: { parser: jsoncParser },
|
|
1558
1536
|
name: "so1ve/pnpm/package-json",
|
|
1559
1537
|
plugins: { pnpm: pluginPnpm },
|
|
1560
|
-
rules: {
|
|
1561
|
-
...catalogs && { "pnpm/json-enforce-catalog": ["error", { ignores: ["@types/vscode"] }] },
|
|
1562
|
-
"pnpm/json-prefer-workspace-settings": "error",
|
|
1563
|
-
"pnpm/json-valid-catalog": "error"
|
|
1564
|
-
}
|
|
1538
|
+
rules: { "pnpm/json-prefer-workspace-settings": "error" }
|
|
1565
1539
|
});
|
|
1566
1540
|
if (yaml$1) configs$1.push({
|
|
1567
1541
|
files: ["pnpm-workspace.yaml"],
|
|
1568
1542
|
languageOptions: { parser: yamlParser },
|
|
1569
1543
|
name: "so1ve/pnpm/pnpm-workspace-yaml",
|
|
1570
1544
|
plugins: { pnpm: pluginPnpm },
|
|
1571
|
-
rules: {
|
|
1572
|
-
"pnpm/yaml-enforce-settings": ["error", { settings: { shellEmulator: true } }],
|
|
1573
|
-
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1574
|
-
}
|
|
1545
|
+
rules: { "pnpm/yaml-enforce-settings": ["error", { settings: { shellEmulator: true } }] }
|
|
1575
1546
|
}, {
|
|
1576
1547
|
files: ["pnpm-workspace.yaml"],
|
|
1577
1548
|
name: "so1ve/yaml/pnpm-workspace-yaml-sort",
|
|
@@ -2284,7 +2255,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
2284
2255
|
const { astro: enableAstro = isPackageExists("astro"), componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], pnpm: enablePnpm = !!findUpSync("pnpm-workspace.yaml"), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2285
2256
|
const configs$1 = [];
|
|
2286
2257
|
if (enableGitignore) if (typeof enableGitignore === "boolean") {
|
|
2287
|
-
if (fs
|
|
2258
|
+
if (fs.existsSync(".gitignore")) configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2288
2259
|
} else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2289
2260
|
configs$1.push(ignores(userIgnores), javascript({ overrides: getOverrides(options, "javascript") }), comments(), node(), onlyError(), promise(), sortImports(), imports(), unicorn(), command(), deMorgan());
|
|
2290
2261
|
if (enablePnpm) configs$1.push(pnpm({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Ray's eslint config.",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"typescript-eslint": "^8.50.1",
|
|
77
77
|
"vue-eslint-parser": "^10.2.0",
|
|
78
78
|
"yaml-eslint-parser": "^1.3.2",
|
|
79
|
-
"@so1ve/eslint-plugin": "4.1.
|
|
79
|
+
"@so1ve/eslint-plugin": "4.1.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"eslint-plugin-de-morgan": "^2.0.0",
|