A collection of snippets we use to help enforce certain coding standards. Based off our blog post https://www.selesti.com/blog/how-selesti-handle-their-code-standards
It will not be suitable for everybody, but its tuned for our laravel 5 projects on macOS which we use sass.
It assumes you have eslint, sass-lint, phpcs installed and accessibly globally. Additionally we have a bitbucket pipeline check.
- Make sure you have
eslint
installed globally, confirm withwhich eslint
or install withnpm install eslint -g
- Make sure you have
sass-lint
installed globally, confirm withwhich sass-lint
or install withnpm install sass-lint -g
- Make sure you have
php
installed globally, confirm withwhich php
- Make sure phpcs is included with your project e.g
composer require squizlabs/php_codesniffer
or globally (update the git hooks)
- Add the contents of the
scripts
array into yourcomposer.json
- this contains some helpers likecomposer run clean
,composer run psrcheck
etc - Copy the "git-hooks" folder to your project root, then install them by typing
composer run githooks
this will symlink them so they run automatically when you pull or push - Place the rest of the rule files in the root of your project
- You can edit the rule files to suit yourself
- You can update the paths inside the git-hooks folder
Any questions just add an issue and we'll get back to you when possible!