Skip to content

Commit

Permalink
feat: add husky and lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
shijistar committed May 3, 2024
1 parent 37c71fc commit 9bc1c7e
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 11 deletions.
12 changes: 12 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "\033[36m Linting code... \033[0m"

npx --no-install lint-staged

sleep 0.3
echo "\033[32m Linting passed! \033[0m"
echo

sleep 1
6 changes: 2 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@
"importOrderSortSpecifiers": true,
"importOrderGroupNamespaceSpecifiers": true,
"importOrderCaseInsensitive": true,
"jsdocParser": true,
"jsdocSingleLineComment": false,
"jsdocSeparateReturnsFromParam": true,
"jsdocSeparateTagGroups": true,
"jsdocCapitalizeDescription": false,
"jsdocPrintWidth": 60,
"jsdocPrintWidth": 80,
"overrides": [
{
"files": [".prettierrc", ".eslintrc", ".babelrc"],
"files": [".prettierrc", ".eslintrc"],
"options": {
"parser": "json"
}
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@
],
"scripts": {
"build": "father build",
"prepare": "husky",
"prepublishOnly": "npm run build"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --fix",
"*.{js,jsx,ts,tsx,md}": "prettier --write"
},
"dependencies": {
"@inquirer/prompts": "^5.0.2",
"colors": "^1.4.0",
"axios": "^1.6.8",
"colors": "^1.4.0",
"commander": "^12.0.0",
"cross-spawn": "^7.0.3",
"prettier": "^3.2.5",
Expand All @@ -58,6 +63,7 @@
"eslint-plugin-prettier": "^5.1.3",
"father": "^4.4.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-packagejson": "^2.5.0"
},
Expand Down
Loading

0 comments on commit 9bc1c7e

Please sign in to comment.