Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-check-constants

Package Overview
Dependencies
Maintainers
9
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-check-constants

Compile ES2015 constants to ES5

  • 7.0.0-beta.36
  • Source
  • npm
  • Socket score

Version published
Maintainers
9
Created
Source

@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

.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.

Keywords

FAQs

Package last updated on 25 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc