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

Enforce coding standards on importing from @wordpress/element instead of react #6988

Open
pauloiankoski opened this issue Oct 2, 2023 · 1 comment
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale.

Comments

@pauloiankoski
Copy link
Contributor

Details

In our recent discussion, it was pointed out that our project has inconsistent import statements when it comes to React components. Some parts of our code import from the react package while others import from @wordpress/element. Given that we are using wp-scripts to build our project and WordPress handles these packages for us, it seems more appropriate to import from @wordpress/element.

Reference discussion: https://lw.slack.com/archives/C04SLRDD9CK/p1696274616679709

Points highlighted from the discussion:

  • @wordpress/element serves as an abstraction layer atop React and is the recommended import source when working within a WordPress context.
  • This inconsistency in our code is more of a coding standard issue rather than a technical one.
  • It was suggested to enforce this standard via linting or possibly PhpStorm configurations.

We need to decide on a standard and enforce it to maintain consistency across our codebase. It might require some research on how to set up linting rules or PhpStorm configurations to ensure we adhere to this standard.

@kjohnson kjohnson added the keep-fresh "Keep Fresh" issues should not be marked as stale. label Oct 2, 2023
@kjohnson
Copy link
Member

kjohnson commented Oct 2, 2023

Related reading: woocommerce/woocommerce#37503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale.
Projects
None yet
Development

No branches or pull requests

2 participants