Skip to content

invalid-ignore-code

Added in 1.0.0 · Related issues · View source

Fix is always available.

What it does

Checks for ignore[...] / file-ignore[...] suppression comments listing an invalid code.

Why is this bad?

An unknown code suppresses nothing, so the diagnostic the comment was meant to silence keeps firing. It is usually a typo, or a leftover from a rule that was renamed.

Example

{# djangofmt: ignore[not-a-rule] #}
<form method="yes">Submit</form>

Use instead:

{# djangofmt: ignore[invalid-attr-value] #}
<form method="yes">Submit</form>

Fix safety

The fix is marked as unsafe when it deletes a comment along with the free-text reason after its code list, as in ignore[...]: reason. Dropping a code from a list, or a comment carrying no reason, is safe.