Skip to content
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

Does not resolve eslint library for yarn2 projects #46

Closed
darce2 opened this issue Feb 7, 2020 · 5 comments · Fixed by #48
Closed

Does not resolve eslint library for yarn2 projects #46

darce2 opened this issue Feb 7, 2020 · 5 comments · Fixed by #48

Comments

@darce2
Copy link

darce2 commented Feb 7, 2020

When using yarn2 for a project I am getting an error saying Failed to load the ESLint library for the document .... With yarn2 pnp is enabled so there is not a node_modules folder and thus eslint cannot be resolved from the workspace.

Info Output Below:


vim version: NVIM v0.4.3
node version: v12.15.0
coc.nvim version: 0.0.74-6700e7468d
term: xterm-256color
platform: linux

## Messages
[coc.nvim] Failed to load the ESLint library for the document /home/arlen/workspace/node/marianos_clipper/index.js
## Output channel: prettier


## Output channel: tsserver

[Info  - 3:45:46 PM] Forking TSServer
PATH: /home/arlen/.nvm/versions/node/v12.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/arlen/Dotfiles/functions:/home/arlen/.gem/ruby/2.7.0/bin:/home/arlen/Applications:/home/arlen/Dotfiles/functions:/home/arlen/.gem/ruby/2.7.0/bin:/home/arlen/Applications 
[Info  - 3:45:46 PM] Started TSServer
{
  "path": "/home/arlen/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib",
  "_pathLabel": "",
  "_api": {
    "versionString": "3.7.3",
    "version": "3.7.3"
  }
}

## Output channel: eslint

[Info  - 3:45:46 PM] ESLint server running in node v12.15.0```

@fannheyward
Copy link
Member

From https://next.yarnpkg.com/advanced/pnpify I found a fallback solution:

  1. yarn add @yarnpkg/pnpify add pnpify to your project.
  2. alias eslint=yarn pnpify eslint in your project

Can you test whether this works?

@fannheyward
Copy link
Member

Or https://master--yarn2.netlify.com/advanced/editor-sdks:

  1. yarn add @yarnpkg/pnpify in your project
  2. yarn pnpify --sdk
  3. "eslint.nodePath": "./.vscode/pnpify/" to coc-settings.json

I don't use yarn2 yet, just from docs to find this two solutions. Hope you can test both and give feedbacks.

@darce2
Copy link
Author

darce2 commented Feb 8, 2020

@fannheyward I am able to
yarn eslint without an issue.
Installing the sdk and pointing the nodePath worked!

Thanks!

Is this the expected behavior or is there work to be done to address this without needing to add a settings file for projects using pnp?

@fannheyward
Copy link
Member

For yarn2 project:

  1. yarn add @yarnpkg/pnpify to you project
  2. yarn pnpify --sdk

coc-eslint will resolve ESLint automatic after #48 merged.

@Nate-Wilkins
Copy link

@fannheyward are there ways to debug issues for loading coc-eslint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants