-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
- I'd be willing to implement a fix
Describe the bug
When using workspaces, running a binary in workspace-b from workspace-a does not carry the resolution context of workspace-a with it. This means that if I have a tool that can require plugins, I have to specify them in the packageExtensions in .yarnrc.yml rather than as dependencies of workspace-a.
I suspect that this may be a similar issue to #1058
Background
To Reproduce
I have created a minimal example repository at https://github.com/andypalmer/yarn2_tool_plugin_issue
Environment if relevant (please complete the following information):
- OS:
OSX Darwin 18.7.0 - Node version:
12.16.1 - Yarn version:
2.0.0-rc.31(via1.22.4)
Additional context
I have custom formatters for eslint and jshint. The current jshint resolution logic requires us to specify custom formatters by relative path from the script execution context (e.g. --reporter node-modules/jshint-junit-formatter/reporter.js). I patched jshint to not force reporter to require relative paths, but when jshint is executed from my patched-jshint workspace, it can't see my formatter because it's defined as a devDependency of the app that I'm checking, not as a dependency of jshint.
eslint is able to access the custom formatters via PnP resolution, so it appears to only affect resolution when the binary doing the require is one of my workspaces.
While I could add the dependency to the jshint-patched workspace, this isn't really in keeping with either the idea of plugins, or in making the patches absolutely minimal.