docs: update readme linting instructions

This commit is contained in:
Ben Goldsworthy 2021-04-15 03:20:38 +01:00
parent d52de71726
commit 2cff59f28c

View file

@ -80,7 +80,15 @@ Automated testing will be introduced soon.
This repo. uses pre-commit code formatting and linting on all staged files. This repo. uses pre-commit code formatting and linting on all staged files.
This ensures that only style-conformant code can be committed. This ensures that only style-conformant code can be committed.
The individual commands used by the pre-commit hook can also be called manually: The individual commands can also be called manually:
- Run `composer run format` to run all format commands.
- Run `composer run format:fix` to attempt to automatically fix all formatter warnings
and errors.
- Run `composer run lint` to run all linting commands.
- Run `composer run lint:fix` to attempt to automatically fix all linter warnings and
errors.
### PHP Code ### PHP Code
@ -94,13 +102,25 @@ PHP code must follow the [WordPress PHP Coding Standards][wpcs-php].
JavaScript code must follow the [WordPress JavaScript Coding Standards][wpcs-js]. JavaScript code must follow the [WordPress JavaScript Coding Standards][wpcs-js].
Automated linting and formatting will be introduced soon. - Run `composer run format:js` to format all JS files with [Prettier][prettier].
- Run `composer run format:js:fix` to attempt to automatically fix warnings and errors.
- Run `composer run lint:js` to lint all JS files with [ESLint][eslint].
- Run `composer run lint:js:fix` to attempt to automatically fix warnings and errors.
Prettier configuration settings are found in `.prettierrc`.
ESLint configuration settings are found in `.eslintrc.js`. File ignore rules are
found in `.eslintignore`.
### CSS Stylesheets ### CSS Stylesheets
JavaScript code must follow the [WordPress CSS Coding Standards][wpcs-css]. JavaScript code must follow the [WordPress CSS Coding Standards][wpcs-css].
Automated linting and formatting will be introduced soon. - Run `composer run lint:css` to format all CSS files with [stylelint][stylelint].
- Run `npcomposerm run lint:css:fix` to attempt to automatically fix warnings and errors.
stylelint configuration settings are found in `.stylelint.json`.
## Documentation ## Documentation
@ -133,6 +153,9 @@ This project is licensed under the [GNU GPL v3][gpl-v3].
[phpcs]: https://github.com/squizlabs/PHP_CodeSniffer [phpcs]: https://github.com/squizlabs/PHP_CodeSniffer
[wpcs-js]: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/ [wpcs-js]: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/
[wpcs-css]: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/ [wpcs-css]: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/
[prettier]: https://prettier.io/
[eslint]: https://eslint.org/
[stylelint]: https://stylelint.io/
[phpdocumentor]: https://phpdoc.org/ [phpdocumentor]: https://phpdoc.org/
[footnotes-docs]: https://markcheret.github.io/footnotes/ [footnotes-docs]: https://markcheret.github.io/footnotes/
[gpl-v3]: https://www.gnu.org/licenses/gpl-3.0.en.html [gpl-v3]: https://www.gnu.org/licenses/gpl-3.0.en.html