Skip to content

Commit

Permalink
Merge pull request #692 from bweis/husky
Browse files Browse the repository at this point in the history
Add lint_staged to auto run eslint and prettier upon commit
  • Loading branch information
kddnewton authored Jul 7, 2023
2 parents 645fdbc + ea09fe8 commit cef22c9
Show file tree
Hide file tree
Showing 4 changed files with 571 additions and 262 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
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "src/plugin.js",
"scripts": {
"lint": "eslint --cache .",
"prepare": "node bin/languages.js",
"prepare": "node bin/languages.js && husky install",
"print": "prettier --plugin=.",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
},
Expand All @@ -27,8 +27,10 @@
"devDependencies": {
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.0.0",
"husky": "^8.0.0",
"jest": "^29.2.1",
"linguist-languages": "^7.21.0"
"linguist-languages": "^7.21.0",
"lint-staged": "^13.2.3"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -60,5 +62,11 @@
"./src/plugin.js"
],
"trailingComma": "none"
},
"lint-staged": {
"*.js": [
"eslint --cache --fix",
"prettier --write"
]
}
}
Loading

0 comments on commit cef22c9

Please sign in to comment.