Skip to content

Commit

Permalink
fix: cli-style commit hooks (#520)
Browse files Browse the repository at this point in the history
* fix: added lint and commit message hooks using cli-style and husky

* fix: added prettier ignore to prevent future errors
  • Loading branch information
martinkrulltott authored Dec 12, 2019
1 parent 57ca3a7 commit f5bdc85
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { config } = require('@dhis2/cli-style');
const husky = require(config.husky);

module.exports = {
hooks: {
...husky.hooks,
'pre-commit': 'yarn validate-commit',
'pre-push': 'yarn validate-push',
},
};
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/*
/i18n/*
/public/*
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"analyze": "source-map-explorer 'build/static/js/*.js'",
"prestart": "npm run extract-pot && npm run localize && npm run manifest",
"start": "react-scripts start",
"lint": "eslint -c .eslintrc.js src",
"lint": "d2-style js check || d2-style text check",
"format": "d2-style js apply || d2-style text apply",
"coverage": "npm test -- --coverage",
"prebuild": "rm -rf build && mkdir build && npm run manifest && npm run localize",
"build": "PUBLIC_URL=. react-scripts build",
Expand All @@ -52,12 +53,9 @@
"eject": "react-scripts eject",
"manifest": "d2-manifest package.json ./public/manifest.webapp --manifest.activities.dhis.href=${REACT_APP_DHIS2_BASE_URL:=..}",
"extract-pot": "d2-i18n-extract -p src/ -o i18n/",
"localize": "d2-i18n-generate -n dashboards-app -p ./i18n/ -o ./src/locales/"
},
"husky": {
"hooks": {
"pre-commit": "yarn extract-pot && CI=true yarn test && git add ./i18n/"
}
"localize": "d2-i18n-generate -n dashboards-app -p ./i18n/ -o ./src/locales/",
"validate-commit": "d2-style js check --staged && d2-style text check --staged && yarn extract-pot && git add ./i18n/",
"validate-push": "CI=true yarn test"
},
"manifest.webapp": {
"name": "Dashboards app",
Expand Down

0 comments on commit f5bdc85

Please sign in to comment.