Git Product home page Git Product logo

eslint-plugin-redux-reselect's Introduction

eslint-plugin-redux-reselect

Eslint plugin for reduxjs/reselect Selector library for Redux

Install

npm i -D eslint-plugin-redux-reselect

NB! Don't forget to add reselect to eslint config plugins as well as add rules from below to your rules.

Rules

Currently has a few simple rules:

redux-reselect/assign-selector-to-variable

Enforces createSelector result to be directly assigned to the selector function.

incorrect:

const fooSelector = () => createSelector();

correct:

const fooSelector = createSelector();

redux-reselect/prefer-selector-ref

Enforces passing other selectors references into createSelector function

incorrect:

const makeUsers = () => createSelector(...);
const booksSelector = createSelector(
  makeUsers(),
  ...
);

correct:

const usersSelector = createSelector(...);
const booksSelector = createSelector(usersSelector, ...);

redux-reselect/selector-args-type

Enforces passing other selectors into createSelector function either by one array argument containing selectors, or by passing all of the selectors directly to a function (args)

You should specify either of the following options in the eslint config

  1. array
  2. args

e.g. redux-reselect/selector-args-type: [1, "array"]

redux-reselect/format-selector-name

  1. Selector variable name should end with Selector
  2. Nothing like makeSelect, select or selector at the start is allowed

incorrect:

const apples = createSelector();
const makeSelectBooks = createSelector();

correct:

const applesSelector = createSelector();
const booksSelector = createSelector();

eslint-plugin-redux-reselect's People

Contributors

viktor-ku avatar

Watchers

James Cloos 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.