Skip to content

Instantly share code, notes, and snippets.

@javascripto
Created June 7, 2020 14:34
Show Gist options
  • Select an option

  • Save javascripto/8433d135bda0fdc2d550a25fe97cc4cc to your computer and use it in GitHub Desktop.

Select an option

Save javascripto/8433d135bda0fdc2d550a25fe97cc4cc to your computer and use it in GitHub Desktop.
Angular lint staged
#!/bin/bash
lint-staged() {
# ng lint --files $(git diff --name-only --cached | tr '\n' ' ')
staged_files=$(git diff --name-only --cached)
staged_files_inline=$(echo $staged_files | tr '\n' ' ')
command="ng lint --files $staged_files_inline"
# if not null
if [ ! -z "$staged_files" ]; then
echo $command # $(echo command) # executa
fi
}
lint-staged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment