Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

WIP: react-update-imports pattern #244

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amedeedaboville
Copy link
Contributor

The pattern comes with 17 unit tests from the react-codemod repo. Only 9/17 are passing.

The main things left are:

  • figuring out when to not remove the default import. The example given is when the React variable itself is used, like Promise.resolve(React), which looks weird. I think this is saying, "is the React identifier present in a non import, non React.something way?" This is where I got stuck.
  • accumulating the React symbols used to import them instead of all of React (eg changing from import React from 'react' to `import { useState, useMemo } from 'react'). I had a draft of this but didn't get to running it.
  • dealing with import type React separately and not removing it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant