Skip to content

Instantly share code, notes, and snippets.

@sesn
Created June 22, 2018 10:16
Show Gist options
  • Save sesn/476e443c9ba5ced76378f7e74e4f7329 to your computer and use it in GitHub Desktop.
Save sesn/476e443c9ba5ced76378f7e74e4f7329 to your computer and use it in GitHub Desktop.
Configuring PHPCS in Visual Code
1. Insert the following into composer.json:
```json
"require-dev": {
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "^0.13.1"
},
"scripts": {
"post-install-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
],
"post-update-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
]
}
```
2. Insert the following into your Visual Studio Code User Settings:
```json
"phpcs.enable": true,
"phpcs.standard": "WordPress"
```
3. Run composer install or composer update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment