lint: flatten rule resolver to logic
This commit is contained in:
parent
b3fa9dd9be
commit
1b15952c05
|
@ -176,31 +176,15 @@ export async function resolveRules(rules: Array<Rule>, selector: RuleSelector):
|
||||||
for (const r of rules) {
|
for (const r of rules) {
|
||||||
let active = false;
|
let active = false;
|
||||||
|
|
||||||
if (selector.includeLevel.includes(r.level)) {
|
active = active || selector.includeLevel.includes(r.level);
|
||||||
active = true;
|
active = active || selector.includeName.includes(r.name);
|
||||||
}
|
|
||||||
|
|
||||||
if (selector.includeName.includes(r.name)) {
|
|
||||||
active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const includedTags = intersection(selector.includeTag, r.tags);
|
const includedTags = intersection(selector.includeTag, r.tags);
|
||||||
if (includedTags.length > 0) {
|
active = active || includedTags.length > 0;
|
||||||
active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selector.excludeLevel.includes(r.level)) {
|
|
||||||
active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selector.excludeName.includes(r.name)) {
|
|
||||||
active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
active = active && (!selector.excludeLevel.includes(r.level));
|
||||||
|
active = active && (!selector.excludeName.includes(r.name));
|
||||||
const excludedTags = intersection(selector.excludeTag, r.tags);
|
const excludedTags = intersection(selector.excludeTag, r.tags);
|
||||||
if (excludedTags.length > 0) {
|
active = active && (excludedTags.length === 0);
|
||||||
active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
activeRules.add(r);
|
activeRules.add(r);
|
||||||
|
|
Loading…
Reference in New Issue