safe-ts-ignore
A // safe-ts-ignore <rule>: <reason> comment that doesn't do its job: it names no rule, a rule that doesn't exist, or no reason, or it silences nothing. Ignore comments are described in Ignoring one finding.
Why: an ignore comment is an escape hatch. The reason is what the next reader (and the reviewer of the change) goes by: "the SDK tells null from undefined" can be checked, a bare safe-ts-ignore can't. And an ignore that no longer silences anything has outlived its finding. Left in place, it would silence the next, different problem on that line without anyone deciding to. TypeScript treats an unused @ts-expect-error the same way.
❌ Rejected: no reason
✕ Rejectedsafe-ts-ignore
ts
// safe-ts-ignore no-null
export const locale = null;❌ Rejected: nothing on the next line is reported by no-throw
✕ Rejectedsafe-ts-ignore
ts
// safe-ts-ignore no-throw: the caller catches it
export const retries = 3;✅ Accepted: the rule and the reason
✓ Accepted0 diagnostics
ts
// safe-ts-ignore no-null: the payment SDK tells "no locale" (null) from "the default" (undefined)
export const locale = null;The comment covers the next line; // safe-ts-ignore-file <rule>: <reason> covers the whole file, and <!-- safe-ts-ignore <rule>: <reason> --> in a Vue template the start tag of the element after it. An ignore for a rule that is off in that file (by package.json, or an idiomatic rule while the layer is off) isn't reported as unused, and neither is one in a // @safe-ts legacy file, where nothing is reported. The rule can't silence itself or a syntax error (parse-error).
An ignore for a rule only safe-ts check reports, because only the whole program shows it (no-optional-field, unused-code, inline-member-set, constructor-calls-override, path-sink, unknown-event, unmatched-event), is judged by safe-ts check alone. The editor and the oxlint plugin check one file and its imports and don't report those rules, so they don't call such an ignore unused: safe-ts check, which sees the whole program, reports it once the finding is gone. Its other problems (no reason, a rule that doesn't exist) are reported everywhere.
What the rule can't see
- Whether the reason is true. It only has to be there.
- Comments at the end of a line of code (
f(); // safe-ts-ignore ...): only a comment on a line of its own is an ignore comment, so this one is neither applied nor reported.