Skip to content

fix(core): accept a11y/* rule ids in inline suppression directives - #499

Merged
oekazuma merged 2 commits into
mainfrom
fix/directive-a11y-rule-id
Aug 15, 2026
Merged

oekazuma merged 2 commits into
mainfrom
fix/directive-a11y-rule-id

Conversation

@oekazuma

@oekazuma oekazuma commented Aug 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

svelte-vitals-disable-next-line a11y/<rule> was silently ignored: the directive parser's rule-id pattern (RULE_ID_RE in packages/core/src/component-parse.ts) allowed only letters in the category segment, so the digit in a11y made the whole directive fail to match and the finding stayed. Every other category is all-letters, which is why this only surfaced with the a11y category.

Found by probing every disable/suppress surface (--ignore, --rules, --category, --fail-on/--min-health, config rules: 'off', severity override, route overrides, the suppressions file, and the inline directive) against the kitchen-sink example — the other eight all worked; this one didn't.

  • Category segment now allows digits ([a-z][a-z0-9]*); regression test for a lone and a comma-listed a11y/* directive.
  • New e2e suite examples/kitchen-sink/test/e2e-suppression.test.ts pins all nine surfaces against the real gallery (scratch copies, gallery untouched), so a surface that silently stops working fails in this repo's CI rather than a user's. Tamper-verified: with the fix reverted, exactly the inline-directive case fails (1/8), the other seven pass.
  • Changeset: @svelte-vitals/core patch.

Test plan

  • pnpm test green (core 1518 / cli 1212 / vite 250 / kitchen-sink 16), pnpm lint clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed inline suppression directives so they recognize accessibility and SEO rule IDs containing digits, including comma-separated rules.
  • Tests

    • Added end-to-end coverage for suppression, configuration overrides, rule filtering, exit codes, inline directives, and suppression-file generation.
    • Added targeted tests for numeric-containing rule categories.
  • Documentation

    • Updated the kitchen-sink example documentation to describe all three test suites and their coverage.

The directive parser's rule-id pattern allowed only letters in the category
segment, so every a11y/* directive was silently ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f84854a-5e17-4917-8a2c-a6312e53a93d

📥 Commits

Reviewing files that changed from the base of the PR and between 048478f and 2101119.

📒 Files selected for processing (5)
  • .changeset/directive-a11y-rule-ids.md
  • examples/kitchen-sink/README.md
  • examples/kitchen-sink/test/e2e-suppression.test.ts
  • packages/core/src/component-parse.ts
  • packages/core/test/component-parse.test.ts

📝 Walkthrough

Walkthrough

The PR updates directive parsing to accept rule IDs with digits in category names. It adds unit coverage and a kitchen-sink end-to-end suite for CLI, configuration, inline directive, and suppression-file behavior.

Changes

Directive suppression

Layer / File(s) Summary
Numeric rule-ID parsing
packages/core/src/component-parse.ts, packages/core/test/component-parse.test.ts, .changeset/directive-a11y-rule-ids.md
The parser accepts categories such as a11y and seo that contain digits. Tests cover single and comma-separated rule IDs. The changeset records the patch release.
Suppression end-to-end coverage
examples/kitchen-sink/test/e2e-suppression.test.ts, examples/kitchen-sink/README.md
The new suite tests CLI filters, exit-code thresholds, configuration overrides, inline directives, and suppression-file generation. The README documents the third test suite and its scratch-copy behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 21011

This narrowly fixes inline suppression of a11y rule IDs with regression coverage; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main parser fix for accepting a11y rule IDs in inline suppression directives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

--ignore, --rules, --category, --fail-on/--min-health, config rules 'off',
severity override, route overrides, the inline directive (including a11y/*
ids), and the suppressions file each run against a scratch copy of the
example; the inline-directive case fails without the RULE_ID_RE fix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@oekazuma

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@oekazuma
oekazuma merged commit 4cdce87 into main Aug 15, 2026
8 checks passed
@oekazuma
oekazuma deleted the fix/directive-a11y-rule-id branch August 15, 2026 14:57
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