Skip to content

fix: stop ruleset/config leaking between runs and fix rule checks - #1941

Merged
coliff merged 1 commit into
mainfrom
fix/rule-state-leaks-and-validation
Oct 9, 2026
Merged

coliff merged 1 commit into
mainfrom
fix/rule-state-leaks-and-validation

Conversation

@coliff

@coliff coliff commented Sep 23, 2026 •

Copy link
Copy Markdown
Member
  • core: copy the ruleset in verify() so inline rules
    don't mutate the caller's or the default ruleset
  • tags-check: don't persist custom config in module state across runs
  • doctype-html5: listen to comment events only, so the listener is
    actually removed after the first tag
  • html-lang-require: anchor the BCP47 pattern to the whole value
  • tag-pair: treat bgsound as a void element

Copilot AI lite review requested due to automatic review settings September 23, 2026 08:49

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

BCP47 validation still needs strict end-of-input handling.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR prevents ruleset/configuration leakage between runs and fixes several HTML rule checks.

Changes:

  • Isolates rulesets and tags-check configuration.
  • Corrects doctype handling, BCP47 validation, and bgsound pairing.
  • Adds regression tests.
File Description
test/​rules/​tags-check.spec.js Tests configuration isolation.
test/​rules/​tag-pair.spec.js Tests void bgsound handling.
test/​rules/​html-lang-require.spec.js Tests invalid language values.
test/​rules/​doctype-html5.spec.js Tests declaration handling.
test/​core.spec.js Tests ruleset isolation.
src/​core/​rules/​tags-check.ts Prevents custom configuration leakage.
src/​core/​rules/​tag-pair.ts Treats bgsound as void.
src/​core/​rules/​html-lang-require.ts Updates BCP47 validation.
src/​core/​rules/​doctype-html5.ts Corrects comment listener lifecycle.
src/​core/​core.ts Copies rulesets before inline-rule parsing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/core/rules/html-lang-require.ts
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Deploying htmlhint with  Cloudflare Pages  Cloudflare Pages

Latest commit: b6e5024
Status: ✅  Deploy successful!
Preview URL: https://1a390201.htmlhint.pages.dev
Branch Preview URL: https://fix-rule-state-leaks-and-val.htmlhint.pages.dev

View logs

@coliff
coliff force-pushed the fix/rule-state-leaks-and-validation branch 2 times, most recently from 365aa52 to 5828beb Compare October 9, 2026 05:54
- core: copy the ruleset in verify() so inline <!-- htmlhint --> rules
  don't mutate the caller's or the default ruleset
- tags-check: don't persist custom config in module state across runs
- doctype-html5: listen to comment events only, so the listener is
  actually removed after the first tag
- html-lang-require: anchor the BCP47 pattern to the whole value
- tag-pair: treat bgsound as a void element
- add regression tests and update dist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FN9Si1bR6igGbuoJ7ZGJWb
@coliff
coliff force-pushed the fix/rule-state-leaks-and-validation branch from 5828beb to b6e5024 Compare October 9, 2026 05:55
@coliff
coliff merged commit 01d7da3 into main Oct 9, 2026
19 checks passed
@coliff
coliff deleted the fix/rule-state-leaks-and-validation branch October 9, 2026 06:17
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.

3 participants