Dude's comprehensive code quality definitions and pre-commit hooks for WordPress projects.
- Pre-commit hooks with comprehensive code quality checks
- Automatic context detection (standalone theme vs Bedrock project)
- PHP CodeSniffer validation
- Stylelint for SCSS files
- WordPress version checks (Bedrock mode)
- Dependency validation for Composer and npm
- Merge conflict and scissor mark detection
- Commit message validation with Linear integration
npm install @digitoimistodude/code-quality-checks husky --save-devInitialize husky:
npx husky initCreate wrapper scripts in your project's .husky/ directory that reference the package hooks.
node_modules/@digitoimistodude/code-quality-checks/.husky/pre-commitnode_modules/@digitoimistodude/code-quality-checks/.husky/commit-msg "$1"Make them executable:
chmod +x .husky/pre-commit .husky/commit-msgThe hooks automatically detect whether they're running in:
- Bedrock project: Has
content/themes/directory andcomposer.json - Standalone theme: Everything else
- WordPress version in composer.json
- Composer dependencies
- CHANGELOG.md format and freshness
- Theme style.css validation
- Multi-theme dependency checks
- Root stylelintrc should not exist
- Basic file requirements (.nvmrc, phpcs.xml, gulpfile.js)
- npm dependencies
- Stylelint config in current directory
- PHP syntax validation
- SCSS linting
Create .husky/pre-commit-config in your project to override defaults:
# Directories to exclude
EXCLUDE_DIRS=".husky|node_modules|vendor|.git|uploads|cache"
# Files to exclude (glob patterns)
EXCLUDE_FILES="*.min.js|*.min.css|*.map|*.lock|*.log"
# File extensions to exclude
EXCLUDE_EXTENSIONS=".jpg|.jpeg|.png|.gif|.svg|.ico|.pdf"
# Check only changed files (true) or entire codebase (false)
CHECK_CHANGED_ONLY=true- Node.js >= 18.0.0
- PHP >= 8.1
- Composer (for Bedrock projects)
- husky >= 9.1.7
Simply update the package to get the latest hooks:
npm update @digitoimistodude/code-quality-checksNo need to re-copy files - your wrapper scripts always use the latest version from node_modules.