Skip to content

Commit

Permalink
add husky to run tests, format and lint code on commit (Codecademy#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeecart authored Jan 5, 2022
1 parent e3326d4 commit c89cf26
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +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 --allow-empty
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,35 @@
"@codecademy/eslint-config": "^3.1.0",
"@codecademy/prettier-config": "^0.1.10",
"@codecademy/tsconfig": "^0.2.0",
"@types/jest": "^26.0.24",
"@types/glob": "^7.1.4",
"@types/jest": "^26.0.24",
"@types/node": "^16.4.3",
"eslint": "^7.25.0",
"husky": "^7.0.4",
"jest": "^27.0.6",
"lint-staged": "^12.1.2",
"markdownlint-cli": "~0.28.1",
"prettier": "^2.2.1",
"ts-jest": "^27.0.4",
"typescript": "^4.2.4"
},
"lint-staged": {
"*.md": [
"npm run format",
"markdownlint"
]
},
"scripts": {
"compile": "tsc --noEmit",
"format": "prettier --ignore-path .prettierignore --write",
"format:md": "prettier --ignore-path .prettierignore --write \"./**/*.(md)\"",
"format:all": "prettier --ignore-path .prettierignore --write \"./**/*.(ts|md)\"",
"format:verify": "prettier \"./**/*.(ts|md)\" --list-different",
"lint:js": "eslint \"./**.ts\" --max-warnings 0 ",
"lint:md": "markdownlint \"./content/**/*.md\"",
"lint": "yarn lint:md && yarn lint:js",
"test": "jest"
"test": "jest",
"prepare": "husky install"
},
"license": "UNLICENSED",
"version": "1.0.0"
Expand Down

0 comments on commit c89cf26

Please sign in to comment.