Eslint plugin for reduxjs/reselect Selector library for Redux
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
.
Currently has a few simple rules:
Enforces createSelector
result to be directly assigned to the selector function.
incorrect:
const fooSelector = () => createSelector();
correct:
const fooSelector = createSelector();
Enforces passing other selectors references into createSelector
function
incorrect:
const makeUsers = () => createSelector(...);
const booksSelector = createSelector(
makeUsers(),
...
);
correct:
const usersSelector = createSelector(...);
const booksSelector = createSelector(usersSelector, ...);
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
array
args
e.g. redux-reselect/selector-args-type: [1, "array"]
- Selector variable name should end with
Selector
- Nothing like
makeSelect
,select
orselector
at the start is allowed
incorrect:
const apples = createSelector();
const makeSelectBooks = createSelector();
correct:
const applesSelector = createSelector();
const booksSelector = createSelector();