@sushichan044/eslint-config-array-resolver 0.1.3 → 0.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.ts → index.d.mts} +0 -7
- package/dist/{index.js → index.mjs} +24 -28
- package/package.json +23 -24
|
@@ -2,18 +2,11 @@ import { RuleMetaData } from "@typescript-eslint/utils/ts-eslint";
|
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
3
|
|
|
4
4
|
//#region src/resolver.d.ts
|
|
5
|
-
|
|
6
5
|
interface ESLintConfig {
|
|
7
6
|
configs: FlatConfigItem[];
|
|
8
7
|
dependencies: string[];
|
|
9
8
|
payload: Payload;
|
|
10
9
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Traverse and find the ESLint config file.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
10
|
interface ReadFlatConfigOptions {
|
|
18
11
|
suppressOutput?: boolean;
|
|
19
12
|
}
|
|
@@ -63,9 +63,8 @@ const findConfigPath = (root) => {
|
|
|
63
63
|
const resolveFlatConfig = async (root, options = {}) => {
|
|
64
64
|
const { suppressOutput = false } = options;
|
|
65
65
|
const { basePath, fullPath } = findConfigPath(root);
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const { dependencies, module: configModule } = await importPromise;
|
|
66
|
+
const startImportConfig = async () => runInDirectory(basePath, async () => unrun({ path: fullPath }));
|
|
67
|
+
const { dependencies, module: configModule } = await (suppressOutput ? executeWithSilentLogs(startImportConfig) : startImportConfig());
|
|
69
68
|
const rawConfigs = Array.isArray(configModule) ? configModule : [configModule];
|
|
70
69
|
rawConfigs.unshift({
|
|
71
70
|
index: 1,
|
|
@@ -94,8 +93,7 @@ const resolveFlatConfig = async (root, options = {}) => {
|
|
|
94
93
|
name: "eslint/defaults/files-cjs"
|
|
95
94
|
});
|
|
96
95
|
const rulesMap = /* @__PURE__ */ new Map();
|
|
97
|
-
const
|
|
98
|
-
const eslintRules = await import(eslintPath).then((r) => r.default.builtinRules);
|
|
96
|
+
const eslintRules = await import(await resolve("eslint/use-at-your-own-risk", { url: basePath }).catch(() => null) ?? "eslint/use-at-your-own-risk").then((r) => r.default.builtinRules);
|
|
99
97
|
for (const [name, rule] of eslintRules.entries()) rulesMap.set(name, {
|
|
100
98
|
...rule.meta,
|
|
101
99
|
messages: void 0,
|
|
@@ -111,32 +109,30 @@ const resolveFlatConfig = async (root, options = {}) => {
|
|
|
111
109
|
schema: void 0
|
|
112
110
|
});
|
|
113
111
|
const rules = Object.fromEntries(rulesMap.entries());
|
|
114
|
-
const configs = rawConfigs.map((c, index) => {
|
|
115
|
-
return {
|
|
116
|
-
...c,
|
|
117
|
-
index,
|
|
118
|
-
languageOptions: c.languageOptions ? {
|
|
119
|
-
...c.languageOptions,
|
|
120
|
-
parser: c.languageOptions.parser?.meta?.name
|
|
121
|
-
} : void 0,
|
|
122
|
-
plugins: c.plugins ? Object.fromEntries(Object.entries(c.plugins ?? {}).map(([prefix]) => [prefix, {}]).filter((index_) => index_[0])) : void 0,
|
|
123
|
-
processor: c.processor?.meta?.name
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
const payload = {
|
|
127
|
-
configs,
|
|
128
|
-
files: null,
|
|
129
|
-
meta: {
|
|
130
|
-
basePath,
|
|
131
|
-
configPath: fullPath,
|
|
132
|
-
lastUpdate: Date.now()
|
|
133
|
-
},
|
|
134
|
-
rules
|
|
135
|
-
};
|
|
136
112
|
return {
|
|
137
113
|
configs: rawConfigs,
|
|
138
114
|
dependencies,
|
|
139
|
-
payload
|
|
115
|
+
payload: {
|
|
116
|
+
configs: rawConfigs.map((c, index) => {
|
|
117
|
+
return {
|
|
118
|
+
...c,
|
|
119
|
+
index,
|
|
120
|
+
languageOptions: c.languageOptions ? {
|
|
121
|
+
...c.languageOptions,
|
|
122
|
+
parser: c.languageOptions.parser?.meta?.name
|
|
123
|
+
} : void 0,
|
|
124
|
+
plugins: c.plugins ? Object.fromEntries(Object.entries(c.plugins ?? {}).map(([prefix]) => [prefix, {}]).filter((index_) => index_[0])) : void 0,
|
|
125
|
+
processor: c.processor?.meta?.name
|
|
126
|
+
};
|
|
127
|
+
}),
|
|
128
|
+
files: null,
|
|
129
|
+
meta: {
|
|
130
|
+
basePath,
|
|
131
|
+
configPath: fullPath,
|
|
132
|
+
lastUpdate: Date.now()
|
|
133
|
+
},
|
|
134
|
+
rules
|
|
135
|
+
}
|
|
140
136
|
};
|
|
141
137
|
};
|
|
142
138
|
export { resolveFlatConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sushichan044/eslint-config-array-resolver",
|
|
3
3
|
"description": "Resolves flat config module. For internal use only.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": {
|
|
@@ -18,46 +18,45 @@
|
|
|
18
18
|
"registry": "https://registry.npmjs.org/",
|
|
19
19
|
"provenance": true
|
|
20
20
|
},
|
|
21
|
-
"main": "dist/index.js",
|
|
22
|
-
"module": "dist/index.js",
|
|
23
|
-
"types": "dist/index.d.ts",
|
|
24
21
|
"files": [
|
|
25
22
|
"dist"
|
|
26
23
|
],
|
|
27
24
|
"exports": {
|
|
28
25
|
".": {
|
|
29
|
-
"types": "./dist/index.d.
|
|
30
|
-
"import": "./dist/index.
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
31
28
|
}
|
|
32
29
|
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"eslint": "^9.0.0"
|
|
32
|
+
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@arethetypeswrong/
|
|
35
|
-
"@biomejs/biome": "2.3.
|
|
36
|
-
"@types/node": "24.
|
|
37
|
-
"@virtual-live-lab/eslint-config": "2.3.1",
|
|
38
|
-
"@virtual-live-lab/tsconfig": "2.1.21",
|
|
39
|
-
"eslint": "9.39.
|
|
40
|
-
"fs-fixture": "2.
|
|
41
|
-
"publint": "0.3.
|
|
42
|
-
"tsdown": "0.
|
|
43
|
-
"typescript": "5.9.3",
|
|
44
|
-
"typescript-eslint": "8.
|
|
45
|
-
"unplugin-unused": "0.5.
|
|
46
|
-
"vitest": "4.0.
|
|
34
|
+
"@arethetypeswrong/core": "^0.18.2",
|
|
35
|
+
"@biomejs/biome": "^2.3.13",
|
|
36
|
+
"@types/node": "^24.10.0",
|
|
37
|
+
"@virtual-live-lab/eslint-config": "^2.3.1",
|
|
38
|
+
"@virtual-live-lab/tsconfig": "^2.1.21",
|
|
39
|
+
"eslint": "^9.39.2",
|
|
40
|
+
"fs-fixture": "^2.11.0",
|
|
41
|
+
"publint": "^0.3.17",
|
|
42
|
+
"tsdown": "^0.20.1",
|
|
43
|
+
"typescript": "^5.9.3",
|
|
44
|
+
"typescript-eslint": "^8.54.0",
|
|
45
|
+
"unplugin-unused": "^0.5.7",
|
|
46
|
+
"vitest": "^4.0.18"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@typescript-eslint/utils": "^8.
|
|
49
|
+
"@typescript-eslint/utils": "^8.54.0",
|
|
50
50
|
"empathic": "^2.0.0",
|
|
51
|
-
"mlly": "^1.
|
|
51
|
+
"mlly": "^1.8.0",
|
|
52
52
|
"pathe": "^2.0.3",
|
|
53
|
-
"unrun": "^0.2.
|
|
53
|
+
"unrun": "^0.2.26"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"lint": "eslint --max-warnings 0 --fix .",
|
|
57
57
|
"format": "biome format --write .",
|
|
58
58
|
"typecheck": "tsc --noEmit",
|
|
59
59
|
"test": "vitest --run",
|
|
60
|
-
"build": "tsdown"
|
|
61
|
-
"build:check": "pnpm run build && pnpm pack && attw"
|
|
60
|
+
"build": "tsdown"
|
|
62
61
|
}
|
|
63
62
|
}
|