Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: --init autoconfig shouldn't add deprecated rules (fixes #14017) (
  • Loading branch information
mdjermanovic committed Feb 10, 2021
1 parent 9b277a1 commit d6c84af
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/init/autoconfig.js
Expand Up @@ -85,7 +85,7 @@ class Registry {
* @returns {void}
*/
populateFromCoreRules() {
const rulesConfig = configRule.createCoreRuleConfigs();
const rulesConfig = configRule.createCoreRuleConfigs(/* noDeprecated = */ true);

this.rules = makeRegistryItems(rulesConfig);
}
Expand Down
14 changes: 14 additions & 0 deletions tests/lib/init/autoconfig.js
Expand Up @@ -132,6 +132,20 @@ describe("autoconfig", () => {
assert.include(Object.keys(registry.rules), "eqeqeq");
});

it("should not add deprecated rules", () => {
const registry = new autoconfig.Registry();

registry.populateFromCoreRules();

const { rules } = registry;

assert.notProperty(rules, "id-blacklist");
assert.notProperty(rules, "no-negated-in-lhs");
assert.notProperty(rules, "no-process-exit");
assert.notProperty(rules, "no-spaced-func");
assert.notProperty(rules, "prefer-reflect");
});

it("should not add duplicate rules", () => {
const registry = new autoconfig.Registry(rulesConfig);

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/init/config-initializer.js
Expand Up @@ -409,6 +409,14 @@ describe("configInitializer", () => {
assert.notProperty(config.rules, "no-debugger");
});

it("should not include deprecated rules", () => {
assert.notProperty(config.rules, "id-blacklist");
assert.notProperty(config.rules, "no-negated-in-lhs");
assert.notProperty(config.rules, "no-process-exit");
assert.notProperty(config.rules, "no-spaced-func");
assert.notProperty(config.rules, "prefer-reflect");
});

it("should support new ES features if using later ES version", () => {
const filename = getFixturePath("new-es-features");

Expand Down

0 comments on commit d6c84af

Please sign in to comment.