Skip to content

Commit

Permalink
chore: add husky and commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
bartkownacki committed Aug 24, 2023
1 parent 5ed6755 commit 20b1ab5
Show file tree
Hide file tree
Showing 6 changed files with 908 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
dist
commitlint.config.js
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit "${1}"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged --relative
7 changes: 7 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [2, 'always', '500'],
'header-case': [1, 'always', 'lower-case'],
},
};
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@
"build": "rimraf dist && yarn build:cjs && yarn build:esm",
"build:cjs": "rimraf dist/cjs && tsc -p tsconfig.cjs.json && yarn copy:templates:cjs",
"build:esm": "rimraf dist/esm && tsc -p tsconfig.esm.json && yarn copy:templates:esm",
"lint": "eslint .",
"lint:eslint": "eslint .",
"lint:prettier": "prettier -c '**/*.{js,jsx,ts,tsx,json,md,css,scss,html}'",
"copy:templates:cjs": "cp -r ./src/templates ./dist/cjs/src/templates",
"copy:templates:esm": "cp -r ./src/templates ./dist/esm/src/templates",
"test": "jest"
"test": "jest",
"prepare": "husky install"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"npm run lint:eslint -- --fix --cache --cache-location tmp/.eslintcache ",
"npm run lint:prettier -- --write "
],
".circleci/config.yml": "circleci config validate"
},
"dependencies": {
"chalk": "4.1.2",
Expand All @@ -39,6 +48,8 @@
},
"devDependencies": {
"@actions/core": "1.10.0",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@types/chalk": "^2.2.0",
"@types/commander": "^2.12.2",
"@types/jest": "^29.5.3",
Expand All @@ -51,7 +62,9 @@
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
"fs-extra": "10.1.0",
"husky": "^8.0.3",
"jest": "^29.6.1",
"lint-staged": "^14.0.1",
"prettier": "2.8.1",
"rimraf": "^5.0.1",
"semver": "7.3.8",
Expand Down
Loading

0 comments on commit 20b1ab5

Please sign in to comment.