@babel/plugin-check-constants
Compile ES2015 constants to ES5
Last updated 9 years ago by hzoo .
MIT · Repository · Original npm · Tarball · package.json
$ npm install @babel/plugin-check-constants 
SYNC missed versions from official npm registry.

@babel/plugin-check-constants

Validate ES2015 constants (prevents reassignment of const variables).

Example

In

const a = 1;
a = 2;

Out

repl: "a" is read-only
  1 | const a = 1;
> 2 | a = 2;
    | ^

Installation

npm install --save-dev @babel/plugin-check-constants

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@babel/check-constants"]
}

Via CLI

babel --plugins @babel/check-constants script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/check-constants"]
});

Note

This check will only validate consts. If you need it to compile down to var then you must also install and enable @babel/plugin-transform-block-scoping.

Current Tags

  • 7.0.0-beta.38                                ...           latest (9 years ago)

10 Versions

  • 7.0.0-beta.38                                ...           9 years ago
  • 7.0.0-beta.37                                ...           9 years ago
  • 7.0.0-beta.36                                ...           9 years ago
  • 7.0.0-beta.35                                ...           9 years ago
  • 7.0.0-beta.34                                ...           9 years ago
  • 7.0.0-beta.33                                ...           9 years ago
  • 7.0.0-beta.32                                ...           9 years ago
  • 7.0.0-beta.31                                ...           9 years ago
  • 7.0.0-beta.5                                ...           9 years ago
  • 7.0.0-beta.4                                ...           9 years ago
Downloads
Total 22
Today 0
This Week 0
This Month 14
Last Day 0
Last Week 0
Last Month 8
Dependencies (0)
None
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE