question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

doctype-first error

See original GitHub issue

Describe the bug I’m using htmlhint as a script in my package.json "lint:html": "htmlhint --config .htmlhintrc ./src/**/*.html"

my .htmlhintrc

{
  "doctype-first": false,
  "doctype-html5": false,
  "head-script-disabled": false
  "style-disabled": false,
  "title-require": false,
  "attr-lowercase": true,
  "attr-no-duplication": true,
  "attr-no-unnecessary-whitespace": true,
  "attr-unsafe-chars": true,
  "attr-value-double-quotes": true,
  "attr-value-not-empty": false,
  "alt-require": true,
  "tagname-lowercase": false,
  "input-requires-label": true,
  "tags-check": true.
  "tag-pair": true,
  "tag-self-close": true,
  "tagname-lowercase": true,
  "empty-tag-not-self-closed": true,
  "src-not-empty": true,
  "href-abs-or-rel": false,
  "id-class-ad-disabled": true,
  "id-class-value": true,
  "id-unique": true,
  "inline-script-disabled": true,
  "inline-style-disabled": true,
  "space-tab-mixed-disabled": "space",
  "spec-char-escape": false,
}

I’m creating components per html like <div class="my-component">...</div>

and I’m getting an error

 L1 |<div class="my-component"></div>
          ^ Doctype must be declared first. (doctype-first)

How could I disable this rule?, right now I have disabled this rule in my config "doctype-first": false,, but It is not desabled

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Shelagh-Lewinscommented, Apr 7, 2021

After more investigation I found that for some reason the .htmlhintrc file in my project root wasn’t being loaded, and manually specified it in my Sublime Linter settings:

"linters": {
    "htmlhint": {
        "args": ["--config", ".htmlhintrc"]
    },
},
1reaction
eoinkellycommented, Dec 18, 2020

Thare are some formatting errors in your JSON config file which are causing it to be silently ignored (errors annotated with comments below):

{
  "doctype-first": false,
  "doctype-html5": false,
  "head-script-disabled": false // missing comma
  "style-disabled": false,
  "title-require": false,
  "attr-lowercase": true,
  "attr-no-duplication": true,
  "attr-no-unnecessary-whitespace": true,
  "attr-unsafe-chars": true,
  "attr-value-double-quotes": true,
  "attr-value-not-empty": false,
  "alt-require": true,
  "tagname-lowercase": false,
  "input-requires-label": true,
  "tags-check": true. // period instead of comma
  "tag-pair": true,
  "tag-self-close": true,
  "tagname-lowercase": true,
  "empty-tag-not-self-closed": true,
  "src-not-empty": true,
  "href-abs-or-rel": false,
  "id-class-ad-disabled": true,
  "id-class-value": true,
  "id-unique": true,
  "inline-script-disabled": true,
  "inline-style-disabled": true,
  "space-tab-mixed-disabled": "space",
  "spec-char-escape": false, // trailing comma
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Meteor typescript complaining about missing doctype in vscode
here is an example with "doctype-first": false, , which would ignore the error you're receiving, if that's your goal.
Read more >
doctype-first - HTMLHint
doctype-first. Doctype must be first. Level: error. Config value​. true: enable rule; false: disable rule. The following pattern are not ...
Read more >
Need help in validation errors - HTMLHelp Forums
1.Non-space characters found without seeing a doctype first. Expected <!DOCTYPE html>. 2.Element head is missing a required instance of child ...
Read more >
Start tag seen without seeing doctype first - WordPress.org
Open SVG is Visual Studio Code; Copy code to Custom Animation. But this time I am getting the red-box-x with the error message:...
Read more >
Why am I seeing an "Invalid Doctype" error on my site? - Sumo
If prompted with the "Invalid DOCTYPE" error, it is likely that the DOCTYPE in your site is missing or out of date. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found