@sushichan044/eslint-config-array-resolver 0.0.2 → 0.1.1
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 +8 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,16 @@ interface ESLintConfig {
|
|
|
8
8
|
dependencies: string[];
|
|
9
9
|
payload: Payload;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Traverse and find the ESLint config file.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
|
|
11
17
|
interface ReadFlatConfigOptions {
|
|
12
18
|
suppressOutput?: boolean;
|
|
13
19
|
}
|
|
14
|
-
declare const
|
|
20
|
+
declare const resolveFlatConfig: (root: string, options?: ReadFlatConfigOptions) => Promise<ESLintConfig>;
|
|
15
21
|
interface FlatConfigItem extends Linter.Config {
|
|
16
22
|
index: number;
|
|
17
23
|
}
|
|
@@ -36,4 +42,4 @@ interface RuleInfo extends RuleMetaData<string, unknown> {
|
|
|
36
42
|
plugin: string;
|
|
37
43
|
}
|
|
38
44
|
//#endregion
|
|
39
|
-
export { type ESLintConfig, type RuleInfo,
|
|
45
|
+
export { type ESLintConfig, type RuleInfo, resolveFlatConfig };
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ const executeWithSilentLogs = async (function_) => {
|
|
|
45
45
|
if (res.err) throw res.err;
|
|
46
46
|
return res.data;
|
|
47
47
|
};
|
|
48
|
-
const
|
|
48
|
+
const findConfigPath = (root) => {
|
|
49
49
|
const configPath = any([
|
|
50
50
|
"eslint.config.js",
|
|
51
51
|
"eslint.config.mjs",
|
|
@@ -60,9 +60,9 @@ const resolveConfigPath = (root) => {
|
|
|
60
60
|
fullPath: configPath
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
const
|
|
63
|
+
const resolveFlatConfig = async (root, options = {}) => {
|
|
64
64
|
const { suppressOutput = false } = options;
|
|
65
|
-
const { basePath, fullPath } =
|
|
65
|
+
const { basePath, fullPath } = findConfigPath(root);
|
|
66
66
|
const moduleImportPromise = runInDirectory(basePath, async () => {
|
|
67
67
|
return bundleRequire({
|
|
68
68
|
cwd: basePath,
|
|
@@ -142,4 +142,4 @@ const readFlatConfig = async (root, options = {}) => {
|
|
|
142
142
|
payload
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
|
-
export {
|
|
145
|
+
export { resolveFlatConfig };
|