Skip to content

feat: add codemod to convert input selectors passed as separate inline arguments to a single array#681

Open
aryaemami59 wants to merge 11 commits into
reduxjs:masterfrom
aryaemami59:codemod
Open

feat: add codemod to convert input selectors passed as separate inline arguments to a single array#681
aryaemami59 wants to merge 11 commits into
reduxjs:masterfrom
aryaemami59:codemod

Conversation

@aryaemami59

@aryaemami59 aryaemami59 commented Jan 12, 2024

Copy link
Copy Markdown
Member

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.

@netlify

netlify Bot commented Jan 12, 2024

Copy link
Copy Markdown

Deploy Preview for reselect-docs canceled.

Name Link
🔨 Latest commit 6385add
🔍 Latest deploy log https://app.netlify.com/sites/reselect-docs/deploys/680e1f16a4ec17000838b65d

@codesandbox-ci

codesandbox-ci Bot commented Jan 12, 2024

Copy link
Copy Markdown

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
Copy Markdown
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 self-assigned this Mar 18, 2026
@aryaemami59 aryaemami59 changed the title Add codemod to convert input selectors passed as separate inline arguments to a single array feat: add codemod to convert input selectors passed as separate inline arguments to a single array Mar 18, 2026
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