Comments (4)
Is lint-staged not matching against deleted files?
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 src/**/*
.
This is not good because it means if I delete files in src/
they lint-staged is silently failing to run needed scripts (f.e. a build script needs to update dist/ based on src/).
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).
from lint-staged.
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).
from lint-staged.
You can try overriding the default --diff-filter
option to also include deleted files.
EDIT: from the readme:
--diff-filter: By default only files that are added, copied, modified, or renamed are included. Use this flag to override the default ACMR value with something else: added (A), copied (C), deleted (D), modified (M), renamed (R), type changed (T), unmerged (U), unknown (X), or pairing broken (B). See also the git diff docs for --diff-filter.
from lint-staged.
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.
from lint-staged.
Related Issues (20)
- Hard to understand stashing behavior HOT 2
- Case sensitivity in finding .git root folder HOT 3
- firebase emulator is not running by lint-staged HOT 8
- SyntaxError: Named export 'getStreamAsBuffer' not found HOT 2
- "No files matching the pattern ... was found" when using ESLint flat configuration file format HOT 2
- No staged files found HOT 2
- Script fails when using grouped layouts in Next.js HOT 5
- High vulnerability in 'braces' dependency HOT 3
- Add flag to simplify testing `lint-staged` integration HOT 2
- Silent failure of configuration loading HOT 2
- 'lint-staged' will not restore changes if there's an error or the script is halted HOT 4
- Monorepo and different `.lintstagedrc.json` configuration files HOT 2
- WSL incorrect resolveGitRepo: Current directory is not a git directory HOT 5
- Issue: Targeted files skip tsconfig HOT 1
- Failing to get staged files on 15.2.6 HOT 11
- Version 12+ results in exit code 1 instead of working HOT 2
- Fail to find git dir with git "rev-parse" HOT 1
- The 'File Ignored' warning is still a big problem HOT 1
- 'Integrate with Next.js' not working properly without '--dir' in monorepo.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lint-staged.