Skip to content

Commit 0de60d5

Browse files
committed
fix: Add path to look up eslint configs
1 parent 0529acf commit 0de60d5

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/eslint-config-provider.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,20 @@ export class ESLintConfigProvider implements ConfigProvider {
7070
return this.factory.getConfigArrayForFile(fileName).extractConfig(fileName);
7171
}
7272

73-
private resolveESLintIntrinsicConfigPath(name: "eslint-all" | "eslint-recommended") {
74-
let ret: string | undefined = undefined;
73+
private resolveESLintIntrinsicConfigPath(name: "eslint-all" | "eslint-recommended"): string | undefined {
7574
try {
76-
const fragments = require.resolve("eslint").split("node_modules/eslint");
77-
ret = [...fragments.slice(0, fragments.length - 1), `/conf/${name}.js`].join("node_modules/eslint");
78-
} catch (e: any) {
79-
this.log(e);
75+
// Config js files move to @eslint/js package sinse ESLint v8.35.
76+
// https://github.com/eslint/eslint/pull/16844
77+
return require.resolve(`@eslint/js/src/configs/${name}`);
78+
} catch {
79+
try {
80+
// For legacy ESLint < v8.35
81+
const fragments = require.resolve("eslint").split("node_modules/eslint");
82+
return [...fragments.slice(0, fragments.length - 1), `/conf/${name}.js`].join("node_modules/eslint");
83+
} catch (e) {
84+
this.log(String(e));
85+
}
8086
}
81-
return ret;
87+
return undefined;
8288
}
8389
}

0 commit comments

Comments
 (0)