Skip to content

Commit

Permalink
Simplify conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Oct 10, 2018
1 parent 3ba32ce commit 53e45c9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ module.exports = {
for (const ruleToCheck of rulesToCheck) {
const { rule, instance } = ruleToCheck

if (
(rulesConfig && rulesConfig[rule] && module.exports.isRuleDisabledByDefault(rule)) || // If exist in the rules and exist in the disabled rules, ADD
(rulesConfig && rulesConfig[rule] && !module.exports.isRuleDisabledByDefault(rule)) || // If exist in the rules and not exist in the disabled rules, ADD
((!rulesConfig || !rulesConfig[rule]) && !module.exports.isRuleDisabledByDefault(rule)) // If not exist in the rules and not exist in the disabled rules, ADD
) {
const isConfigured = rulesConfig && rulesConfig[rule]
const isEnabledByDefault = !module.exports.isRuleDisabledByDefault(rule)

if (isConfigured || isEnabledByDefault) {
rulesArrayOfObjects.push(instance)
}
}
Expand Down

0 comments on commit 53e45c9

Please sign in to comment.