README
code-style
DHIS2 JavaScript code style
Applies our configuration for:
- Git commit messages
- Prettier
- Browserslist
Usage
Yarn
yarn add -D @dhis2/code-style
NPM
npm install --save-dev @dhis2/code-style
script
Add Add this to package.json
in the script part:
{
scripts: {
"format": "code-style"
}
}
commit-style
Add pre-commit hook for Install Husky or other hook handler:
npm install husky --save-dev
Add prop to package.json
:
"husky": {
"hooks": {
"commit-msg": "commit-style",
"pre-commit": "code-style"
}
}
Run the format
script to apply our common JS standards.
Migrating from custom configs
Existing configuration in e.g. .prettierrc
, et. al. can
be removed as they will be overridden by the configuration bundled with
code-style
anyway.
Any dependencies to Prettier can also be removed.
Works with CRA (with or without ejecting).