From 36ee8abf2ffa32ed70763bf8079af9dfb51ae9af Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Sun, 25 Oct 2020 23:48:42 -0400 Subject: [PATCH 1/2] 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. --- tests/lib/eslint/eslint.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/lib/eslint/eslint.js b/tests/lib/eslint/eslint.js index f9ec1e7c57d..e4f37f404c4 100644 --- a/tests/lib/eslint/eslint.js +++ b/tests/lib/eslint/eslint.js @@ -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", () => { From 27fd9dfc04f60cdbed4bf3b094af2a630bd4b456 Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Mon, 26 Oct 2020 23:13:55 -0400 Subject: [PATCH 2/2] Upgrade: @eslint/eslintrc for rule validation (fixes #13793) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46ebf59f948..9f93300fec2 100644 --- a/package.json +++ b/package.json @@ -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",