web_development:precommit

pre-commit

https://gist.github.com/kentcdodds/9768d9a8d0bfbf6797cd

#!/bin/bash

for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
  git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
  if [ $? -ne 0 ]; then
    echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
    exit 1 # exit with failure status
  fi
done

https://gist.github.com/dahjelle/8ddedf0aebd488208a9a7c829f19b9e8

https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8

  • web_development/precommit.txt
  • Last modified: 2019/04/09 22:55
  • by 108.225.197.92