Skip to content

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

Open
coliff wants to merge 3 commits into
mainfrom
fix/rule-state-leaks-and-validation
Open

coliff wants to merge 3 commits 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

- 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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FN9Si1bR6igGbuoJ7ZGJWb
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: 593f1d6
Status: ✅  Deploy successful!
Preview URL: https://0b7290a4.htmlhint.pages.dev
Branch Preview URL: https://fix-rule-state-leaks-and-val.htmlhint.pages.dev

View logs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FN9Si1bR6igGbuoJ7ZGJWb

This branch has not been deployed

No deployments
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