You need Composer on your system: Install
CD to your project root and run:
composer require --dev wp-coding-standards/wpcsInstall the PHP Sniffer & Beautifier extension.
Open VS Code’s settings.json and add:
"[php]": {
"editor.defaultFormatter": "valeryanm.vscode-phpsab",
"editor.formatOnSave": true
}also
"phpsab.standard": "WordPress"Source: Edmund Chan