The codebase I’m dealing with has a bunch of unexplained // @ts-ignore-error
and //eslint-disable-next-line
comments that don’t provide a reason why they’re in there.
I recognize that in some cases these sidesteps around the analysis tooling are a necessary evil, but I firmly believe that there should always be an explanation for why.
This is okay:
// @ts-expect-error new CSS property
<label style={{ anchorName: `--${id}` }} data-anchor-name={id}></label>
The reason we’re suppressing the error is explained right there, and in this case in particular, we’ll be informed when we can remove the suppression comment altogether.
This is not:
// @ts-ignore
refs.current[item.value] = el;
There’s no explanation given at all, and no attempt, here or elsewhere, to clear things up with the typechecker.
What I’m looking for is a way to configure ESLint to complain about these kinds of unexplained suppression comments. Docs don’t show anything like this, and a few searches for “no unexplained suppression”, “no unexplained ignore” and similar don’t return anything useful either.
1