1.7.1 • Published 7 years ago
@dhis2/code-style v1.7.1
code-style
DHIS2 JavaScript code style
Applies our configuration for:
- Git commit messages
- Prettier
- Browserslist
Usage
Yarn
yarn add -D @dhis2/code-styleNPM
npm install --save-dev @dhis2/code-styleAdd script
Add this to package.json in the script part:
{
scripts: {
"format": "code-style"
}
}Add pre-commit hook for commit-style
Install Husky or other hook handler:
npm install husky --save-devAdd 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).