Skip to content

Comment to disable/ignore rules #1227

@DerZyklop

Description

@DerZyklop

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestFunctionality that introduces a new featurehelp wantedWe are looking for community helpkeep-unstaleThe issue will not be marked as stale by the stale-bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions