New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint-staged will execute "Stashing changes" logic even if no lint-staged.conf.js files are changed or staged #570
Comments
That should definitely not stash changes that aren’t part of the config. It looks like the logic should take care of the glob matching before the decision of stashing is made. I’m okay to accept a PR that implements this. |
I'm looking into this issue now, will put up a PR when it's ready. |
- add test to check if stashing is skipped if no lint-staged files are changed Fixes lint-staged#570
My PR is submitted and ready for review! |
…ly" from "it.only" Fixes lint-staged#570
…ed is skipped and update snapshots Fixes lint-staged#570
* fix: add check for changed lint-staged files before stashing changes - add test to check if stashing is skipped if no lint-staged files are changed Fixes #570 * fix: simplify implementation, add comment as requested and remove "only" from "it.only" Fixes #570 * fix: update test snapshot for "runAll should resolve the promise with no files" as stashing/linters are no longer executed if no staged files match the linters configuration * fix: replace Array.forEach with Array.every, add message if lint-staged is skipped and update snapshots Fixes #570 * fix: remove "No linters executed" and "in lint-staged.linters" copy
🎉 This issue has been resolved in version 8.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
In our repository we have Java code and front-end code such as TypeScript/SCSS etc.
We do not want any of our frontend tools to get in the way of our Java developers or make their development experience worse.
However, currently if a Java dev stages some code while leaving some other code unstaged, they end up hitting some special behaviour where lint-staged takes up to 90-120 seconds stashing changes.
I feel this shouldn't occur because my lint-staged config only targets *.ts, *.tsx and *.scss files. It does not have any rules regarding *.java files. Is it possible to make sure that the staged files match at least one of the linters before doing this stashing logic?
I say this because there are also cases where a Java dev might have some *.ts files modified on their local machine that are unstaged. If they're only committing *.java files, then the linter shouldn't kick in.
Steps to reproduce
lint-staged.conf.js
Example of Git status:
Stage a hunk of a file that is not configured in the lint-staged.conf.js file.
Debug Logs
Note: Pathnames have been obfuscated.
Environment
lint-staged
: v8.1.0The text was updated successfully, but these errors were encountered: