-
-
Notifications
You must be signed in to change notification settings - Fork 412
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 does not detect changed files, skips scripts #1415
Comments
Yep, that's the problem. lint-staged is not matching against files that have been deleted. I verified by making a modification to another file in src/, and then it runs the scripts for This is not good because it means if I delete files in This can lead to unexpectedly publishing versions of packages on npm with dist/ folder in incorrect state (and most people are probably not going to test deletion-only commits to realize lint-staged is ignoring them). |
For now the workaround is I found some other file I could make a change to (without deleting). Now I just need to try and remember this each time I commit; the only reason I discovered it was because I was investigating why the build wasn't outputting certain files, then I decided to test the commit to ensure a version update would include files and discovered the additional lint-staged issue (first my build was discluding some files). |
You can try overriding the default EDIT: from the readme:
|
We don't include deleted files by default because the most common linters ESLint and Prettier don't really work when supplied paths that don't exist anymore. |
Description
lint-staged is not running scripts for modified files.
Steps to reproduce
Here's my husky `pre-commit` hook:
Here's my `.lintstagedrc.js` file:
Here's my husky `pre-commit` hook:
Debug Logs
Here's the output of `git commit`, which includes all output from the pre-commit hook, lint-staged, and the post-commit hook
In particular I see this:
and you can see in the
git status
output some stuff like this:so I am expecting
src/**/*
to match. It looks like thepackages/**/*
pattern is being matched, but thesrc/**/*
pattern is not. I expected lint-staged to fail due to theexit 1
it should run forsrc/**/*
.Is lint-staged not matching against deleted files?
Environment
lint-staged
: 15.2.2The text was updated successfully, but these errors were encountered: