validation.undeclaredVariableCheck

How to use the validation.undeclaredVariableCheck transformer.

Throws errors on references to undeclared variables.

Usage

require("babel").transform("code", { optional: ["validation.undeclaredVariableCheck"] });
$ babel --optional validation.undeclaredVariableCheck script.js

Example

In

function foo() {}
foo();
bar();

Out

ReferenceError: stdin: Line 3: Reference to undeclared variable "bar" - did you mean "foo"?
  1 | function foo() {}
  2 | foo();
> 3 | bar();
    | ^
  4 |