Coding Standards
Status: 🚧 Stub
The coding conventions every WDS engineer follows. These build on (and occasionally diverge from) the official WordPress Coding Standards — divergences are called out explicitly.
Topics to cover​
PHP​
- WPCS configuration we use
- PHPCS / phpcbf setup and how to run it
- WDS-specific deviations from WPCS (if any)
- PHP version targets
JavaScript​
- ESLint config and setup
- Preferred frameworks/libraries by use case (vanilla, React for blocks, etc.)
- Module structure conventions
CSS / SCSS​
- Methodology (BEM, utility-first, etc.)
- Naming conventions
- File organization
WordPress-specific​
- Sanitization, escaping, and validation expectations
- Hook usage (when to use
add_actionvs. classes vs. service containers) - Naming prefixes for functions, classes, hooks
- Avoiding global state
Tooling​
- Required linters and formatters per project type
- Pre-commit hook setup (Husky, lint-staged, etc.)
- IDE/editor config recommendations
Related​
Owner: TBD | Last reviewed: TBD