Clarify `gitDir` usage?
See original GitHub issueI spent quite some time trying to figure out why my lint-staged config didn’t work:
"lint-staged": {
"gitDir": "../",
"linters": {
"src/**/*.{js,jsx,json}": [
"prettier-eslint --write --single-quote",
"git add"
]
}
},
Then I tried to define packages/myapp/src/**/*{js,jsx,json}
and it worked.
May you add somewhere in the README this information? (that any pattern must use as root the ones defined as gitDir
)
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
git --git-dir not working as expected - Stack Overflow
I got tripped trying to use the -C flag after the git command (e.g. git status -C <path> won't work!) – Kedar Paranjape....
Read more >git init | Atlassian Git Tutorial
git init creates a new Git repository, can be used to convert an existing, unversioned project to a Git repo, or initialize a...
Read more >git-worktree Documentation - Git
Use git rev-parse --git-path to get the final path. If you manually move a linked worktree, you need to update the gitdir file...
Read more >Tweak your Git config for multiple user IDs - Opensource.com
This directive supports three keywords: gitdir , gitdir/I , and onbranch . I will briefly explain gitdir , which I use in the...
Read more >The best way to store your dotfiles: A bare Git repository ...
It uses a bare repository in a novel way, by configuring $HOME as the work tree ... 2. alias config='/usr/bin/git --git-dir=$HOME/.cfg/.git/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just tested this out and I think the current behavior needs to be changed. When I am defining the
lint-staged
config inside a package, I shouldn’t have to think about relative paths from a parent folder. And I like the idea of automatically detecting the git directory. That should kill a ton of birds in one shot 😛Apologies, I somehow missed replying to this. Since release notes serve as our migration guide, it would make sense to show all the changes required for upgrading to
lint-staged@5
. I have updated the release notes, please take a look.If you want to include this information in the readme as well, let me know. I can make a PR.