Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Silencing the checker: type escapes and suppressions
card 5 of 6
Linter suppressions: same move, other tools
builds on: Agents optimise the signal they can see
In Go, `//nolint:errcheck` on `f.Close()` after a write hides the error `Close` can report, so a failed save looks successful. In TS, `eslint-disable-next-line react-hooks/exhaustive-deps` hides that a React effect reads a variable missing from its dependency list, so it keeps using an old value. In Rust, `#[allow(unused_must_use)]` hides that an error `Result` is dropped. A suppression can be fine when it covers one line, names the rule where the tool allows it, and gives a true reason: `// @ts-expect-error <reason>`, `# type: ignore[arg-type] # <reason>`. Prefer `@ts-expect-error` to `@ts-ignore`: it fails once the error is gone. A file-wide or crate-wide disable is a tell.
Terms on this card
- tell
- An observable sign in a diff, transcript or summary that suggests a shortcut or an error.
- linter
- A tool that flags suspicious or rule-breaking code patterns beyond what the compiler requires, e.g. ESLint, golangci-lint, Clippy.
- `@ts-ignore`
- A TS comment that suppresses every type error on the next line, including errors that appear there later.
- `@ts-expect-error`
- A TS comment that suppresses the next line's error but itself errors if no error exists. That makes stale suppressions visible.
- `Result`
- Rust's return type for operations that can fail: either `Ok(value)` or `Err(error)`.
Lesson goal: Spot the escape hatches that silence the compiler or linter instead of fixing the problem: `any`, `as`, non-null `!` and `@ts-ignore` in TS; `# type: ignore` and `cast` in Python; `@SuppressWarnings("unchecked")` in Java; `any`/`interface{}` in Go; `unsafe`; and `eslint-disable`, `//nolint`, `#[allow]`. Explain which guarantee each one removes. ·
the whole lesson