-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add pre-commit hook that does eslint before commit only on files that has been changed #15753
base: develop
Are you sure you want to change the base?
Conversation
|
||
if ! bash "$script_dir/eslint.sh"; then | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jvaclavik you can add precommit hook for commit message after that here. I tried and got some ugly error so I leave it to you :D
dd1acde
to
f8d742c
Compare
@@ -84,17 +85,8 @@ | |||
"ios": "yarn native:ios", | |||
"p": "yarn native:prebuild", | |||
"ports": "yarn native:reverse-ports", | |||
"s": "yarn native:start" | |||
}, | |||
"lint-staged": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to me as dead code. I have checked the lint-staged library and I do not think we need it. The simple script shall work the same way. Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I came across lint-staged
I tried to make it work, but didn't succeed.
|
||
script_dir=$(dirname "$(realpath "$0")") | ||
|
||
if ! bash "$script_dir/eslint.sh"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also prettier
shall be somehow added
🚀 Expo preview is ready!
|
.husky/eslint.sh
Outdated
@@ -0,0 +1,23 @@ | |||
#!/bin/bash | |||
|
|||
STAGED_FILED=$(git diff --cached --name-only --diff-filter=d | grep '(\.js\|\.jsx$\|\.ts\|\.tsx)$') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo (FILED)
ff6b39f
to
fbf38a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that has been changed
fbf38a2
to
37e503d
Compare
@@ -19,7 +19,7 @@ | |||
}, | |||
"scripts": { | |||
"_______ Hooks _______": "Yarn hooks.", | |||
"postinstall": "yarn run patch-package", | |||
"postinstall": "yarn run patch-package && husky", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Yarn doesn't support `prepare`
See: https://typicode.github.io/husky/how-to.html#manual-setup
Some reads on topic: