reselect
reselect copied to clipboard
Add codemod to convert input selectors passed as separate inline arguments to a single array
This PR:
- [X] Adds
convertInputSelectorsToArray
codemod to convert input selectors passed as separate inline arguments to a single array.
Before:
const selectTodoById = createSelector(
(state: RootState) => state.todos,
(state: RootState, id: number) => id,
(todos, id) => todos.find((todo) => todo.id === id)
)
After:
const selectTodoById = createSelector(
[(state: RootState) => state.todos, (state: RootState, id: number) => id],
(todos, id) => todos.find((todo) => todo.id === id)
)
- [X] This should also help with transitioning into using the
withTypes
API since currently it does not support input selectors passed as separate inline arguments. - [X] Tested with
yalc
to make sure the CLI itself works. - [x] Added proper documentation for this codemod.