-
Notifications
You must be signed in to change notification settings - Fork 208
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
gts does not work in a yarn workspaces monorepo #490
Comments
Experienced the same issue. The |
To easily reproduce the issue I created a repro: https://github.com/darkbasic/apollo-monorepo |
This is definitely a regression. GTS v 1 was able to find hoisted tslint, but now GTS 3 can't find hoisted eslint. Can we get this fixed as this impedes anyone with a monorepo from properly migrating from tslint to eslint linting? Nohoist is not a recommendation and should really be avoided for both file size and the fact that yarn explicitly says its a bad idea |
Greetings folks - we don't actively use Yarn, and I don't have any immediate plans to do work here. However - I would happily accept a PR! |
Rationale: - `npm install`, `yarn` and `lerna` all fill out `node_modules/.bin` - But `node_modules/eslint` isn't necessarily present. - This should fix issue google#490.
Rationale: - `npm install`, `yarn` and `lerna` all put an eslint bianry in `node_modules/.bin`, even though they may not create `node_modules/eslint` (if it happens to be hoisted into a parent directory). - This should fix issue google#490.
Rationale: - npm and Yarn both put (a directory containing) the eslint binary on PATH during "npm run foo", so take advantage of that to invoke eslint in a way that is compatible with Yarn workspaces. - (Node that `node_modules/eslint/...` may not exist, because the module may have been installed in another `node_modules` further up the filesystem tree. Yarn does ensure that the binary gets symlinked into `node_modules/.bin`.) - This should fix issue google#490.
This is failing for me as well with npm's workspace functionality, FYI. Thanks for the |
I found it easier to just rip out GTS completely and use eslint/prettier normally. Then everything works just fine in a monorepo and you have more control of your lint rules. if you want to start with the gts rules you totally can just by grabbing their eslint configurations. Going the nohoist route is a big hammer to a lint problem since nohoist means you're going to duplicate all your node modules |
I actually ended up doing this since npm workspaces doesn't have nohoist as an option, so I was stuck. I just removed the |
Rationale: - npm and Yarn both put (a directory containing) the eslint binary on PATH during "npm run foo", so take advantage of that to invoke eslint in a way that is compatible with Yarn workspaces. - (Node that `node_modules/eslint/...` may not exist, because the module may have been installed in another `node_modules` further up the filesystem tree. Yarn does ensure that the binary gets symlinked into `node_modules/.bin`.) - This should fix issue google#490.
A workaround: yarn config set nodeLinker node-modules or add this to nodeLinker: node-modules then run: yarn Sourced from https://stackoverflow.com/a/60043794 |
I noticed that gts fix and gts link wasn't working in the npm workspaces. This is related to the issues: gts monorepo does not work with npm ? google/gts#752 gts does not work in a yarn workspaces monorepo google/gts#490 The last issue is with yarn but has more discussion. One solution was using nohoist. This is not a default option with npm. So I tried with the following package https://github.com/zgriesinger/noist. But this did not fix the errors. The last solution mentioned was only linting from the root level; this works. I have also subscribed to the issue [feature] support npm workspaces. There may be a better solution in the future.
Rationale: - npm and Yarn both put (a directory containing) the eslint binary on PATH during "npm run foo", so take advantage of that to invoke eslint in a way that is compatible with Yarn workspaces. - (Node that `node_modules/eslint/...` may not exist, because the module may have been installed in another `node_modules` further up the filesystem tree. Yarn does ensure that the binary gets symlinked into `node_modules/.bin`.) - This should fix issue #490.
For me gts 5.2.0 with #654 fixes the problem. I think this bug can be closed. |
In order to make it work you have to
nohoist
bothgts
andeslint
.The text was updated successfully, but these errors were encountered: