-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
Fix for working in subdir #78
Conversation
…irectory differs from the current working directory
@@ -5,6 +5,6 @@ const path = require('path') | |||
module.exports = function resolvePaths(filePaths, relativeTo) { | |||
return filePaths.map((file) => { | |||
if (!relativeTo) relativeTo = process.cwd() // eslint-disable-line | |||
return path.resolve(process.cwd(), relativeTo, file.filename) | |||
return path.resolve(process.cwd(), path.relative(process.cwd(), relativeTo), file.filename) |
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.
Do you need the first process.cwd()
here?
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.
Can you also add a test and update the README for that?
@@ -35,7 +35,7 @@ cosmiconfig('lint-staged', { | |||
console.error(err) | |||
} | |||
|
|||
const tasks = generateTasks(config, resolvePaths(files)) | |||
const tasks = generateTasks(config, resolvePaths(files, sgf.cwd)) |
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.
Can we set the cwd
as a constant in the beginning and reuse? Don't like the coupling with another lib here.
cleanup path resolving Todo: create test and run tests
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!
@TheWolfNL It says "WIP" — are you still doing some more work on this? |
i'm planning on creating a test this weekend, didn't have time to test this yet. |
@okonet I thought there were no tests written for the nested config yet, but apparently you've already wrote those 👍 |
Fix so the paths will be properly resolved and working when the git directory differs from the current working directory