Skip to content

Commit d92b2d6

Browse files
committed
fix(scripts): refactor regex loop to avoid assignment in expression
Refactored while loop in validate-no-cdn-refs.mjs to avoid assignment in expression, which was flagged by biome's noAssignInExpressions rule. The logic remains identical but now separates the assignment from the conditional check.
1 parent 96d0dd9 commit d92b2d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/validate-no-cdn-refs.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ async function checkFile(filePath) {
151151
// Reset regex state
152152
pattern.lastIndex = 0
153153

154-
let match
155-
while ((match = pattern.exec(content)) !== null) {
154+
let match = pattern.exec(content)
155+
while (match !== null) {
156156
// Get line number
157157
const beforeMatch = content.substring(0, match.index)
158158
const lineNumber = beforeMatch.split('\n').length
@@ -168,6 +168,8 @@ async function checkFile(filePath) {
168168
line: line.trim(),
169169
url: match[0],
170170
})
171+
172+
match = pattern.exec(content)
171173
}
172174
}
173175

0 commit comments

Comments
 (0)