-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
react
import should not be restricted
#62939
Comments
The same issue came up in the React compiler PR - #61788 (comment). |
Thanks @Mamaduka, seems like there's even more reason to do something about this then. Unless I hear different, I will remove the restriction as a first step, then create a different issue to propose a more active transition (which is pretty much just a grep+replace of imports), and if there aren't any big arguments against it I'll start transitioning imports in chunks until done, and they add the restriction in the opposite direction to enforce importing from |
cc @WordPress/gutenberg-core |
Yeah, I'm totally ok with this change but I'm a bit concerned about losing the consistency and if we want to keep the consistency, then it's going to be a huge commit. Maybe a codemod would help. |
@youknowriad I think it'll be fine to have a small transition period, and I can do my best to get PRs pumped out in quick succession. It can be done in maybe a week, as long as I can count on someone's (yours? :D) help with fast reviews. |
I think a small number of commits is actually better than a big number of PRs. That way we can add these to |
What benefits do we expect from these changes that justify updating the entire codebase and documentation to use React directly? |
@gziolo I think the linked discussion should be relevant to your question, but to name one thing that directly impacts me: I get routinely annoyed by auto imports of react stuff resulting in eslint complaining, and having to go back and manually change it to the wrapper. I have to interrupt my flow and go and fix it. |
I don't see much value in the To add to this, what @Mamaduka said about React Compiler not appreciating our Also, this will help with consistency - everyone inside the codebase and outside the codebase will be able to use It's worth noting that we'll still have to support |
As a wordpress plugin developer newbie I'll just ship my own React and access it directly, I just don't have time to wait for this to happen |
What problem does this address?
In #54074 there was a decent amount of consensus about using (a.k.a. importing) react more directly, instead of from
@wordpress/element
. However, the @typescript-eslint/no-restricted-imports lint rule seems to prevent it.What is your proposed solution?
The rule should be removed.
Note: I think it might be worth it to go the opposite direction and restrict imports from
@wordpress/element
. Along with a full grep+replace which shouldn't be too hard (maybe in stages?). However, for the sake of keeping a reasonable scope, let's leave that for a separate issue/conversation.The text was updated successfully, but these errors were encountered: