Skip to content

Commit

Permalink
Upgrade: @eslint/eslintrc to fix rule schema validation (fixes #13793) (
Browse files Browse the repository at this point in the history
#13794)

* Chore: Repro missing built-in rule validation (refs #13793)

The bulk of our tests for rule schemas are isolated unit tests of
`ConfigValidator`. This is a single test to be sure we actually run rule
schema validation end-to-end and prevent cases like #13793.

After I run a patch release of `@eslint/eslintrc`, I'll push a second
commit on this branch to bump the dependency version and fix the test.

* Upgrade: @eslint/eslintrc for rule validation (fixes #13793)
  • Loading branch information
btmills committed Oct 27, 2020
1 parent aeef485 commit 08f33e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -47,7 +47,7 @@
"bugs": "https://github.com/eslint/eslint/issues/",
"dependencies": {
"@babel/code-frame": "^7.0.0",
"@eslint/eslintrc": "^0.2.0",
"@eslint/eslintrc": "^0.2.1",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
Expand Down
20 changes: 20 additions & 0 deletions tests/lib/eslint/eslint.js
Expand Up @@ -3919,6 +3919,26 @@ describe("ESLint", () => {

await assert.rejects(() => eslint.calculateConfigForFile(null), /'filePath' must be a non-empty string/u);
});

// https://github.com/eslint/eslint/issues/13793
it("should throw with an invalid built-in rule config", async () => {
const options = {
baseConfig: {
rules: {
"no-alert": ["error", {
thisDoesNotExist: true
}]
}
}
};
const engine = new ESLint(options);
const filePath = getFixturePath("single-quoted.js");

await assert.rejects(
() => engine.calculateConfigForFile(filePath),
/Configuration for rule "no-alert" is invalid:/u
);
});
});

describe("isPathIgnored", () => {
Expand Down

0 comments on commit 08f33e8

Please sign in to comment.