Closed mikabytes closed 10 months ago
I verified this today running the steps below. I think this should be good to merge, but I'm not 100% sure as I haven't worked with React since some 8 years ago.
Steps to test:
mkdir test ; cd test
npm init
echo "const a = <Test />" > test.js
importjs fix test.js
cat test.js
Result before PR:
{"messages":["Imported React from 'react'"],"fileContent":"import React from 'react'\n\nconst a = <Test />;\n","unresolvedImports":{}}
Result after PR:
{"messages":[],"fileContent":"const a = <Test />\n","unresolvedImports":{}}
Glad you tried it out yourself -- I'm dealing with a family emergency and will likely be less active for a while. 🙏
No worries @trotzig, glad to hear you're keeping those priorities straight :+1:
Much inspiration from #580, thanks @madox2!
This PR never includes implicit React imports, unlike that PR. See issue for more information.
@trotzig Do you have some React projects where you could try this out in a sharp real-life environment? I don't do React, so I can't be too sure. All the tests are passing fine.