@luxass/eslint-config 7.0.1 → 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.d.mts +10 -1
- package/dist/index.mjs +25 -8
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -232,7 +232,7 @@ interface FormattersOptions {
|
|
|
232
232
|
declare function formatters(options?: FormattersOptions | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/configs/ignores.d.ts
|
|
235
|
-
declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
|
|
235
|
+
declare function ignores(userIgnores?: string[] | ((originals: string[]) => string[]), ignoreTypeScript?: boolean): Promise<TypedFlatConfigItem[]>;
|
|
236
236
|
//#endregion
|
|
237
237
|
//#region src/configs/imports.d.ts
|
|
238
238
|
interface ImportsOptions {
|
|
@@ -17312,6 +17312,15 @@ interface ConfigOptions {
|
|
|
17312
17312
|
* @default true
|
|
17313
17313
|
*/
|
|
17314
17314
|
gitignore?: FlatGitignoreOptions | boolean;
|
|
17315
|
+
/**
|
|
17316
|
+
* Extend the global ignores.
|
|
17317
|
+
*
|
|
17318
|
+
* Passing an array to extends the ignores.
|
|
17319
|
+
* Passing a function to modify the default ignores.
|
|
17320
|
+
*
|
|
17321
|
+
* @default []
|
|
17322
|
+
*/
|
|
17323
|
+
ignores?: string[] | ((originals: string[]) => string[]);
|
|
17315
17324
|
/**
|
|
17316
17325
|
* Options for eslint-plugin-unicorn.
|
|
17317
17326
|
*
|
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;
|
|
@@ -666,9 +666,13 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
666
666
|
|
|
667
667
|
//#endregion
|
|
668
668
|
//#region src/configs/ignores.ts
|
|
669
|
-
async function ignores(userIgnores = []) {
|
|
669
|
+
async function ignores(userIgnores = [], ignoreTypeScript = false) {
|
|
670
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
671
|
+
if (ignoreTypeScript) ignores.push(GLOB_TS, GLOB_TSX);
|
|
672
|
+
if (typeof userIgnores === "function") ignores = userIgnores(ignores);
|
|
673
|
+
else ignores = [...ignores, ...userIgnores];
|
|
670
674
|
return [{
|
|
671
|
-
ignores
|
|
675
|
+
ignores,
|
|
672
676
|
name: "luxass/ignores"
|
|
673
677
|
}];
|
|
674
678
|
}
|
|
@@ -943,6 +947,7 @@ async function javascript(options = {}) {
|
|
|
943
947
|
async function jsdoc(options = {}) {
|
|
944
948
|
const { overrides, stylistic = true } = options;
|
|
945
949
|
return [{
|
|
950
|
+
files: [GLOB_SRC],
|
|
946
951
|
name: "luxass/jsdoc/rules",
|
|
947
952
|
plugins: { jsdoc: await interop(import("eslint-plugin-jsdoc")) },
|
|
948
953
|
rules: {
|
|
@@ -1109,6 +1114,7 @@ async function markdown(options = {}) {
|
|
|
1109
1114
|
//#region src/configs/node.ts
|
|
1110
1115
|
function node() {
|
|
1111
1116
|
return [{
|
|
1117
|
+
files: [GLOB_SRC],
|
|
1112
1118
|
name: "luxass/node",
|
|
1113
1119
|
plugins: { node: pluginNode },
|
|
1114
1120
|
rules: {
|
|
@@ -1183,7 +1189,7 @@ async function perfectionist() {
|
|
|
1183
1189
|
async function detectCatalogUsage() {
|
|
1184
1190
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1185
1191
|
if (!workspaceFile) return false;
|
|
1186
|
-
const yaml = await
|
|
1192
|
+
const yaml = await fs.readFile(workspaceFile, "utf-8");
|
|
1187
1193
|
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1188
1194
|
}
|
|
1189
1195
|
async function pnpm(options) {
|
|
@@ -1321,6 +1327,7 @@ const ReactRouterPackages = [
|
|
|
1321
1327
|
"@react-router/serve",
|
|
1322
1328
|
"@react-router/dev"
|
|
1323
1329
|
];
|
|
1330
|
+
const TanstackRouterPackages = ["@tanstack/react-router"];
|
|
1324
1331
|
const NextJsPackages = ["next"];
|
|
1325
1332
|
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1326
1333
|
async function react(options = {}) {
|
|
@@ -1346,6 +1353,7 @@ async function react(options = {}) {
|
|
|
1346
1353
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1347
1354
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1348
1355
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1356
|
+
const isUsingTanstackRouter = TanstackRouterPackages.some((i) => isPackageExists(i));
|
|
1349
1357
|
const plugins = pluginReact.configs.all.plugins;
|
|
1350
1358
|
return [
|
|
1351
1359
|
{
|
|
@@ -1475,6 +1483,15 @@ async function react(options = {}) {
|
|
|
1475
1483
|
"clientAction",
|
|
1476
1484
|
"handle",
|
|
1477
1485
|
"shouldRevalidate"
|
|
1486
|
+
] : []],
|
|
1487
|
+
extraHOCs: [...isUsingTanstackRouter ? [
|
|
1488
|
+
"createFileRoute",
|
|
1489
|
+
"createLazyFileRoute",
|
|
1490
|
+
"createRootRoute",
|
|
1491
|
+
"createRootRouteWithContext",
|
|
1492
|
+
"createLink",
|
|
1493
|
+
"createRoute",
|
|
1494
|
+
"createLazyRoute"
|
|
1478
1495
|
] : []]
|
|
1479
1496
|
}],
|
|
1480
1497
|
...overrides
|
|
@@ -2345,7 +2362,7 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2345
2362
|
})]));
|
|
2346
2363
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2347
2364
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2348
|
-
configs.push(ignores(userIgnores), javascript({
|
|
2365
|
+
configs.push(ignores(userIgnores, !enableTypeScript), javascript({
|
|
2349
2366
|
isInEditor,
|
|
2350
2367
|
overrides: getOverrides(options, "javascript")
|
|
2351
2368
|
}), comments(), command(), perfectionist());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxass/eslint-config",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "ESLint config for @luxass",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@prettier/plugin-xml": "^3.4.1",
|
|
40
40
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
41
41
|
"astro-eslint-parser": "^1.0.2",
|
|
42
|
-
"eslint": "^9.10.0",
|
|
42
|
+
"eslint": "^9.10.0 || ^10.0.0",
|
|
43
43
|
"eslint-plugin-astro": "^1.2.0",
|
|
44
44
|
"eslint-plugin-format": ">=0.1.0",
|
|
45
45
|
"eslint-plugin-react-hooks": "^7.0.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
92
92
|
"eslint-flat-config-utils": "^3.0.1",
|
|
93
93
|
"eslint-merge-processors": "^2.0.0",
|
|
94
|
-
"eslint-plugin-antfu": "^3.2.
|
|
94
|
+
"eslint-plugin-antfu": "^3.2.1",
|
|
95
95
|
"eslint-plugin-command": "^3.4.0",
|
|
96
96
|
"eslint-plugin-import-lite": "^0.5.0",
|
|
97
97
|
"eslint-plugin-jsdoc": "^62.5.3",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"yaml-eslint-parser": "^2.0.0"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@eslint-react/eslint-plugin": "^2.
|
|
118
|
+
"@eslint-react/eslint-plugin": "^2.12.4",
|
|
119
119
|
"@eslint/config-inspector": "^1.4.2",
|
|
120
120
|
"@prettier/plugin-xml": "^3.4.2",
|
|
121
121
|
"@types/node": "^25.2.1",
|