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

Failed to load plugin on format with 3.2.0 and 3.6.0 #1062

Closed
henrikq opened this issue Nov 15, 2019 · 9 comments
Closed

Failed to load plugin on format with 3.2.0 and 3.6.0 #1062

henrikq opened this issue Nov 15, 2019 · 9 comments
Labels
locked Please open a new issue and fill out the template instead of commenting. need-more-info

Comments

@henrikq
Copy link

henrikq commented Nov 15, 2019

plugin failes to format files, due to Failed to load plugin exception from .vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js:1:347800

reverting to 2.3.0 fixes the issue

Github Repository to Reproduce Issue

Steps To Reproduce:

  1. run "Format Document"

Expected result

A file should format when "Format Document"

Actual result

The files does not format

Additional information

My project is pretty vanilla in terms of folder structure. node_modules, .prettierrc, .eslintrc, and package.json are in the same directory, the root directory for vscode.

eslint --fix works fine and fixes prettier issues.

The following appears in "OUTPUT"

[ERROR - 3:46:17 PM] Error
Failed to load plugin 'jest' declared in 'CLIOptions': Cannot find module 'eslint-plugin-jest'
Require stack:
- /home/myuser/__placeholder__.js
Error: Failed to load plugin 'jest' declared in 'CLIOptions': Cannot find module 'eslint-plugin-jest'
Require stack:
- /home/myuser/__placeholder__.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:627:15)
    at Function.resolve (internal/modules/cjs/helpers.js:21:19)
    at Object.resolve (/home/myuser/proj/myproject/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
    at ConfigArrayFactory._loadPlugin (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:845:39)
    at /home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:734:33
    at Array.reduce (<anonymous>)
    at ConfigArrayFactory._loadPlugins (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:730:22)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:554:32)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:491:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:307:25)
    at ConfigArrayFactory.create (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/config-array-factory.js:362:16)
    at createCLIConfigArray (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:133:47)
    at new CascadingConfigArrayFactory (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:200:29)
    at new CLIEngine (/home/myuser/proj/myproject/node_modules/eslint/lib/cli-engine/cli-engine.js:549:36)
    at getESLintCLIEngine (/home/myuser/proj/myproject/node_modules/prettier-eslint/dist/utils.js:401:12)
    at eslintFix (/home/myuser/proj/myproject/node_modules/prettier-eslint/dist/index.js:151:53)
    at format (/home/myuser/proj/myproject/node_modules/prettier-eslint/dist/index.js:119:10)
    at /home/myuser/.vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js:1:351741
    at t.default.safeExecution (/home/myuser/.vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js:1:352271)
    at t.default.<anonymous> (/home/myuser/.vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js:1:351715)
    at Generator.next (<anonymous>)
    at s (/home/myuser/.vscode/extensions/esbenp.prettier-vscode-3.6.0/dist/extension.js:1:347800)
[INFO - 3:46:17 PM] Formatting completed in 113.350652ms.
[INFO - 3:46:38 PM] Loaded module 'prettier@1.18.2' from '/home/myuser/proj/myproject/node_modules/prettier/index.js'.

VS Code Version:
1.40.1

Prettier & Prettier Plugin Version:

issue observed with prettier-vscode 3.6.0 and 3.2.0

"eslint": "^6.6.0"
"prettier": "^1.18.2",

OS and version:

Ubuntu 19.10

@tpucci
Copy link

tpucci commented Nov 15, 2019

I confirm the issue (vscode 1.40.1 - vscode-prettier 2.3.0 → 3.6.0.
I downgraded vscode to 1.39.2 and vscode-prettier to v2.3.0 : it works again

VSCode about info:

Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:00.827Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.2.0

@CyrilQuandalle
Copy link

I have the same issue but it does not come from vscode version.
I manage to make it work by downgrading to vscode-prettier to v2.3.0 and keeping vscode to 1.40.1

@ntotten
Copy link
Member

ntotten commented Nov 18, 2019

I believe the issue is that the way linters work has changed. You must install prettier-eslint in your local project. See: https://github.com/prettier/prettier-vscode#prettier-linter-integration-advanced

Also, there are many known issues with ESLint 6 and prettier-eslint. See #870. Some people seem to have made it work, but ESLint 6 is not supported by this plugin.

@M1chaelChen
Copy link

Same issue happened here after I upgrade my vscode from 1.39.2 to 1.40.0

@henrikq
Copy link
Author

henrikq commented Nov 19, 2019

@ntotten

You must install prettier-eslint in your local project.

I am OP, and have and had "prettier-eslint": "^9.0.0", installed and in my package.json.

Also, there are many known issues with ESLint 6 and prettier-eslint.

Okay, but something must have happened between 2.3.0 and 3.6.0 as i posted above.

ESLint 6 is not supported by this plugin.

Any plans/timeline on remedying this? Eslint 6 was released 5 months ago.

@ntotten
Copy link
Member

ntotten commented Nov 19, 2019

something must have happened between 2.3.0 and 3.6.0 as i posted above.

Yes, there were changes for sure. We used to bundle prettier-eslint with the extension. That is no longer the case as it caused even more issues with version conflicts. See: https://github.com/prettier/prettier-vscode#migrating-from-versions-2x

have and had "prettier-eslint": "^9.0.0", installed and in my package.json.
Just to confirm, you have eslint, prettier-eslint, and prettier all installed locally.

Any plans/timeline on remedying this? Eslint 6 was released 5 months ago.

It depends on an upstream dependency and it's not something I am going to dive into. If the author of prettier-eslint fixes it we will pick it up. prettier/prettier-eslint#222. And to be honest, if that doesn't get updated soon I will probably drop support for linter integration all together as it is the number 1 source of bugs.

If you can provide me the log from the prettier output that may help. Or if you can publish a github repo I can use to repro the problem i can investigate more.

@ntotten
Copy link
Member

ntotten commented Nov 23, 2019

Also, note that the error says that eslint cannot find the plugin eslint-plugin-jest. Is that installed, if not try installing it and see if it works.

@no-response
Copy link

no-response bot commented Nov 26, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.

@no-response no-response bot closed this as completed Nov 26, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 12, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting. need-more-info
Projects
None yet
Development

No branches or pull requests

5 participants