Skip to content

feat: add attr-no-protocol-relative-url rule - #1969

Open
jrTilak wants to merge 1 commit into
htmlhint:mainfrom
jrTilak:feat/attr-no-protocol-relative-url
Open

jrTilak wants to merge 1 commit into
htmlhint:mainfrom
jrTilak:feat/attr-no-protocol-relative-url

Conversation

@jrTilak

@jrTilak jrTilak commented Nov 17, 2026

Copy link
Copy Markdown

Short description of what this resolves

Adds attr-no-protocol-relative-url to warn on URLs like //cdn.example.com/app.js in src and href.

Fixes #348.

Proposed changes

  • Register the optional rule and keep it disabled by default
  • Handle leading whitespace and mixed case attribute names
  • Add regression tests and brief docs with a New sidebar badge

To check it locally:

npm run build
printf '%s\n' '<script src="//cdn.example.com/app.js"></script>' | node bin/htmlhint --rules attr-no-protocol-relative-url stdin

This reports one diagnostic for the protocol-relative URL.

Core and website builds pass. Lint, spelling and Markdown checks pass. All 433 tests pass, including 51 for this rule.

- warn on protocol-relative URLs in src and href
- register the optional rule and configuration type
- add regression tests and rule documentation
- update the tracked build output

Fixes htmlhint#348
@jrTilak
jrTilak requested a review from coliff as a code owner November 17, 2026 17:49
Copilot AI balanced review requested due to automatic review settings November 17, 2026 17: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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

🟡 Changes recommended

The generated bundle references a missing rule module, causing package loading and tests to fail, and the new documentation page is missing the required hidden-sidebar frontmatter.

1 open issue

Review effort: Lite

Comment on lines +6 to +7
sidebar:
badge: New

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.

Rule request: Disallow protocolless URLS

2 participants