Overview of the coding standards tooling available to WordPress developers
Discussed in https://github.com/WordPress/developer-blog-content/discussions/160
Originally posted by ryanwelcher August 28, 2023 It would be great to go over the coding standard tools that are available to WP developers to be able to keep their code standards compliant and consistent.
The article will cover setting up locally to use:
- WordPress Coding Standards for PHP
- The tools provided by the
@wordpress/scriptspackage - Some IDE configuration - probably focus on VSCode and PHP Storm but open other or maybe it's better to be editor agnostic?
Ooo I might be keen to work on this one, perhaps after the initial developer learning pathways launch in July...
I'll defer to @jonathanbossenger on this one - happy to help if I can.
Some IDE configuration - probably focus on VSCode and PHP Storm but open other or maybe it's better to be editor agnostic?
I think we could focus on VS Code, as it's used by the majority of WordPress developers, but also cover PhpStorm because it has the next largest user base (stats: https://jonathanbossenger.com/2023/07/the-state-of-wordpress-developer-tools-survey-results/).
Wanted to add this template I created as a reference. It's got all of the "plumbing" in place to add the best practices/standards stuff to a project - https://github.com/ryanwelcher/wordpress-project-template
@ryanwelcher I'd love to get your opinion on including something about the underlying tools behind the @wordpress/scripts terminal scripts.
AFAIK (based on a quick review of the scripts package) these are:
- https://stylelint.io/ and https://eslint.org/ for CSS and JS linting
- https://prettier.io/ for CSS and JS formatting
One way would be to do a deep dive into setting each of those three up individually, then show how it's magically doable via @wordpress/scripts.
Another way is to only show how to configure @wordpress/scripts (either for a new project or an existing one) and explain what tools it uses underneath.
I can see the pros and cons of both approaches.