Fix linter: global state left on the regex causes problems
This commit is contained in:
parent
ceaf7863e1
commit
7ee6584d8b
2 changed files with 368 additions and 0 deletions
|
@ -338,9 +338,14 @@ forEach(allSourceFiles, file => {
|
|||
|
||||
forEach(lines, (rawLine, lineIndex) => {
|
||||
const line = rawLine.replace(/\r/g, '');
|
||||
|
||||
if (!rule.regex.test(line)) {
|
||||
return;
|
||||
}
|
||||
// recreate this rule since it has g flag, and carries local state
|
||||
if (rule.expression) {
|
||||
rule.regex = new RegExp(rule.expression, 'g');
|
||||
}
|
||||
|
||||
const path = relativePath;
|
||||
const lineNumber = lineIndex + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue