Skip to content

fix(linters): forbid inert counts in v8 coverage-ignore comments - #45287

Open
secustor wants to merge 1 commit into
renovatebot:mainfrom
secustor:fix/44728-v8-ignore-no-count
Open

fix(linters): forbid inert counts in v8 coverage-ignore comments#45287
secustor wants to merge 1 commit into
renovatebot:mainfrom
secustor:fix/44728-v8-ignore-no-count

Conversation

@secustor

Copy link
Copy Markdown
Member

Changes

Adds a new custom oxlint rule renovate/v8-ignore-no-count that forbids the count form of coverage-ignore comments, e.g. /* v8 ignore next 4 -- foo */.

The count is not honored by the coverage provider: vitest's ast-v8-to-istanbul hint parser captures only the keyword (if/else/next/file), so next always exempts exactly the next AST node, however many lines it spans. A trailing count therefore suggests a line range that is never applied and misleads readers about what is actually exempted.

Details:

  • New rule tools/lint/rules/v8-ignore-no-count.js, enabled as error in .oxlintrc.json. It is autofixable: the fixer drops the count (e.g. next 4next), which preserves the actual keyword-only behavior, so coverage results are unchanged.
  • The autofix was applied to all 78 existing occurrences across lib/ and tools/.
  • Updated the note in v8-ignore-reason.js that previously documented counts as "allowed inert noise" to point to the new companion rule.
  • Added a bullet to docs/development/best-practices.md advising against counts.

Context

Please select one of the following:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

The rule implementation, config wiring, and docs update were written by Claude Code (model: Claude Fable 5), which also ran the autofix over the existing occurrences. Verified via pnpm oxlint, pnpm type-check, pnpm biome, pnpm prettier, and targeted vitest runs.

Use of AI in replying to PR comments

Who answers review comments:

  • @secustor will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted. Name the account.
  • Nobody has explicitly committed to replying.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

Adds a custom oxlint rule renovate/v8-ignore-no-count that flags the
count form '/* v8 ignore next <N> */'. The count is not honored by
vitest's ast-v8-to-istanbul hint parser, which captures only the
keyword (if/else/next/file); 'next' always exempts exactly the next
AST node. Trailing counts therefore suggest a line range that is never
applied and mislead readers.

The rule is autofixable (drops the count, preserving actual behavior)
and has been applied to all existing occurrences.
@secustor
secustor marked this pull request as ready for review August 14, 2026 20:27
@github-actions
github-actions Bot requested a review from viceice August 14, 2026 20:27

@jamietanna jamietanna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicted otherwise LGTM

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.

Add linting support which prevents next N in v8 code coverage comments

2 participants