HTMLHint icon indicating copy to clipboard operation
HTMLHint copied to clipboard

Comment to disable/ignore rules

Open DerZyklop opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. I have a existing project, i want to enable HTMLHint, but i can not, because i would have to solve every existing error in legacy code. I would like to not change legacy code but enable HTMLHint on the project. So, I would like to disable/ignore some rules on some lines/files.

Describe the solution you'd like It’s common for several linters to have the possibility to disable specific rules for specific lines, or at least disable the linter for a bunch of lines.

Here is an example of how this looks like at ESLint: https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-rules

Proposal

This disables HTMLHint for the following lines:

<!-- htmlhint-disable -->
<div class="foo">Lorem</div>
<div class="bar">Ipsum</div>

This disables HTMLHint for the line with the div.foo:

<!-- htmlhint-disable-next-line -->
<div class="foo">Lorem</div>
<div class="bar">Ipsum</div>

This disables the HTMLHint rule attr-lowercase for the following lines:

<!-- htmlhint-disable attr-lowercase -->
<div CLASS="foo">Lorem</div>
<div CLASS="bar">Ipsum</div>

This disables the HTMLHint rule attr-lowercase for the line with the div.foo:

<!-- htmlhint-disable-next-line attr-lowercase -->
<div CLASS="foo">Lorem</div>
<div class="bar">Ipsum</div>

This is how you can disable it for several lines:

<!-- htmlhint-disable -->
<div class="foo1">Lorem</div>
<div class="foo2">Lorem</div>
<!-- htmlhint-enable -->
<div class="bar">Ipsum</div>

Describe alternatives you've considered

Additional context There are related issues about that, that have been closed. I believe they have not been closed because this is feature not important, but because before 2020 this project was pretty much dead and the owner was unreachable. So this makes it necessary for me to open this topic again.

DerZyklop avatar Nov 08 '22 12:11 DerZyklop

This feature would be extremely useful!

visz01 avatar Dec 01 '22 16:12 visz01

Any update on this?

barmatz avatar Mar 09 '23 11:03 barmatz

Has there been any progress on this? A very useful feature to have

greenandlonely avatar Mar 17 '23 11:03 greenandlonely