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

[Feature]: Replace webpack and linting config with @wordpress/scripts #117

Open
ampersarnie opened this issue May 10, 2024 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@ampersarnie
Copy link
Member

The feature

@wordpress/scripts has advanced greatly since we originally set out to create a tool for internal usage that allows us to manage our ways of working. Because of this quick and often progression there are times where we can fall behind the standards being laid out and implemented into WordPress.

Project seeking should remain the same, however it may mean the individual project structure may change to take advantage of various different features from @wordpress/script and WordPress Core. Any of those discussions and change decisions should be logged in this ticket.

Affects the following tickets:

@g-elwell
Copy link
Member

I've created a draft PR to explore some of this here.

I first attempted to pull in @wordpress/scripts configs and merge them with what we had, but realised quite quickly that this was going to be difficult, adding more complexity on top of an already complex set up. For example, the block.json detection alone required significant additional config to integrate with the way we manage projects via webpack.

So, I've been experimenting with a different approach, using concurrently to run wp-scripts in each project folder. This works quite well but meant I needed to begin going through all of the features from the build-tools and adding them back in.

In terms of what we gain by doing this, I've noticed several useful eslint rules especially around react, a11y, jsdoc and some specific to WordPress. I've specifically not turned off any rules, except for changing @wordpress/no-unsafe-wp-apis to a warning instead of an error, but I suspect we will review all of the rule additions/changes anyway and test across several projects.

There are also a couple of key differences between wp-scripts and our build tools whilst going through this process:

  • Built files are located in a different area, I suggest we adapt to the WordPress way of working here
  • wp-scripts doesn't lint during the build process, I've added this back in so it works as we're used to

This is very much still a work in progress but if anyone wants to check it out please do:
https://github.com/bigbite/build-tools/tree/test/wp-scripts-concurrently

@scottblackburn
Copy link

@scottblackburn to share an example plugin from 2U to test this

@ampersarnie
Copy link
Member Author

Update on this: work on the release hit a couple of issues with the Unit Tests. There's been some difficulty getting them passing due to @wordpress/dependency-extraction-webpack-plugin. Code runs perfectly fine, and examples that I'm using are working as expected, but the unit tests have issues with the package that I'm not able to resolve as of writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants