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
Running Lint-staged from within a sub directory #65
Conversation
… properly when the working directory is a subdirectory of the git root
Tweak readme a bit
Move some information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I'll need to add tests for this part as well ASAP though.
// If current working directory is not the git root -> resolve file paths accordingly | ||
if (sgf.cwd !== process.cwd()) { | ||
var relpath = path.relative(process.cwd(), sgf.cwd) + '/' | ||
for (var i in fileList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on Windows I guess. Let's remove /
and just use path.resolve
that accepts Array<string>
.
if (sgf.cwd !== process.cwd()) { | ||
var relpath = path.relative(process.cwd(), sgf.cwd) + '/' | ||
for (var i in fileList) { | ||
fileList[i] = path.resolve(relpath + fileList[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this should become
path.resolve(relpath, fileList[i])
Awesome! Thank you! I'll ask @ai to test with his setup. |
Wow! Great work. I will try it in Wednesday (moving to next city :( ) |
It doesn’t work :(. I tested lint-staged from master:
|
Ouh, I forgot about |
I've renamed the option to |
Released as 3.1.0: https://github.com/okonet/lint-staged/releases/tag/3.1.0 |
I've added the possibility to set the git-root which if set will be used to resolve the filepaths accordingly
this should fix: #41