1.1.1 • Published 7 years ago
eslint-plugin-redux-reselect v1.1.1
eslint-plugin-redux-reselect
Eslint plugin for reduxjs/reselect Selector library for Redux
Install
npm i -D eslint-plugin-redux-reselectNB! 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
arrayargs
e.g. redux-reselect/selector-args-type: [1, "array"]
redux-reselect/format-selector-name
- Selector variable name should end with
Selector - Nothing like
makeSelect,selectorselectorat the start is allowed
incorrect:
const apples = createSelector();
const makeSelectBooks = createSelector();correct:
const applesSelector = createSelector();
const booksSelector = createSelector();