Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codemod to convert input selectors passed as separate inline arguments to a single array #681

Open
wants to merge 92 commits into
base: master
Choose a base branch
from

Conversation

aryaemami59
Copy link
Contributor

@aryaemami59 aryaemami59 commented Jan 12, 2024

This PR:

  • 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)
)
  • This should also help with transitioning into using the withTypes API since currently it does not support input selectors passed as separate inline arguments.
  • Tested with yalc to make sure the CLI itself works.
  • Added proper documentation for this codemod.

Copy link

netlify bot commented Jan 12, 2024

Deploy Preview for reselect-docs canceled.

Name Link
🔨 Latest commit 619f3f8
🔍 Latest deploy log https://app.netlify.com/sites/reselect-docs/deploys/66439b934562aa000982d5e0

Copy link

codesandbox-ci bot commented Jan 12, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@aryaemami59 aryaemami59 force-pushed the codemod branch 9 times, most recently from 1bf74e9 to 1c698d7 Compare May 14, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant