html-linter icon indicating copy to clipboard operation
html-linter copied to clipboard

Disable linter via HTML comment

Open arechsteiner opened this issue 8 years ago • 2 comments

Is there a functionality to temporarily disable the linter for a block of HTML code?

I have some unavoidable errors that I'd like to suppress. I render some HTML with a syntax highlighter (ruby rouge), and the indentation is off. What would be useful is this:

... pretty HTML ...

<!-- html-linter:disable Indentation -->

... some ugly HTML ...

<!-- html-linter:enable Indentation -->

... more pretty HTML

Note: This syntax is taken directly from the SCSS linter.

arechsteiner avatar Apr 25 '17 15:04 arechsteiner

In that case wouldn't it be better to just skip the linting of such generated files. Alternatively you can use the flag --exclude to omit sone error classes. The third option would be to lint the template instead of the generated code.

On Apr 25, 2017 22:31, "Alexander Rechsteiner" [email protected] wrote:

Is there a functionality to temporarily disable the linter for a block of HTML code?

I have some unavoidable errors that I'd like to suppress. I render some HTML with a syntax highlighter (ruby rouge), and the indentation is off. What would be useful is this:

... pretty HTML ...

... some ugly HTML ...

... more pretty HTML

Note: This syntax is taken directly from the SCSS linter https://github.com/brigade/scss-lint#disabling-linters-via-source.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deezer/html-linter/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3pmOc1MLFsCsSC9IRkTtctO596zvovks5rzhGwgaJpZM4NHqV1 .

sk- avatar Apr 26 '17 05:04 sk-

None of those options are viable in my case.

  • It's important to me that the generated files pass the linter, because I deliver them to other developers.
  • I don't want to exclude the indentation check in general, just for a very short block where I have no control over it
  • Linting the template files leads to a whole host of other errors as the templating syntax is not understood by the linter.

I'm sure there's many other situations as well where disabling linting on a very specific area in the code is needed. It's a very valuable feature in the SCSS linter as well.

arechsteiner avatar Apr 26 '17 12:04 arechsteiner