Skip to content

Commit

Permalink
refactor: Optimize matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Sep 17, 2024
1 parent 851ab79 commit 97cafaa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,10 @@ function isFileIncluded(file: string, patterns: Minimatch[]) {
let include = true;

for (const pattern of patterns) {
if (pattern.negate) {
if (pattern.match(file)) {
include = true; // re-include it
}
} else {
if (pattern.match(file)) { // Handle inclusion: exclude if it matches
include = false;
}
if (pattern.negate && pattern.match(file)) {
include = true; // re-include it
} else if (pattern.match(file)) { // Handle inclusion: exclude if it matches
include = false;
}
}

Expand Down

0 comments on commit 97cafaa

Please sign in to comment.