htmlhint / htmlhint/HTMLHint

Rule request: Disallow protocolless URLS

Open
#348 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request help wanted keep-unstale PR needed
Dominant language
JavaScript
Stars
3.3k
Forks
474
Avg merge
1d 11h
Merged PRs (30d)
12

Description

URLs without specifying the protocol are regarded as an anti-pattern and advised against in the Google HTML Style Guide: https://google.github.io/styleguide/htmlcssguide.html#Protocol

I'd like to request an option in HTMLHint to disallow protocolless URLs, so that I get a warning if I add for example any of these:

<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.8.2/css/all.css">

Webhint has this rule:
https://webhint.io/docs/user-guide/hints/hint-no-protocol-relative-urls/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by reviewing HTMLHint's existing rule and option conventions, then use the protocol-relative URL examples in the issue to define the cases covered; done means HTMLHint warns when such URLs are encountered.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.