1.0.1-alpha.2 • Published 7 years ago
eslint-plugin-fp-challenge v1.0.1-alpha.2
eslint-plugin-fp-challenge
Enforce rules of Functional Programming challenge
Installation
You'll first need to install ESLint:
$ npm i eslint --save-devNext, install eslint-plugin-fp-challenge:
$ npm install eslint-plugin-fp-challenge --save-devNote: If you installed ESLint globally (using the -g flag) then you must
also install eslint-plugin-fp-challenge globally.
Usage
Add fp-challenge to the plugins section of your .eslintrc configuration
file. You can omit the eslint-plugin- prefix:
{
"plugins": ["fp-challenge"]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"fp-challenge/no-self-reference": "error",
"fp-challenge/no-calling-object-members": [
"error",
{ "except": ["console.log"] }
],
"fp-challenge/no-use-function": "error",
"fp-challenge/no-mutable-state": "error",
"fp-challenge/single-argument": "error"
}
}Supported Rules
no-self-referenceprevents recursion to itself by name.no-calling-object-membersprevents usage of.map,.sort,.reduce. To force using plain functions instead (and prevent side-effects)no-use-functionpromote using lambda's since they are more readable when using a single statement and a single argument.no-mutable-stateprevent assigning new values.single-argumentpromote currying instead of using multiple arguments.
Use the whole challenge configuration
{
"plugins": ["fp-challenge"],
"extends": ["plugin:fp-challenge/recommended"]
}