Skip to content

fix: find comments after a backtick in a JS regex literal - #133

Merged
BartWaardenburg merged 1 commit into
mainfrom
fix/comment-check-regex-backtick
Nov 5, 2026
Merged

BartWaardenburg merged 1 commit into
mainfrom
fix/comment-check-regex-backtick

Conversation

@BartWaardenburg

Copy link
Copy Markdown
Contributor

What

Copy the fixed scripts/check-comment-quality.mjs and its tests from fallow-rs/fallow (fallow-rs/fallow#4230).

Why

The check treated every backtick in a JavaScript file as the start of a template literal. A backtick inside a regex literal, a quoted string, or a comment opened a template that never closed. The check then skipped every comment after that line, so a history comment passed. The check failed open, so it never blocked a valid comment.

Test plan

  • node --test scripts/check-comment-quality.test.mjs
  • node scripts/check-comment-quality.mjs --all
  • The copy is the fallow-rs/fallow source plus the "Copied from" header line.

Copy the fixed scripts/check-comment-quality.mjs and its tests from
fallow-rs/fallow (fallow-rs/fallow#4230).

The check treated every backtick in a JavaScript file as the start of a
template literal. A backtick inside a regex literal, a quoted string, or
a comment opened a template that never closed, and the check skipped
every comment after that line. The opener scan now skips these
constructs.

Signed-off-by: Bart Waardenburg <bart@waardenburg.dev>
@BartWaardenburg
BartWaardenburg merged commit 2b94c6d into main Nov 5, 2026
23 checks passed
@BartWaardenburg
BartWaardenburg deleted the fix/comment-check-regex-backtick branch November 5, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant