Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

no-optional-catch-binding

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Issues
File Explorer

Advanced tools

no-optional-catch-binding

ESLint rule to flag catch clauses with no error variable binding

    1.0.0latest

Version published
Maintainers
1
Yearly downloads
1,586
increased by2378.13%

Weekly downloads

Changelog

Source

v1.0.0

Readme

Source

no-optional-catch-binding

Current Version Build Status via Travis CI Dependencies

disallow optional error variable binding in catch blocks (no-optional-catch-binding)

JavaScript allows error variables to be optionally omitted from catch clauses. For example:

(() => { try { throw new Error(); return 1; } catch { // The caught exception is not used, and has been omitted. return 2; } })();

Rule Details

This rule requires that each catch clause includes an error variable binding.

An example of incorrect code for this rule:

/*eslint no-optional-catch-binding: "error"*/ (() => { try { throw new Error(); return 1; } catch { return 2; } })();

An example of correct code for this rule:

/*eslint no-optional-catch-binding: "error"*/ (() => { try { throw new Error(); return 1; } catch (err) { return 2; } })();

When Not To Use It

If you want to allow optional catch binding, you can turn this rule off.

Keywords

FAQs

What is no-optional-catch-binding?

ESLint rule to flag catch clauses with no error variable binding

Is no-optional-catch-binding popular?

The npm package no-optional-catch-binding receives a total of 204 weekly downloads. As such, no-optional-catch-binding popularity was classified as not popular.

Is no-optional-catch-binding well maintained?

We found that no-optional-catch-binding demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 29 Jan 2018
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc