mantoni / eslint_d.js

Makes eslint the fastest linter on the planet
MIT License
1.08k stars 65 forks source link

Webstorm Integration not working #106

Open ctaylor4874 opened 5 years ago

ctaylor4874 commented 5 years ago

I'm getting the error

Initialization error (ESLint). Cannot find module '<PATH_TO_NVM>/.nvm/versions/node/v10.13.0/lib/node_modules/eslint_d/lib/api'

when I try the Webstorm integration.

Steps to reproduce:

  1. Open Webstorm Preferences.
  2. Go to Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
  3. Select Manual ESLint Configuration
  4. Under ESLint package set it to your local eslint_d
  5. Apply
mantoni commented 5 years ago

Do you know which version of eslint your IDE integration is expecting?

dpinol commented 4 years ago

Same problem here with webstorm 2019.2.3 It works fine with eslint@5.16

congratulations for eslint_d. amazing package

mantoni commented 4 years ago

Thank you! While I'd like to support other editors, my personal need is focused on vim. Therefore I rely on the community to fix issues in other editors. I would totally merge any PRs or improve documentation if anyone has an idea why this is happening for Webstorm users. ❤️

C0ZEN commented 3 years ago

I have the same issue 😞 image

StackTrace:

Initialization error (ESLint). Cannot find module 'C:/Users/x/Documents/y/frontend/node_modules/eslint_d/lib/api'
Error: Cannot find module 'C:/Users/x/Documents/y/frontend/node_modules/eslint_d/lib/api'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at requireInContext (C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:183:12)
    at new ESLintPlugin (C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:46:30)
    at ESLintPluginFactory.create (C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin-provider.js:9:34)
    at Interface.<anonymous> (C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\plugins\JavaScriptLanguage\jsLanguageServicesImpl\js-language-service.js:82:52)
    at Interface.emit (events.js:198:13)
    at Interface._onLine (readline.js:308:10)
Process finished with exit code -1

The configuration: image

My IntelliJ IDEA version:

IntelliJ IDEA 2020.3.1 (Ultimate Edition)
Build #IU-203.6682.168, built on December 29, 2020
Runtime version: 11.0.9.1+11-b1145.63 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: ide.usages.page.size=500, ide.balloon.shadow.size=0, eslint.service.node.arguments=--max_old_space_size=8192
Non-Bundled Plugins: com.chrisrm.idea.MaterialThemeUI, com.intellij.ideolog, com.jetbrains.ChooseRuntime, com.mallowigi, com.almightyalpaca.intellij.plugins.discord, AWSCloudFormation, patrick.kelleter.angular-cli-quick-switch, String Manipulation, intellij.prettierJS, com.microsoft.tooling.msservices.intellij.azure, izhangzhihao.rainbow.brackets

Dependencies:

"eslint": "^7.13.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-config-recommended": "^4.1.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsdoc": "^30.7.8",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-progress": "0.0.1",
"eslint_d": "^9.1.2",

Node 10.16.0

vossmalte commented 1 year ago

I played around with this a little bit as this error is still out there. So I compared the eslint@8 and eslint_d package. eslint has a lib/api.js which exports a member: ESLint. This is a constructor for an ESLint class. Webstorm internally instantiates this class.

@mantoni does eslint_d provide a class? If not, do you see a way to implement this?

pasor1 commented 1 year ago

Same problem here with latest PHPStorm and WEBStorm. It would very useful have a working eslint_d integration, because the default eslint integration has lot of problems with large files/codebases.

mantoni commented 1 year ago

Hm, that's a tricky one since eslint_d is designed to be replacement for the command line interface.

If WebStorm tries to create an instance of the ESLint class we'd have to implement a compatible class for eslint_d that delegates internally to the instance in the daemon process.

I'm also wondering if that would actually make anything faster. Are they creating the class instance for every linter invocation? Then yes. If they're caching the instance and reuse it, then this is exactly what eslint_d does as well.

Isn't there a way in WebStorm to delegate linting to a command line tool?

vossmalte commented 1 year ago

@pasor1 I think the integration is now broken as I could not make any progress.

Another idea for working with large codebases is activating the --cache flag on eslint itself.

kamilpp commented 10 months ago

I also did not manage to configure eslit_d in latest Webstorm:

Initialization error (ESLint). Cannot find module '/<projectpath>/node_modules/eslint_d/'

Another idea for working with large codebases is activating the --cache flag on eslint itself.

This is quite unfortunate as it seems the --cache flag currently does not work due to a bug.

So, as for today, there really seems no ways to improve eslint performance in Webstorm 😭