I want to run tslint
only on files that were modified in a pull request, instead of the entire project.
git diff --name-only develop -- *.ts
successfully prints out the filenames that have changed between the feature branch and develop.
I'm trying to pipe that command into my lint command. Lint can take in a list of files to run against instead of running against everything by placing the filenames after:
git diff --name-only develop -- *.ts | npm run lint
This works on our Jenkins box, but on my local Windows machine no text gets appended to the end of the lint command.
C:\code>git diff --name-only develop-- *.ts | npm run lint
tslint -c .\tslint.json -p .\tsconfig.json
Is there a simple one line method that will only run lint on changed files in a branch?
I got a list of modified files by running
git diff --name-only --diff-filter=ACMR origin/dev-123...develop -- *.ts
Where origin/dev-123
is the source branch and develop
is the destination.
I put the output of that command into an array, and ran the linter against the array of files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With