lightsoutAlpha

no-any

Avoiding the type that switches type checking off.

Deterministic checkBlocks by default

The rule

Agents read this text as written when they write and review code.

Never use any. When a type is genuinely unknown, use unknown and narrow it with type guards. When it is not, write the specific type or a generic. A rare, justified exception gets the project's lint-suppression comment, with the reason.

any switches type checking off for everything it touches.

Examples

The check flags the incorrect code and passes the correct code. Each example is a small repo, because this rule looks across files. It opens on the file that matters; the other files are the repo around it.

Incorrect

srcparsing
src/parsing/parseRecord.ts
export const parseRecord = ({ raw }: { raw: any }): string => String(raw);

Correct

srcparsing
src/parsing/parseLegacyRecord.ts
// The rare, justified bypass the rule allows, with the reason written down.
// biome-ignore lint/suspicious/noExplicitAny: the vendor callback is untyped and its shape is not published
export const parseLegacyRecord = ({ raw }: { raw: any }): string => String(raw);

Configure

  • Block"blocking"Stops a run when a file the run changed breaks the rule.
    Default
  • Advise"advisory"Reports it and hands it to the refactor agent. Never stops a run.
  • Off"off"Not checked. Use it when your own linter already enforces the rule.

Add this to your lightsout.config.json, then change the value.

lightsout.config.json
{
"standards-rule-settings": {
"no-any": "blocking"
}
}

Packs that select it