Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: --init autoconfig shouldn't add deprecated rules (fixes #14017) #14060

Merged
merged 1 commit into from Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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