Giter VIP home page Giter VIP logo

eslint-plugin-ramda's Introduction

eslint-plugin-ramda

NPM Version Build Status Code Coverage NPM Downloads

ESLint rules for pragmatic Ramda usage, refactoring and simplification

Installation

$ npm install --save-dev eslint eslint-plugin-ramda

Usage

Configure it in package.json.

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "env": {
      "es6": true
    },
    "plugins": [
      "ramda"
    ],
    "rules": {
      "ramda/always-simplification": "error",
      "ramda/any-pass-simplification": "error",
      "ramda/both-simplification": "error",
      "ramda/complement-simplification": "error",
      "ramda/compose-pipe-style": "error",
      "ramda/compose-simplification": "error",
      "ramda/cond-simplification": "error",
      "ramda/either-simplification": "error",
      "ramda/eq-by-simplification": "error",
      "ramda/filter-simplification": "error",
      "ramda/if-else-simplification": "error",
      "ramda/map-simplification": "error",
      "ramda/merge-simplification": "error",
      "ramda/no-redundant-and": "error",
      "ramda/no-redundant-not": "error",
      "ramda/no-redundant-or": "error",
      "ramda/pipe-simplification": "error",
      "ramda/prefer-both-either": "error",
      "ramda/prefer-complement": "error",
      "ramda/prefer-ramda-boolean": "error",
      "ramda/prop-satisfies-simplification": "error",
      "ramda/reduce-simplification": "error",
      "ramda/reject-simplification": "error",
      "ramda/set-simplification": "error",
      "ramda/unless-simplification": "error",
      "ramda/when-simplification": "error"
    }
  }
}

Rules

  • always-simplification - Detects when always usage can be replaced by a Ramda function
  • any-pass-simplification - Suggests simplifying list of negations in anyPass by single negation in allPass
  • both-simplification - Suggests transforming negated both conditions on negated either
  • complement-simplification - Forbids confusing complement, suggesting a better one
  • compose-pipe-style - Enforces compose for single line expression and pipe for multiline
  • compose-simplification - Detects when a function that has the same behavior already exists
  • cond-simplification - Forbids using cond when ifElse, either or both fits
  • either-simplification - Suggests transforming negated either conditions on negated both
  • eq-by-simplification - Forbids eqBy(prop(_)) and suggests eqProps
  • filter-simplification - Forbids using negated filter and suggests reject
  • if-else-simplification - Suggests when and unless when it is possible to replace
  • map-simplification - Forbids map(prop(_)) and suggests pluck
  • merge-simplification - Forbids merge when assoc fits
  • no-redundant-and - Forbids and with 2 parameters in favor of &&
  • no-redundant-not - Forbids not with 1 parameter in favor of !
  • no-redundant-or - Forbids or with 2 parameters in favor of ||
  • pipe-simplification - Detects when a function that has the same behavior already exists
  • prefer-both-either - Enforces using both/either instead of allPass/anyPass with a list of only two predicates
  • prefer-complement - Enforces using complement instead of compositions using not
  • prefer-ramda-boolean - Enforces using R.T and R.F instead of explicit functions
  • prop-satisfies-simplification - Detects when can replace propSatisfies by more simple functions
  • reduce-simplification - Detects when can replace reduce by sum or product
  • reject-simplification - Forbids using negated reject and suggests filter
  • set-simplification - Forbids using set with lensProp in favor of assoc
  • unless-simplification - Forbids using negated unless and suggests when
  • when-simplification - Forbids using negated when and suggests unless

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": [
      "ramda"
    ],
    "extends": "plugin:ramda/recommended"
  }
}

See ESLint documentation for more information about extending configuration files.

MIT © @haskellcamargo and @lo1tuma

eslint-plugin-ramda's People

Contributors

haskellcamargo avatar jayands avatar jogold avatar lo1tuma avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.