This repository explains our coding standards as well as provides instructions for configuring linters and beautifiers for your IDE.
Linters point out mistakes and issues with your code and can be helpful to spot issues and bugs before they appear.
If you're looking for a quick fix and want to install all the linters you can use:
./install.sh
This will ensure that all the linters are installed correctly and symlink the configuration files to the right place. Click through to the above documentation for instructions on how to configure your IDE.
Remembering code style is boring, beautifiers automatically enforce code formatting.
Once you have run ./install.sh
your installation of PHPStorm should have a new codestyle called Shed
installed. Update preferences to use it:
- Open preferences
- Navigate to code style
- Ensure
Shed
is the selected sceheme for the project - Click OK
In addition, ensure that the correct settings are set for new projects:
- File › Other Settings › Preferences for new projects
- Navigate to code style
- Set
Shed
as the scheme - Click OK
This will run when you invoke code formatting (cmd+alt+l). To do this on save do the following:
- Install
Save Actions
plugin - Configure at
Preferences › Other Settings › Save actions
- Check
Activate save actions on save
- Enable formatting options
- Click OK
Remember and do the same in "Preferences for new projects"
@todo - research plugins and method to automate the configuration, if possible
Atom's atom-beautify package can be used to automatically format on save.
To install, go to your CLI and enter:
apm install atom-beautify
To configure, enter preferences with cmd + ,
and find atom-beautify
in the list.
Make sure Beautify Entire File On Save
is checked.
Go to each of the Javascript
, PHP
and Sass
headers individually and make sure Beautify on Save
is checked.
- In
Javascript
, useESLint Fixer
as the default beautifier - In
PHP
, usePHP-CS-Fixer
as the default beautifier - In
Sass
, useSassConvert
as the default beautifier