diff --git a/lib/cli-engine/config-array-factory.js b/lib/cli-engine/config-array-factory.js index 39f62bb6da1..6d0992151ad 100644 --- a/lib/cli-engine/config-array-factory.js +++ b/lib/cli-engine/config-array-factory.js @@ -722,12 +722,7 @@ class ConfigArrayFactory { * * Refer https://github.com/eslint/eslint/issues/12592 */ - const clonedRulesConfig = rules && JSON.parse( - JSON.stringify( - rules, - (key, value) => (value === Infinity ? Number.MAX_SAFE_INTEGER : value) - ) - ); + const clonedRulesConfig = rules && JSON.parse(JSON.stringify((rules))); // Flatten `extends`. for (const extendName of extendList.filter(Boolean)) { diff --git a/tests/fixtures/config-file/cloned-config/configWithInfinity.js b/tests/fixtures/config-file/cloned-config/configWithInfinity.js deleted file mode 100644 index 73e3c93c085..00000000000 --- a/tests/fixtures/config-file/cloned-config/configWithInfinity.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - - rules: { - "max-len": [ "error", { code: Infinity }] - } -}; diff --git a/tests/lib/cli.js b/tests/lib/cli.js index 2f84900eefb..afb225f1f7c 100644 --- a/tests/lib/cli.js +++ b/tests/lib/cli.js @@ -1172,7 +1172,9 @@ describe("cli", () => { assert.strictEqual(exit, 0); }); + }); + describe("config file and input file", () => { it("should exit with 1 as camelcase has wrong property type", async () => { const configPath = getFixturePath("config-file", "cloned-config", "eslintConfigFail.js"); const filePath = getFixturePath("config-file", "cloned-config", "index.js"); @@ -1185,16 +1187,6 @@ describe("cli", () => { } }); - - it("should not cause an error when a rule configuration has `Infinity`", async () => { - const configPath = getFixturePath("config-file", "cloned-config", "configWithInfinity.js"); - const filePath = getFixturePath("config-file", "cloned-config", "index.js"); - const args = `--config ${configPath} ${filePath}`; - - const exit = await cli.execute(args); - - assert.strictEqual(exit, 0); - }); }); describe("inline config and input file", () => {