eslint-plugin-curry
v0.1.0
Published
ESLint plugin with advanced rules for currying
Downloads
369
Maintainers
Readme
eslint-plugin-curry
Installation
Install ESLint either locally or globally. Install eslint-plugin-curry.
With Yarn:
$ yarn add -D eslint eslint-plugin-curry
Or, if you prefer npm:
$ npm install --save-dev eslint eslint-plugin-curry
Configuration
Add a plugins
section and specify eslint-plugin-curry as a plugin.
{
"plugins": [
"curry"
]
}
Enable the rules.
Rules
arrow-parens
This rule works like vanilla arrow-parens, but provides an additional setting for functions that use currying.
/* eslint curry/arrow-parens: [2, "as-needed", { "requireForBlockBody": true, "curry": "never" }] */
// bad
const fn = (x) => x
const fn = x => {}
const fn = (x) => (y) => (z) => {}
// good
const fn = x => x
const fn = (x) => {}
const fn = x => y => z => {}
/* eslint curry/arrow-parens: [2, "as-needed", { "curry": "always" }] */
// bad
const fn = (x) => x
const fn = (x) => {}
const fn = x => y => z => {}
// good
const fn = x => x
const fn = x => {}
const fn = (x) => (y) => (z) => {}