eslint-plugin-fp-jxl

3.1.0 • Public • Published

What

ESLint rules for functional programming.

NOTE 1 of 2: This is a fork from https://github.com/jfmengels/eslint-plugin-fp. I looked at the 33 forks at the time and none were up to date. So, I forked it, merged in 2 of the outstanding PR's, and added some missing features (allow class constructors, using classes if you extend React.Component, switch statements that have a default with a return value don't violate fp-jxl/no-nil, etc).

NOTE 2 of 2: Beware much of the docs will say things like fp-jxl/no-nil when referring to a rule. Always use that for this library, not fp/no-nil. The fp-jxl is the ESLint plugin suffix, and the no-nil is the rule name. Many places in the documentation and tests refer to fp. Since I don't own the original package, and ESLint is challenging to configure, just assume fp-jxl/some-rule for all rules in the documentation, excluding no-var which is global.

Install

$ npm install --save-dev eslint eslint-plugin-fp-jxl

Usage

Configure it in package.json.

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "env": {
      "es6": true
    },
    "plugins": [
      "fp-jxl"
    ],
    "rules": {
      "fp-jxl/explicit-return": "off",
      "fp-jxl/must-return": "off",
      "fp-jxl/no-arguments": "error",
      "fp-jxl/no-class": "error",
      "fp-jxl/no-delete": "error",
      "fp-jxl/no-events": "error",
      "fp-jxl/no-exceptions": "off",
      "fp-jxl/no-exports": "off",
      "fp-jxl/no-function-expressions": "off",
      "fp-jxl/no-get-set": "error",
      "fp-jxl/no-ifs": "off",
      "fp-jxl/no-imports": "off",
      "fp-jxl/no-instanceofs": "off",
      "fp-jxl/no-let": "error",
      "fp-jxl/no-loops": "error",
      "fp-jxl/no-mutating-assign": "error",
      "fp-jxl/no-mutating-methods": "error",
      "fp-jxl/no-mutation": "error",
      "fp-jxl/no-new": "off",
      "fp-jxl/no-nil": "error",
      "fp-jxl/no-nulls": "off",
      "fp-jxl/no-proxy": "error",
      "fp-jxl/no-reassigns": "off",
      "fp-jxl/no-rest-parameters": "error",
      "fp-jxl/no-switches": "off",
      "fp-jxl/no-this": "error",
      "fp-jxl/no-throw": "error",
      "fp-jxl/no-typeofs": "off",
      "fp-jxl/no-undefined": "off",
      "fp-jxl/no-unused-expression": "error",
      "fp-jxl/no-valueof-field": "error",
      "fp-jxl/no-variable-declarations": "off",
      "no-var": "error"
    }
  }
}

Rules

Recommended configuration

This plugin exports a recommended configuration that enforces good practices.

To enable this configuration, use the extends property in your package.json.

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "plugins": [
      "fp"
    ],
    "extends": "plugin:fp-jxl/recommended"
  }
}

See ESLint documentation for more information about extending configuration files.

MIT © Jeroen Engels MIT © Ivan Dmitriev MIT © Thomas Grainger MIT © Jesse Warden

Package Sidebar

Install

npm i eslint-plugin-fp-jxl

Weekly Downloads

0

Version

3.1.0

License

MIT

Unpacked Size

49.2 kB

Total Files

37

Last publish

Collaborators

  • jesterxl