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 = ;
correct:
const fooSelector = ;
redux-reselect/prefer-selector-ref
Enforces passing other selectors references into createSelector
function
incorrect:
const makeUsers = ;const booksSelector = ;
correct:
const usersSelector = ;const booksSelector = ;
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
array
args
e.g. redux-reselect/selector-args-type: [1, "array"]
redux-reselect/format-selector-name
- Selector variable name should end with
Selector
- Nothing like
makeSelect
,select
orselector
at the start is allowed
incorrect:
const apples = ;const makeSelectBooks = ;
correct:
const applesSelector = ;const booksSelector = ;