Rules

no-let

Use const bindings instead of let.

Purpose and behavior

Use const bindings instead of let.

The rule reports each let declaration once, even when it declares multiple variables. The rule ignores var and does not fix reassignment.

Options

No configurable options. Enable with "rules/no-let": "error".

Invalid example

let x = 1

Valid example

const x = 1

Fixes and exceptions

This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-let -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the TypeScript preset.

no-let.ts · Tests