Code Quality Standards
Quick Commands
npm run php:lint # Check PHP style
npm run php:lint-fix # Auto-fix PHP issues
npm run php:phpstan # Static analysis
npm run lint:js # JavaScript
npm run lint:css # CSS
Project-Specific Rules
| Area | Standard |
|------|----------|
| PHP | 7.4+, WordPress Coding Standards |
| Prefixes | sh, simplehistory, simple_history |
| Text domain | simple-history |
| CSS naming | SuitCSS: sh-ComponentName-subpart |
| Array syntax | Short [] not array() |
| Control structures | Always use braces {}, never colon syntax |
Essential Principles
- Always escape output - Use WordPress escaping functions
- Prefix everything - All hooks, functions, classes
- Run tools after changes - phpcs/phpstan before committing
Detailed Guidelines
- php-standards.md - PHP style, happy path, early returns
- css-standards.md - SuitCSS naming conventions
- js-standards.md - JavaScript conventions
- tooling.md - phpcs, phpstan, rector usage
- design-principles.md - DRY, YAGNI, refactoring patterns
Related Files
phpcs.xml.dist- PHP_CodeSniffer configphpstan.neon- PHPStan config