Rules
no-let
Prefer immutable const bindings and explicit shadowing.
Purpose and behavior
Prefer immutable const bindings and explicit shadowing.
Reports every let variable declaration, once per declaration even with multiple declarators. It does not report var and does not rewrite reassignment automatically.
Options
No configurable options. Enable with "rules/no-let": "error".
Invalid example
let x = 1Valid example
const x = 1Fixes and exceptions
This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.
For a genuine boundary exception, use an oxlint-disable-next-line rules/no-let -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.
Source and tests
Enabled by the TypeScript preset.