Skip to content

Commit 3ee1b89

Browse files
committed
fix: scan content after block comment close on same line
When */ appeared mid-line, the continue statement skipped the entire line including any real code after the comment close. Now extracts and scans the post-close portion of the line.
1 parent dbdeefd commit 3ee1b89

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

scripts/verify-imports.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,15 @@ function extractDynamicImports(filePath) {
6767
const line = lines[i];
6868

6969
// Track block comments (/** ... */ and /* ... */)
70+
let scanLine = line;
7071
if (inBlockComment) {
71-
if (line.includes('*/')) inBlockComment = false;
72-
continue;
72+
const closeIdx = scanLine.indexOf('*/');
73+
if (closeIdx === -1) continue; // still fully inside a block comment
74+
inBlockComment = false;
75+
scanLine = scanLine.slice(closeIdx + 2); // scan content after */
7376
}
7477
// Skip single-line comments
75-
if (/^\s*\/\//.test(line)) continue;
76-
77-
// Strip block comments from the line before scanning for imports.
78-
// Handles: mid-line /* ... */ (single-line) and opening /* without close.
79-
let scanLine = line;
78+
if (/^\s*\/\//.test(scanLine)) continue;
8079
if (scanLine.includes('/*')) {
8180
// Remove fully closed inline block comments: code /* ... */ more code
8281
scanLine = scanLine.replace(/\/\*.*?\*\//g, '');

0 commit comments

Comments
 (0)