neoclide / coc-eslint

Eslint extension for coc.nvim
MIT License
396 stars 25 forks source link

Not working with yarn2 / berry (PnP)? #105

Open billyvg opened 3 years ago

billyvg commented 3 years ago

I have looked at existing issues like #11, #46, #49 and have followed suggestions there and still can't get this working.

I have run

yarn dlx @yarnpkg/pnpify --sdk vim vscode

I have the shims in .yarn/sdks, the config file is correct. If I run :CocLocalConfig, it brings up the correct config file.

When I run :CocCommand eslint.lintProject this is the error I get:

2021-02-23T18:31:52.298 INFO (pid:13052) [attach] - receive notification: runCommand [ 'eslint.lintProject' ]
2021-02-23T18:31:52.619 ERROR (pid:13052) [node-client] - request error on "nvim_call_function" [
  'coc#task#start',
  [
    'ESLINT',
    {
      cmd: 'eslint',
      args: [Array],
      cwd: '/Users/billy/Dev/sentry-development-metrics'
    }
  ]
] Vim(let):E475: Invalid value for argument cmd: 'eslint' is not executable Error
    at eM.request (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:20:34604)
    at eM.call (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:22:6260)
    at l0.start (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:187:1807)
    at EslintTask2.start (/Users/billy/.config/coc/extensions/node_modules/coc-eslint/lib/index.js:4120:28)
    at /Users/billy/.config/coc/extensions/node_modules/coc-eslint/lib/index.js:4093:32
    at async FP.runCommand (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:253:7463)
    at async OP.cocAction (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:255:6332)
    at async eM.<anonymous> (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:129:12652)
2021-02-23T18:31:52.619 ERROR (pid:13052) [commands] - Error
    at eM.request (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:20:34604)
    at eM.call (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:22:6260)
    at l0.start (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:187:1807)
    at EslintTask2.start (/Users/billy/.config/coc/extensions/node_modules/coc-eslint/lib/index.js:4120:28)
    at /Users/billy/.config/coc/extensions/node_modules/coc-eslint/lib/index.js:4093:32
    at async FP.runCommand (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:253:7463)
    at async OP.cocAction (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:255:6332)
    at async eM.<anonymous> (/Users/billy/.config/nvim/plugged/coc.nvim/build/index.js:129:12652)

Other logs

vim version: NVIM v0.5.0-dev+nightly-210-gc64cce906
node version: v14.15.5
coc.nvim version: 0.0.80-bcc57aa73c
- ✓ coc-eslint Current version 1.4.5 is up to date.
- ✓ coc-highlight Current version 1.2.7 is up to date.
- ✓ coc-jest Current version 1.1.3 is up to date.
- ✓ coc-json Current version 1.3.4 is up to date.
- ✓ coc-pyright Current version 1.1.113 is up to date.
- ✓ coc-python Current version 1.2.13 is up to date.
- ✓ coc-tsserver Current version 1.6.8 is up to date.
chemzqm commented 3 years ago

The problem is where is eslint executable when you're using yarn2?

billyvg commented 3 years ago

@chemzqm It's in .yarn/sdks/eslint/bin/eslint.js and in my .vim/coc-settings.json I have this config: "eslint.nodePath": ".yarn/sdks". (This was done by the pnpify package). I've also tried the full path and it does not work.

billyvg commented 3 years ago

Also odd, my TSC works fine: image

chemzqm commented 3 years ago

Where is eslint executable inside ".yarn/sdks" ?

billyvg commented 3 years ago

It's .yarn/sdks/eslint/bin/eslint.js

guysherman commented 3 years ago

Is there a way to configure it to just run yarn eslint instead of eslint? That would seem to be the fix.