Skip to content

Commit 43d592f

Browse files
authored
Add precommit hook to run lint command (opensearch-project#201)
* add precommit hook to run lint command Signed-off-by: CCongWang <wangcong@umich.edu> * update the formatting section in CONTRIBUTING Signed-off-by: CCongWang <wangcong@umich.edu>
1 parent 9524a41 commit 43d592f

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ and auto fix the formatting of all files (new and existing) by running
9494
$ yarn lint --fix
9595
```
9696

97-
This should be done before opening a PR to keep checked-in code consistent.
97+
`Husky` precommit hook is used to automatically run `yarn lint`, please fix the files according to lint result before commiting code changes (run `yarn lint --fix` for fixable errors, or manully fix code according to error messages). If you have any doubts on `ESLint` rules, feel free to [open an issue](issues).
9898

9999
### Onboarding
100100

package-lock.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"eslint-config-prettier": "^8.5.0",
4747
"eslint-plugin-cypress": "^2.12.1",
4848
"eslint-plugin-prettier": "^4.0.0",
49+
"husky": "^6.0.0",
4950
"mocha-junit-reporter": "^2.0.0"
5051
}
5152
}

0 commit comments

Comments
 (0)