Skip to content

undefinedVariables

Reports using variables that are not defined.

✅ This rule is included in the ts untyped preset.

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.

console.log(undefinedVar);
function calculate() {
return result;
}
const value = first + second;

This rule is not configurable.

This rule can be safely disabled if you’re using TypeScript’s type checking, which will catch undefined variables through its own error reporting.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.