Apply linter pre-commit hook only to Added/Copied/Modified
it will fail on deleted/renamed files. Change-Id: I4285f0f9ccc4f2b6c875816c4df25a15fd20222b
This commit is contained in:
parent
79070a7adb
commit
abf0489e74
@ -31,7 +31,7 @@ gitroot=${gitroot:-.};
|
|||||||
eslint=${gitroot}/node_modules/eslint/bin/eslint.js
|
eslint=${gitroot}/node_modules/eslint/bin/eslint.js
|
||||||
|
|
||||||
# Run eslint over changed frontend code
|
# Run eslint over changed frontend code
|
||||||
CHANGED_UI_FILES=$(git diff --cached --name-only -- '*.js' '*.html' | grep 'polygerrit-ui') && true
|
CHANGED_UI_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.js' '*.html' | grep 'polygerrit-ui') && true
|
||||||
if [ "${CHANGED_UI_FILES}" ]; then
|
if [ "${CHANGED_UI_FILES}" ]; then
|
||||||
if $eslint --fix ${CHANGED_UI_FILES}; then
|
if $eslint --fix ${CHANGED_UI_FILES}; then
|
||||||
# Add again in case lint fix modified some files
|
# Add again in case lint fix modified some files
|
||||||
|
Loading…
Reference in New Issue
Block a user