Setup PHPCBF on VS Code for Mac (WordPress PHPCS)
I have finally been able to set up PHPCBF (automatic lint fixing) with PHP Coding Standards for the Mac.
It has been a long struggle of technical difficulties over different apps.
How to set up automatic PHPCBF
- Open VS Code
- Open the Command Palette CMD+Shift+P and search for Tasks: Open User Tasks. Hit Enter.
- Paste the following script and save the tasks.json file.
- Install this VS Code extension: Trigger Task on Save
- Open your VSCode settings.json file
- Add the following to your configuration:
- Save the file changes.
The following PHP Coding Standards have been set for the file:
You can modify the tasks.json file to use a different set of commands or standards.
Let me know your thoughts if you have any questions or feedback on this setup