Last active
          March 3, 2020 11:26 
        
      - 
      
- 
        Save bearzk/a4fb6842dbe752c6fa5fc4b9db884e8e to your computer and use it in GitHub Desktop. 
    [lintStaged] #bash #lint
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/sh | |
| # this script will run eslint against staged files | |
| # in staged flies | |
| # find (M)odified and (A)dded file names, | |
| # find those conotains "src" or "test" | |
| toLint=$(git diff --name-status --cached | grep -E "^[M|A]" | awk '{print $2}' | grep -E "src|test") | |
| if [ -z "$toLint" ]; then | |
| echo "no need to do lintng." | |
| exit 0 | |
| fi | |
| echo "checking ${toLint}" | |
| npx eslint $toLint | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment