eslint-plugin-curry

ESLint plugin with advanced rules for currying

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
eslint-plugin-curry
0.1.06 years ago6 years agoMinified + gzip package size for eslint-plugin-curry in KB

Readme

eslint-plugin-curry
styled with prettier

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) => {}