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

Prettier 3 - Invalid host defined options #3114

Closed
leppaott opened this issue Aug 9, 2023 · 26 comments
Closed

Prettier 3 - Invalid host defined options #3114

leppaott opened this issue Aug 9, 2023 · 26 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@leppaott
Copy link

leppaott commented Aug 9, 2023

Hello, we just updated Prettier to latest version 3 as well as typescript, jest and ts-jest.

After which formatting on test files stopped:

"INFO" - 2:54:03 PM] Formatting file:///home/file...test.ts
["ERROR" - 2:54:03 PM] Error resolving prettier configuration for /home/file....test.ts
["ERROR" - 2:54:03 PM] Invalid host defined options
TypeError: Invalid host defined options
	at Object.<anonymous> (/home/...node_modules/prettier/index.cjs:600:23)
	at u._compile (/usr/share/code/resources/app/out/vs/loader.js:4:1271)
	at Module._extensions..js (node:internal/modules/cjs/loader:1243:10)
	at Module.load (node:internal/modules/cjs/loader:1058:32)
	at Module._load (node:internal/modules/cjs/loader:893:12)
	at f._load (node:electron/js2c/asar_bundle:2:13330)
	at o._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:28084)
	at f._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:25418)
	at C._load (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94:19511)
	at Module.require (node:internal/modules/cjs/loader:1082:19)
	at g (/usr/share/code/resources/app/out/vs/loader.js:4:647)
	at t.loadNodeModule (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:2829)
	at t.PrettierMainThreadInstance.import (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:17760)
	at t.ModuleResolver.getPrettierInstance (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:5728)
	at t.ModuleResolver.getResolvedConfig (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:7496)
	at t.default.format (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:14589)
	at t.PrettierEditProvider.provideEdits (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:12683)
	at t.PrettierEditProvider.provideDocumentFormattingEdits (/home/.../.vscode/extensions/esbenp.prettier-vscode-10.1.0/dist/extension.js:1:8922)
	at U.provideDocumentFormattingEdits (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:44961)
	at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:67895
	at le.s (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:62744)
	at le.$provideDocumentFormattingEdits (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:67882)
	at t.N (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:7983)
	at t.M (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:7749)
	at t.H (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:6791)
	at t.G (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:5906)
	at r.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:4736)
	at f.w (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
	at f.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
	at y.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:79:13931)
	at r.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:30355)
	at f.w (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
	at f.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
	at y.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:79:13931)
	at MessagePortMain.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:28635)
	at MessagePortMain.emit (node:events:513:28)
	at MessagePortMain.emit (node:domain:489:12)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367)

Also code files formatting doesn't work but sometimes it does. Does this extension use tsconfig or such?

Prettier config is on path services/.prettierrc and test files are on
services/module/__tests__/e2e/name.test.ts and code on services/module/src/...

@leppaott
Copy link
Author

leppaott commented Aug 9, 2023

[10.1.0]
Reverts back to prettier 2.x by default due to issues with extension

[10.0.0]
Use Prettier 3.0 by default. Change default configuration for trailingComma to all to match Prettier 3.0.

OK seems it could be by these changes? Prettier 2 works!

@thj-dk
Copy link

thj-dk commented Aug 10, 2023

Can confirm this error.

@talmosko
Copy link

same here

@Connorelsea
Copy link

Seeing this same issue in latest plugin version. Downgrading to prettier 2 fixed it.

@mrfy
Copy link

mrfy commented Aug 16, 2023

same here

@schwarzsky
Copy link

Can confirm the issue

@lenaggar
Copy link

yup, same!

@MaximMaximS
Copy link

MaximMaximS commented Aug 19, 2023

Removing prettierPath from vscode settings fixed it for me (from n8n-io/n8n#6952).

EDIT: No it didn't, now the extension ignores my config.

@thisislvca
Copy link

Removing prettierPath from vscode settings fixed it for me (from n8n-io/n8n#6952).

This worked for me too! Thanks for the suggestion. Hopefully this gets fixed asap...

@MaximMaximS
Copy link

Removing prettierPath from vscode settings fixed it for me (from n8n-io/n8n#6952).

Well I've missed that the extension now ignores my config, so its not really a fix :(

@christiango
Copy link

Have you all tried the workaround in #3100? That resolved this for me

@danieljonsson90
Copy link

Have you all tried the workaround in #3100? That resolved this for me
This was the only fix that worked for me

@en3sis
Copy link

en3sis commented Sep 4, 2023

After updating to 3.0, my project was throwing the same error. What fixed it for me was disabling/enabling the Prettier extensions in VSC.

@manchicken
Copy link

Removing the prettierPath in the config did help me. Don't know whether it's reading the config (it seems weird that it wouldn't), but I did change it and then it did start working.

@angusryer
Copy link

angusryer commented Sep 7, 2023

Removing prettierPath config field from .prettierrc worked for me. I have prettier 3.0.3 installed locally in my project.

@MaximMaximS
Copy link

Removing prettierPath from vscode settings fixed it for me (from n8n-io/n8n#6952).

Well I've missed that the extension now ignores my config, so its not really a fix :(

Well, now it seems like it reads my config again, so the issue seems to be gone.

@leppaott
Copy link
Author

We haven't used prettierPath but extension settings:
"prettier.configPath": "services/.prettierrc",
and we still got this.

@leppaott
Copy link
Author

Yeah I removed configPath from settings.json commited to repo and now the plugin formatting seems to work and also apply the prettierrc config.

@leppaott
Copy link
Author

leppaott commented Sep 13, 2023

Right this was only an issue with the path ./services/.prettierrc works for me while before services/... would work without ./

@getellez
Copy link

Restarting the vscode and removing the prettierPath form the vscode settings worked for me

@trusktr
Copy link

trusktr commented Oct 16, 2023

I restart VS Code, the problem goes away for a while, then comes back after some time, then I restart VS Code again each time it happens and I'm good for a while.

Something is up with it.

@leppaott can you please re-open this (but unsubscribe if you need)?

@mr-moon
Copy link

mr-moon commented Oct 23, 2023

Still issue, .prettierrc is in root dir.

@whosesmile
Copy link

whosesmile commented Jan 10, 2024

When I updated the prettier version in my project to 3.x.x, the formatting functionality didn't work, but when I updated the latest prettier plugin(vscode plugin), it worked fine.

@kee-oth
Copy link

kee-oth commented Jan 16, 2024

I'm getting this error with Prettier 3.2.2 and Prettier VSCode Extension 10.1.0. This is in a brand new project that uses a .prettierrc in the root. In VSCode, I've tried specifying and not specifying where my .prettierrc file is, with both absolute and relative paths.

@samuk10
Copy link

samuk10 commented Jan 31, 2024

somehow my prettier just accepted the .yaml format! .prettierrc.yaml
https://prettier.io/docs/en/configuration.html

romanziske added a commit to romanziske/IQEngine that referenced this issue Mar 17, 2024
Copy link

github-actions bot commented May 1, 2024

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 May 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
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.
Projects
None yet
Development

No branches or pull requests