Skip to content

Instantly share code, notes, and snippets.

@danielmcq
Forked from namnm/eslint.sh
Created August 28, 2018 20:44
Show Gist options
  • Save danielmcq/fef2e62bb43b8bcac87da673676933a8 to your computer and use it in GitHub Desktop.
Save danielmcq/fef2e62bb43b8bcac87da673676933a8 to your computer and use it in GitHub Desktop.
Do eslint only changed files
# The regexp without escapse is ^[^D]{2}.*((.js)|/)$ with:
# [^D]{2} means that's not a deleted file from git output
# .* is the file name
# ((.js)|/) means it's end with .js extension, or a slash (directory)
# To use in package.json, we need to double the escapse: ^[^D]\\{2\\}.*\\(\\(\\.js\\)\\|/\\)$ pretty neat huh?
git status --porcelain | grep '^[^D]\{2\}.*\(\(\.js\)\|/\)$' | cut -c 4- | xargs eslint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment