undefinedVariables
Reports using variables that are not defined.
✅ This rule is included in the ts javascript presets.
Variables must be declared before they can be used in JavaScript. Using undefined variables will cause a ReferenceError at runtime. This rule helps catch typos and missing declarations early in development.
Examples
Section titled “Examples”44AEco3F53con44AEfuncdede344AEco44AEco44AEcoOptions
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”This rule can be safely disabled if you’re using TypeScript’s type checking, which will catch undefined variables through its own error reporting.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noUndeclaredVariables - ESLint:
no-undef - Oxlint:
eslint/no-undef
