-
Notifications
You must be signed in to change notification settings - Fork 46
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: eslint module path resolver for yarn workspaces #42
Conversation
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.
Please add some tests.
package.json
Outdated
"pify": "3.0.0", | ||
"resolve-from": "4.0.0", |
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.
Please do not se this module; you should be able to achieve this with resolve
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.
Oh and that is your module, I see.
Starting from node 8.9 adding lookup paths is available in core. Does it fall back to the built-in fn?
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.
I maintain it; I didn't create it.
No, it doesn't fall back to the built in function, but that's an implementation detail.
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.
tomato potato. Jest actually comes with it's own jest-resolve
package which seems to be a fork of substack/node-resolve.
They did not write docs about it at all, so i would refrain from using that anyhow.
It's using Should i do the work and add a proper integration test to check my mono-repo scenario? |
I think it’s fine to add a fake node_modules and package.json into the repo inside the tests dir |
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.
Thanks, this looks good overall - but we do indeed want a test of your use case :-)
const requiredESLint = require('eslint'); | ||
|
||
it('requires eslint', () => { | ||
// eslint-disable-next-line global-require |
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 override shouldn’t be needed?
}); | ||
|
||
it('finds eslint with custom rootDir', () => { | ||
// eslint-disable-next-line global-require |
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.
Nor this one?
@igl Why is this PR stuck? Can I help somehow? I'm also waiting for this to work with yarn workspaces. :) |
@igl are you no longer interested in pursuing this? |
can't eslint solve this? |
Instead of looking for the closest node_modules, it will resolve the path like require.resolve() starting from config.rootDir.
Fixes #41
All tests pass
Rejoice