Skip to content

Commit

Permalink
bug(eslint šŸ›): change how the eslint config is loaded so that pluginsā€¦
Browse files Browse the repository at this point in the history
ā€¦ work (#1068)
  • Loading branch information
phenomnomnominal authored Jul 26, 2022
1 parent ac9f95e commit 8a4b32e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
},
"types": "test/betterer-public-api.d.ts",
"devDependencies": {
"@betterer/cli": "^5.0.0-alpha.0",
"@betterer/regexp": "^5.0.0-alpha.0",
"@betterer/cli": "^5.3.6",
"@betterer/regexp": "^5.3.6",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@microsoft/api-documenter": "^7.13.54",
Expand Down
11 changes: 9 additions & 2 deletions packages/eslint/src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ export function eslint(rules: BettererESLintRulesConfig): BettererFileTest {
filePaths.map(async (filePath) => {
const linterOptions = (await cli.calculateConfigForFile(filePath)) as Linter.Config;

// Explicitly disable all other configured rules:
const disabledRules: BettererESLintRulesConfig = {};
Object.keys(linterOptions.rules || {}).forEach((ruleName) => {
disabledRules[ruleName] = 'off';
});
const finalRules = { ...disabledRules, ...rules };

const runner = new ESLint({
baseConfig: { ...linterOptions, rules },
useEslintrc: false,
overrideConfig: { rules: finalRules },
useEslintrc: true,
cwd: baseDirectory
});

Expand Down

0 comments on commit 8a4b32e

Please sign in to comment.