Disallow unused disable directives
- Rule ID:
- no-unused-disable
- Category:
- -
- Standards:
- -
Rules can be disabled using directives such as <!-- [html-validate-disable-next my-rule] -->
.
This rules disallows unneccesary disabled rules, i.e. rules that would not have generated any error even if enabled.
This is usually a case of refactoring or changing environment.
Rule details
Examples of incorrect code for this rule:
<!-- [html-validate-disable-next attribute-allowed-values -- no error, disable is invalid] -->
<button type="submit"></button>
Examples of correct code for this rule:
<!-- disable removed, no error -->
<button type="submit"></button>
<!-- [html-validate-disable-next attribute-allowed-values -- element has error, disable is valid] -->
<button type="foobar"></button>
This rule can also disable itself:
<!-- [html-validate-disable-next attribute-allowed-values, no-unused-disable -- no error as no-unused-disable is also disabled] -->
<button type="submit"></button>
Version history
- 7.13.1 - Rule is allowed to disable itself with directive.
- 7.13.0 - Rule added.