-
Notifications
You must be signed in to change notification settings - Fork 341
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
Not working with eslint-plugin-import and yarn 3 #1494
Comments
@brunomacf according to the yarn documentation you need to run VS Code then runs eslint from I have to admit that I am not a super expert with I am absolutely open for tip on how to improve this for VS Code. |
@dbaeumer I don't understand what is going on tbh. If i remove all |
It’s because the import plugin relies on the proper way to resolve things - ie, what node ships - and since pnp breaks this, pnp and the import plugin can’t be used together unless pnp’s workarounds are employed. |
@ljharb then why eslint-plugin-import work just fine when i run eslint from command line with |
Because then you’re invoking it with yarn, so yarn is able to hack the runtime to make it work - the editor doesn’t invoke eslint with yarn, it invokes it directly. If you ran |
@ljharb thanks for helping me out here. @brunomacf one thing you can do is to setup a task that runs eslint through yarn. This would not give you the live feedback but would benefit from yarn setting up the runtime correctly. Since there is little the extension can do to fix this are you OK to close the issue? I would actually recommend to reopen the issue with the |
I think this remains an issue with yarn pnp, tbh, but happy to discuss it on that issue as well. |
Did you try https://github.com/import-js/eslint-import-resolver-typescript? I've just added PnP support at import-js/eslint-import-resolver-typescript#133 to fix import-js/eslint-import-resolver-typescript#130 like this |
@JounQin i guess it's release yet right? I just upgraded eslint-import-resolver-typescript to As you can see vscode-eslint doesn't even complain about the |
@brunomacf Oh, sorry, so the resolving seems working but |
Maybe you should post an issue to https://github.com/yarnpkg/berry/blob/HEAD/packages/yarnpkg-sdks instead? It's not |
@JounQin i've already run |
It doesn't patch |
@JounQin and as i mentioned above the weird thing is: if i run |
@JounQin Indeed maybe yarn-sdks is not patching it correctly on vscode... I'm going to post this issue there!! 👍 |
As I mentioned at #1494 (comment) It's |
I think I'm also experiencing this same issue. I noticed in the VSCode ESLint Output channel, it shows this error:
I also ended up applying a similar fix to kriasoft/react-starter-kit#1984 to exclude the import/* plugins when running inside VSCode. I also suspect (but can't confirm) this problem may be the root cause of import-js/eslint-import-resolver-typescript#163, which causes VSCode to get stuck while trying to save a file. |
I investigated further and found that specific error I posted above comes from within synckit (a dependency of eslint-import-resolver-typescript), and is thrown from the worker thread it tries to create. The import resolver is passing synckit the fully resolved path to worker.mjs, which is correctly resolved to be within the zip file by Yarn PnP. In my case, that's:
With Yarn PnP setup performed, if you give a path like this to I found yarnpkg/berry#2476 which appears to be about |
In my testing, this issue has been resolved by updating to synckit 0.8.3. Thanks to un-ts/synckit#98 and un-ts/synckit#103 |
@brunomacf Can you help to test whether it's working as expected after upgrading? All you need to do is |
I will close the issue since according to the latest comments it got solved in the plugin. |
I'm not sure if this is an issue with eslint-plugin-import or vscode-eslint itself but i created this repo https://github.com/brunomacf/vscode-eslint-yarn-berry reproducing the issue. If i open src/index.ts in vscode i don't see any lint errors (i do see the correct errors when i totally remove the eslint-plugin-import settings from .eslintrc.js config file). But if i run lint manually through yarn lint i see the lint errors just fine (bellow is a screenshot showing on the left the result of yarn lint on the left and on the right vscode showing no lint errors). Any ideas? PS.: I created a similar issue in eslint-plugin-import here
The text was updated successfully, but these errors were encountered: