# Silenced checks: `@ts-ignore`, `any`, blanket `# type: ignore` or `# noqa`, `eslint-disable` without a rule, `#[allow(dead_code)]`, `//nolint` without a reason

*Errors and checks hidden*: one of the ways AI coding agents bloat software, from lessloc's [pattern catalog](https://lessloc.org/patterns/index.md). lessloc catches it as [`suppression`](https://lessloc.org/guide/reference.md#tier-1).

## What makes silenced checks a bad practice?

The standards that call it a bad practice: Clean Code G4 Overridden Safeties; typescript-eslint ban-ts-comment and no-explicit-any; eslint-comments no-unlimited-disable; ruff PGH003, PGH004; golangci-lint nolintlint.

## What does lessloc do about silenced checks?

lessloc catches it as [`suppression`](https://lessloc.org/guide/reference.md#tier-1).

- `suppression` (tier 1): A blanket suppression: `@ts-ignore`, `any`, `# type: ignore` or `# noqa` without a code, `eslint-disable` without a rule, `nolint` without a linter and a reason, `allow(dead_code)`.

## Examples

Caught as `suppression`:

```ts [a.ts]
export const n: number = JSON.parse("1");
// @ts-ignore
export const m = n.foo;
```

Written well:

```ts [a.ts]
export const n = 1;
// @ts-expect-error: the vendored typings miss foo (upstream issue 12)
export const m = n.foo;
```

Caught as `suppression`:

```js [b.js]
/* eslint-disable */
export const x = 1;
```

Written well:

```js [b.js]
// eslint-disable-next-line no-console -- the CLI prints
console.log(1);
```

Caught as `suppression`:

```python [c.py]
import os  # noqa
x = os.sep  # type: ignore
```

Written well:

```python [c.py]
import os  # noqa: F401 re-exported for plugins
x = os.sep  # type: ignore[attr-defined]
```

Caught as `suppression`:

```rust [d.rs]
#[allow(dead_code)]
fn helper() -> u8 {
    1
}
```

Written well:

```rust [d.rs]
#[allow(clippy::too_many_arguments)]
fn helper() -> u8 {
    1
}
```

Caught as `suppression`:

```ts [ag.ts]
export function parse(s: string) {
  const data: any = JSON.parse(s);
  return data.id as any;
}
```

Written well:

```ts [ag.ts]
export function parse(s: string): { id: string } {
  return JSON.parse(s) as { id: string };
}
```

## Related patterns

The other patterns in [Errors and checks hidden](https://lessloc.org/patterns/index.md#errors-and-checks-hidden):

- [Swallowed errors](https://lessloc.org/patterns/swallowed-error.md): lessloc catches it as `swallowed-error`.
- [Checks, fallbacks and catches for cases that cannot happen](https://lessloc.org/patterns/defensive.md): `defensive` catches a null check of a value just created, a type re-checked inside private code and `?.` on a fresh object.
- [Removing validation or error handling to shrink code](https://lessloc.org/patterns/removed-safeguard.md): lessloc catches it as `removed-safeguard`.
