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 11 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 caaddf2
🔍 Latest deploy log https://app.netlify.com/sites/reselect-docs/deploys/674eea039f9975000825e8a6

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 marked this pull request as ready for review February 10, 2024 22:50
@aryaemami59 aryaemami59 force-pushed the codemod branch 10 times, most recently from 1c698d7 to ae36706 Compare May 14, 2024 17:08
@markerikson
Copy link
Contributor

Nits:

  • can we move the codemod tests lower in the file so that the TS and unit test jobs show up first?
  • I don't think we need to test on both Ubuntu and MacOS. Ubuntu seems sufficient.

@aryaemami59 aryaemami59 force-pushed the codemod branch 10 times, most recently from 15b0ed9 to 0cfef26 Compare August 13, 2024 04:07
@aryaemami59 aryaemami59 force-pushed the codemod branch 4 times, most recently from eb3cc33 to ca35add Compare August 27, 2024 18:56
@aryaemami59 aryaemami59 force-pushed the codemod branch 2 times, most recently from 00188d6 to 486a389 Compare September 17, 2024 05:26
@aryaemami59 aryaemami59 force-pushed the codemod branch 6 times, most recently from 274193b to 126ec4c Compare October 2, 2024 22:50
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.

2 participants