Skip to content

Commit

Permalink
Merge pull request #19 from SMJSGaming/conditional-load
Browse files Browse the repository at this point in the history
Fixed comments triggering the linter
  • Loading branch information
dankmeme01 authored Oct 6, 2024
2 parents 8f831bf + bf2528b commit 5a0792d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/project/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ function lint(
) {
const ignoreRanges: { from: number, to: number }[] = [];

for (const match of document.data.matchAll(new RegExp(`(?:\\/\\/\\s*@geode-begin-ignore\\(${code}\\).*?$)(?:(?!\\/\\/\\s*@geode-end-ignore\\(${code}\\))(?:\\s|.))*`, "gm"))) {
for (const match of document.data.matchAll(
new RegExp(`(?:\\/\\/\\s*@geode-begin-ignore\\(${code}\\).*?$)(?:(?!\\/\\/\\s*@geode-end-ignore\\(${code}\\))(?:\\s|.))*|\\/\\*(?:(?!\\*\\/)(?:\\s|.))*`, "gm")
)) {
if (match.index != undefined) {
ignoreRanges.push({ from: match.index, to: match.index + match[0].length });
}
}

// Look for matches for the regex
for (const match of document.data.matchAll(new RegExp(
`(?<ignore>\\/\\/\\s*@geode-ignore\\(${code}\\).*?$\\r?\\s+^.*?)?${regex.source}`,
`(?<ignore>\\/\\/\\s*@geode-ignore\\(${code}\\).*?$\\r?\\n^.*?|\\/\\/.*?)?${regex.source}`,
regex.flags.includes("m") ? regex.flags : regex.flags + "m"
))) {
if (match.index == undefined || match.groups?.ignore || ignoreRanges.some(range => range.from <= match.index! && range.to >= match.index!)) {
Expand Down

0 comments on commit 5a0792d

Please sign in to comment.