Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

HTMLHint options #5

Open
thorade opened this issue Feb 10, 2015 · 11 comments
Open

HTMLHint options #5

thorade opened this issue Feb 10, 2015 · 11 comments

Comments

@thorade
Copy link

thorade commented Feb 10, 2015

On http://htmlhint.com/ you can chose from a lot of options for linting, could these be added to the Package Settings? For example a checkbox if I want to check for tag-self-close also? Currently I can only configure the path to the executable.

@smeijer
Copy link

smeijer commented Feb 10, 2015

Options would be very usefull indeed.

I'm using the htmlhinter for my html files, but actually each .html file only contains a <template>..</template> element. So currently, htmlhint is bugging me with a lot of "doctype must be first" errors.

Should be great if we could use something like a .htmlhint file, so the project settings can be shared trough the project code repository. (just like the .jshintrc file)

@smeijer
Copy link

smeijer commented Feb 10, 2015

Never mind my comment, just found out (by looking at the src) that a .htmlhintrc is actually supported.

@thorade, you can create a file named .htmlhintrc at the root of your project, with contents like:

{
  "tagname-lowercase": true,
  "attr-lowercase": true,
  "attr-value-double-quotes": true,
  "doctype-first": false,
  "tag-pair": true,
  "spec-char-escape": true,
  "id-unique": true,
  "src-not-empty": true,
  "attr-no-duplication": true
}

(restarting atom is required to make it work)

@thorade
Copy link
Author

thorade commented Feb 10, 2015

That is good to know, thanks for sharing!
Still I would be interested in the Settings->Options, because I frequently use Atom+Linter+htmlhint to inspect files that were autogenerated and are nor part of any project, they are just dumped into some temporary directory.
For now, I will just always use the same folder and have a .htmlhintrc file in there...

@thorade
Copy link
Author

thorade commented Mar 5, 2015

Two more comments:
I created a more complete .htmlhintrc file here:
https://gist.github.com/thorade/6988cc4b3df8f3f75f8f
When changing that file, you do not have to restart Atom,
disabling an then re-enabling the linter-htmlhint package is sufficient.

@johnwebbcole
Copy link
Contributor

The findFile helper should look up your directory tree till it finds a .htmlhintrc file. So if you are putting files in a temporary place, you can put the rc file anywhere up from there and it should get picked up.

@twxia
Copy link

twxia commented Dec 4, 2015

Hi guys~ Is it possible set the .htmlhintrc options in config.cson?

@Arcanemagus
Copy link
Member

The only setting currently implemented in this package is the path to htmlhint.

@twxia
Copy link

twxia commented Dec 5, 2015

@Arcanemagus thanks~ I think if there is a global configuration will be better .

@johnwebbcole
Copy link
Contributor

If you put a .htmlhintrc file in your root /, you essentially get a global configuration. The linter plugin looks for a .htmlhintrc in each directory up from the source file that is being linted, so if you have one anywhere above your source file it will stop at the first one it finds.

Rules and their options change, so it would be difficult to keep the linter config up to date. I use several .htmlhintrc files in each project, one in my client directory, another in my views directory and one in the server directory, each with different options (like turning off the doctype check in my views, but not in other places).

@dreamalligator
Copy link

There's some discussion about restructuring the options over here htmlhint/HTMLHint#279.

@dreamalligator
Copy link

Atm, HTMLHint can only support the rules directory via cli. If we could add an extra config option, then we'd be able to partially mitigate the issue that this directory cannot be set in the .htmlhintrc config file until the base project catches up. Understandably with the world situation, things are going to be delayed of course...

htmlhint --rulesdir ./rules/ --rules test-rule

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants