Skip to content

Commit e0e6067

Browse files
author
Martin D'Aloia
committed
Adapt 'enabled' to 'disabled' and emit a deprecation warning
In order to avoid the 'enabled' property we adapt it to 'disabled' (only if 'disabled' is not already defined). Also, it emits a warning in the console about this deprecated property and its replacement.
1 parent 11c355e commit e0e6067

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/rules.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ const createNewRules = (rules, rulesetDocumentationUrl) => {
1414
};
1515

1616
const createNewRule = (rule, rulesetDocumentationUrl) => {
17-
if (rule.disabled === true) {
18-
delete activeRules[rule.name];
19-
return;
20-
}
2117
// @DEPRECATED in v0.9.0, use `disabled: true`
22-
if (rule.enabled === false) {
18+
if (rule.enabled !== undefined) {
19+
console.warn("WARNING: Property 'enabled' is deprecated and will be removed in 1.0.0. Use 'disabled' instead. Found in rule: " + rule.name)
20+
}
21+
if (rule.enabled === false && rule.disabled === undefined) {
22+
rule.disabled = true;
23+
}
24+
25+
if (rule.disabled === true) {
2326
delete activeRules[rule.name];
2427
return;
2528
}

0 commit comments

Comments
 (0)