Created
June 22, 2018 10:16
-
-
Save sesn/476e443c9ba5ced76378f7e74e4f7329 to your computer and use it in GitHub Desktop.
Configuring PHPCS in Visual Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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