@babel/plugin-codemod-optional-catch-binding
Remove unused catch bindings
Last updated 5 months ago by jlhwung .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @babel/plugin-codemod-optional-catch-binding 
SYNC missed versions from official npm registry.

@babel/plugin-codemod-optional-catch-binding

If the argument bound to the catch block is not referenced in the catch block, that argument and the catch binding is removed.

Examples

try {
  throw 0;
} catch (err) {
  console.log("it failed, but this code executes");
}

Is transformed to:

try {
  throw 0;
} catch {
  console.log("it failed, but this code executes");
}

Installation

npm install --save-dev @babel/plugin-codemod-optional-catch-binding

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@babel/plugin-codemod-optional-catch-binding"]
}

Via CLI

babel --plugins @babel/plugin-codemod-optional-catch-binding script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-codemod-optional-catch-binding"]
});

References

This codemod updates your source code in line with the following proposal:

Current Tags

  • 7.10.4                                ...           latest (5 months ago)

36 Versions

  • 7.10.4                                ...           5 months ago
  • 7.7.4                                ...           a year ago
  • 7.0.0                                ...           2 years ago
  • 7.0.0-rc.4                                ...           2 years ago
  • 7.0.0-rc.3                                ...           2 years ago
  • 7.0.0-rc.2                                ...           2 years ago
  • 7.0.0-rc.1                                ...           2 years ago
  • 7.0.0-rc.0                                ...           2 years ago
  • 7.0.0-beta.56                                ...           2 years ago
  • 7.0.0-beta.55                                ...           2 years ago
  • 7.0.0-beta.54                                ...           2 years ago
  • 7.0.0-beta.53                                ...           2 years ago
  • 7.0.0-beta.52                                ...           2 years ago
  • 7.0.0-beta.51                                ...           2 years ago
  • 7.0.0-beta.50                                ...           2 years ago
  • 7.0.0-beta.49                                ...           2 years ago
  • 7.0.0-beta.48                                ...           3 years ago
  • 7.0.0-beta.47                                ...           3 years ago
  • 7.0.0-beta.46                                ...           3 years ago
  • 7.0.0-beta.45                                ...           3 years ago
  • 7.0.0-beta.44                                ...           3 years ago
  • 7.0.0-beta.43                                ...           3 years ago
  • 7.0.0-beta.42                                ...           3 years ago
  • 7.0.0-beta.41                                ...           3 years ago
  • 7.0.0-beta.40                                ...           3 years ago
  • 7.0.0-beta.39                                ...           3 years ago
  • 7.0.0-beta.38                                ...           3 years ago
  • 7.0.0-beta.37                                ...           3 years ago
  • 7.0.0-beta.36                                ...           3 years ago
  • 7.0.0-beta.35                                ...           3 years ago
  • 7.0.0-beta.34                                ...           3 years ago
  • 7.0.0-beta.33                                ...           3 years ago
  • 7.0.0-beta.32                                ...           3 years ago
  • 7.0.0-beta.31                                ...           3 years ago
  • 7.0.0-beta.5                                ...           3 years ago
  • 7.0.0-beta.4                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 74
Last Day 0
Last Week 36
Last Month 3
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |