Skip to content

Commit c964275

Browse files
committed
fix: Dispatch on eslint 8 differences
1 parent f95ef60 commit c964275

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/lib/rule-finder.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ function _getConfigFile(specifiedFile) {
1919
}
2020

2121
function _getConfigs(configFile, files) {
22-
const cliEngine = new eslint.CLIEngine({
23-
// Ignore any config applicable depending on the location on the filesystem
24-
useEslintrc: false,
25-
// Point to the particular config
26-
configFile
27-
});
22+
const cliEngine = eslint.ESLint
23+
? new eslint.ESLint({
24+
// Ignore any config applicable depending on the location on the filesystem
25+
useEslintrc: false,
26+
// Point to the particular config
27+
overrideConfigFile: configFile
28+
})
29+
: new eslint.CLIEngine({
30+
// Ignore any config applicable depending on the location on the filesystem
31+
useEslintrc: false,
32+
// Point to the particular config
33+
configFile
34+
});
35+
2836
return new Set(files
2937
.map(filePath => cliEngine.isPathIgnored(filePath) ? false : cliEngine.getConfigForFile(filePath))
3038
.filter(Boolean));
@@ -67,7 +75,7 @@ function _getPluginRules(config) {
6775
}
6876

6977
function _getCoreRules() {
70-
return eslint.linter.getRules();
78+
return (eslint.Linter ? new eslint.Linter() : eslint.linter).getRules();
7179
}
7280

7381
function _filterRuleNames(ruleNames, rules, predicate) {

0 commit comments

Comments
 (0)