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

Find an opinionated code formatting tool, like prettier in the JS world #50

Open
acelaya opened this issue Jan 25, 2024 · 4 comments
Open

Comments

@acelaya
Copy link
Contributor

acelaya commented Jan 25, 2024

Prettier has an official plugin to format PHP code which might be a good option: https://github.com/prettier/plugin-php

It has some considerations:

  • We need to check if it does not conflict with Wordpress coding standard, and if it does, we may want to move to PER-2/PSR-12 instead
  • Prettier is a JS tool. Since the project already has a package.json, we could incorporate a JS package manager to the toolbelt and workflow without a lot of effort, but may be easier to introduce a PHP-based tool if such thing exists.
@robertknight
Copy link
Member

Since the project already has a package.json, we could incorporate yarn to the toolbelt and workflow without a lot of effort, but may be easier to introduce a PHP-based tool.

@acelaya don't feel that we have to use Yarn in every project. For small or less-critical packages, npm may be just fine and can keep the toolchain a little simpler. npm's main downside is that it's lockfile format is less diff-friendly and its terminal output is less well presented.

@acelaya
Copy link
Contributor Author

acelaya commented Jan 25, 2024

@acelaya don't feel that we have to use Yarn in every project. For small or less-critical packages, npm may be just fine and can keep the toolchain a little simpler. npm's main downside is that it's lockfile format is less diff-friendly and its terminal output is less well presented.

True! But I with "yarn" I actually meant anything "non-composer" 😅

I'll rewrite it for clarity.

@SteelWagstaff
Copy link

SteelWagstaff commented Jan 25, 2024

A lot of folks in the WP environment use (PHP CodeSniffer)[https://github.com/squizlabs/PHP_CodeSniffer] with the WordPress coding standards: https://github.com/WordPress/WordPress-Coding-Standards. Here's the documentation on official WP coding standards, which are encouraged for plugins/themes as well: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/

@acelaya
Copy link
Contributor Author

acelaya commented Jan 26, 2024

A lot of folks in the WP environment use (PHP CodeSniffer)[https://github.com/squizlabs/PHP_CodeSniffer] with the WordPress coding standards: https://github.com/WordPress/WordPress-Coding-Standards. Here's the documentation on official WP coding standards, which are encouraged for plugins/themes as well: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/

That's what the project is currently using, but we need to make sure it fits nicely with the other hypothesis projects, where Python and JS/TS is primarily used.

It's important that anyone on the team can jump-in to work on this and the tooling and workflow feels familiar.

That's preferable even if it deviates from standard WordPress community "ways".

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

No branches or pull requests

3 participants