0.1.2 • Published 9 years ago

eslint-plugin-no-arrow-labels v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

eslint-plugin-no-arrow-labels

An ESLint rule to disallow label statements inside arrow function bodies.

Helps avoid the common error of omitting parens when returning object literals from arrow functions using the concise syntax. E.g., params => { object: literal }

See MDN's notes on returning object literals from arrow functions

Note: You should probably just disallow labeled statements everywhere.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-no-arrow-labels:

$ npm install eslint-plugin-no-arrow-labels --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-no-arrow-labels globally.

Usage

Add no-arrow-labels to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "no-arrow-labels"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "no-arrow-labels": 2
    }
}