These configuration files are for standardizing linting and formatting rules across your WordPress theme development projects.
- Clone this repo to your project's root directory with the command:
git clone [email protected]:jacobcassidy/wp-dev-config-files.git
- Customize the script's configuration settings in: wp-dev-config-files/scripts/settings.sh
- Run the installation script in you project's root directory with the command:
wp-dev-config-files/scripts/install.sh
- Delete the wp-dev-config-files directory after successfully running the installation script
- Update the
package.json
file details, such as name, description, author, homepage, and repository for your project. - Reload VSCode for the new linting and formatting rules to take effect.
Note
If a file already exists, this script will do nothing with that file. If you want to replace the file, you'll need to delete the file you want replaced and rerun this script, or manually copy/paste the parts you want.
All options can be turn on/off in the wp-dev-config-files/scripts/settings.sh
file.
Adds:
- .editorconfig
- .gitignore
- .markdownlint-cli2.jsonc
- .markdownlint.jsonc
- .prettierignore
- CHANGELOG.md
- composer.json
- eslint.config.mjs
- package.json
- phpcs.xml
- phpstan.neon
- prettier.config.mjs
- README.md
- stylelint.config.mjs
- webpack.config.mjs
Runs:
npm install
composer install
git init
Important
This script does not install any packages, only the configuration files the packages use. You will need to have the packages, e.g., Node, NPM, NPX, Git, Markdownlint, Prettier, Composer, ESLint, PHPCS, PHPStan, and Stylelint, installed before these configuration files can be used.
Note
This script uses the node module @wordpress/scripts
, which doesn't currently support modern configuration file types such as eslint.config.mjs
. The patches included in this script, which automatically install from wp-scripts-patches when the script is run, temporary fixes the issue so modern file formats can be used until @wordpress/scripts
is updated to do so itself.
If you come across any issues, please report them here.