@luxass/eslint-config 7.1.0 → 7.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/dist/index.mjs +16 -5
- package/package.json +1 -1
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 fs from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import fs from "node:fs";
|
|
5
|
+
import fs$1 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 fs.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.statSync(filePath, { throwIfNoEntry: false });
|
|
45
|
+
const stats = fs$1.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;
|
|
@@ -1189,7 +1189,7 @@ async function perfectionist() {
|
|
|
1189
1189
|
async function detectCatalogUsage() {
|
|
1190
1190
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1191
1191
|
if (!workspaceFile) return false;
|
|
1192
|
-
const yaml = await
|
|
1192
|
+
const yaml = await fs.readFile(workspaceFile, "utf-8");
|
|
1193
1193
|
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1194
1194
|
}
|
|
1195
1195
|
async function pnpm(options) {
|
|
@@ -1327,6 +1327,7 @@ const ReactRouterPackages = [
|
|
|
1327
1327
|
"@react-router/serve",
|
|
1328
1328
|
"@react-router/dev"
|
|
1329
1329
|
];
|
|
1330
|
+
const TanstackRouterPackages = ["@tanstack/react-router"];
|
|
1330
1331
|
const NextJsPackages = ["next"];
|
|
1331
1332
|
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1332
1333
|
async function react(options = {}) {
|
|
@@ -1352,6 +1353,7 @@ async function react(options = {}) {
|
|
|
1352
1353
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1353
1354
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1354
1355
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1356
|
+
const isUsingTanstackRouter = TanstackRouterPackages.some((i) => isPackageExists(i));
|
|
1355
1357
|
const plugins = pluginReact.configs.all.plugins;
|
|
1356
1358
|
return [
|
|
1357
1359
|
{
|
|
@@ -1481,6 +1483,15 @@ async function react(options = {}) {
|
|
|
1481
1483
|
"clientAction",
|
|
1482
1484
|
"handle",
|
|
1483
1485
|
"shouldRevalidate"
|
|
1486
|
+
] : []],
|
|
1487
|
+
extraHOCs: [...isUsingTanstackRouter ? [
|
|
1488
|
+
"createFileRoute",
|
|
1489
|
+
"createLazyFileRoute",
|
|
1490
|
+
"createRootRoute",
|
|
1491
|
+
"createRootRouteWithContext",
|
|
1492
|
+
"createLink",
|
|
1493
|
+
"createRoute",
|
|
1494
|
+
"createLazyRoute"
|
|
1484
1495
|
] : []]
|
|
1485
1496
|
}],
|
|
1486
1497
|
...overrides
|