web_development:wordpress:wordpress-lint

Linting in wordpress

1.) Install PHP depending on your system.
1.) Install PEAR

Hint: run 'php –ini' in terminal to find where php.ini file is.

On Mac, in php.ini file make sure you add `include_path='/usr/local/pear/share/pear/'`

run which pear to see that PEAR has the right path.

1.) Install node
1.) Install nvm
1.) Install git
1.) Install phpcs and phpcbf with `pear install PHP_CodeSniffer` and `phpcs -i` should work in terminal

cd ~/DEV/WPDEV/
git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
phpcs --config-set installed_paths ~/DEV/WPDEV/wpcs
phpcs --config-set default_standard WordPress

IF you use Eslint here is how to install:
`npm install –save-dev eslint eslint-config-wordpress` may need to do `-g` for global

  • web_development/wordpress/wordpress-lint.txt
  • Last modified: 2020/10/09 04:09
  • by jimboobrien