Nominally Patriotic Meathead
Miss any of our Open RFC calls?Watch the recordings here! »

babel-plugin-undeclared-variables-check

6.22.0 • Public • Published

babel-plugin-undeclared-variables-check

This plugin throws a compile-time error on references to undeclared variables.

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 |

Installation

npm install --save-dev babel-plugin-undeclared-variables-check

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["undeclared-variables-check"]
}

Via CLI

babel --plugins undeclared-variables-check script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["undeclared-variables-check"]
});

Keywords

Install

npm i babel-plugin-undeclared-variables-check

DownloadsWeekly Downloads

82,530

Version

6.22.0

License

MIT

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar