Skip to main content

Ignoring code

You can ignore :

  • within files
  • entire files

Within files

You can temporarily turn off rules using special comments in the HTML file. For example, you can either turn all the rules off:

<!-- linthtml-disable -->
<p>All rules are disabled here</p>
<!-- linthtml-enable -->
<p>All rules are enabled here</p>

Or you can turn off individual rules:

  • turn off the attr-bans rule
<!-- linthtml-disable attr-bans -->
  • turn on the attr-bans rule
<!-- linthtml-enable attr-bans -->

⚠️ you can only turn on rules that have been deactivated by an inline config

Multiple rules can be provided to the instructions as long as they are separated by a ,.

<!-- linthtml-disable attr-bans,indent-style,id-style -->
<!-- Spaces can be added to improve readability -->
<!-- linthtml-disable attr-bans, indent-style, id-style -->

Entire files

You can use a .linthtmlignore files to ignore specific files. For example:

dist/*.html
vendor/*.thml

The patterns in your .linthtmlignore file must match .gitignore syntax (The package node-ignore is used to parse the patterns). The patterns in .linthtmlignore are always relative to process.cwd().

LintHTML looks for a .linthtmlignore file in process.cwd().

Alternatively, you can add an ignoreFiles property within your configuration object.