Skip to content

fix(title-require): allow comments inside non-empty <title> - #1938

Merged
coliff merged 2 commits into
mainfrom
fix/title-require-comments
Sep 23, 2026
Merged

coliff merged 2 commits into
mainfrom
fix/title-require-comments

Conversation

@coliff

@coliff coliff commented Sep 23, 2026 •

Copy link
Copy Markdown
Member
  • Check all text nodes inside <title> instead of only the last event, so titles mixing text with comments (e.g. Apache SSI directives) are not reported as empty
  • Remove the @ts-expect-error workaround for event.lastEvent
  • Add tests for comment-only and text-with-comment titles
  • Update rule docs with comment examples

Fixes #1916

- Check all text nodes inside <title> instead of only the last event, so
  titles mixing text with comments (e.g. Apache SSI directives) are not
  reported as empty
- Remove the @ts-expect-error workaround for event.lastEvent
- Add tests for comment-only and text-with-comment titles
- Update rule docs with comment examples

Fixes #1916

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 23, 2026 00:12
@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: a4b1862
Status: ✅  Deploy successful!
Preview URL: https://56ae7b5f.htmlhint.pages.dev
Branch Preview URL: https://fix-title-require-comments.htmlhint.pages.dev

View logs

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

🟢 Approval recommended

All reviewed changes are covered and no unresolved issues remain.

Review effort: Lite
Findings: None

What changed in this PR

Updates title-require to correctly recognize text inside <title> elements containing comments, preventing false positives.

Changes:

  • Tracks all text nodes within <title>.
  • Adds regression tests for comment-related cases.
  • Updates documentation and generated output.
File Description
website/​src/​content/​docs/​rules/​title-require.mdx Documents comment examples.
test/​rules/​title-require.spec.js Adds regression tests.
src/​core/​rules/​title-require.ts Implements text-node tracking.
dist/​core/​rules/​title-require.js Updates compiled rule output.

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

@coliff
coliff merged commit 8046f75 into main Sep 23, 2026
19 of 21 checks passed
@coliff
coliff deleted the fix/title-require-comments branch September 23, 2026 00:17
coliff added a commit that referenced this pull request Sep 25, 2026
- Rename 2.0.0-beta-1 entry to 2.0.0 dated 2026-09-27
- Note Node.js 22 requirement (#1944)
- Add rule fixes from #1864, #1937 and #1938
- Add docs, CI and website updates since the beta draft
- Update homepage banner to v2.0.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

False title-require error

2 participants