prettier-vscode: Prettier 3 - Invalid host defined options
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/...
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 25
- Comments: 26
Commits related to this issue
- fixed prettier on mac: https://github.com/prettier/prettier-vscode/issues/3114 — committed to romanziske/IQEngine by romanziske 3 months ago
Removing
prettierPathfrom vscode settings fixed it for me (from https://github.com/n8n-io/n8n/pull/6952).EDIT: No it didn’t, now the extension ignores my config.
After updating to 3.0, my project was throwing the same error. What fixed it for me was disabling/enabling the
Prettierextensions in VSC.Have you all tried the workaround in #3100? That resolved this for me
[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!
Restarting the vscode and removing the
prettierPathform the vscode settings worked for meCan confirm this error.
Removing
prettierPathconfig field from.prettierrcworked for me. I haveprettier 3.0.3installed locally in my project.This worked for me too! Thanks for the suggestion. Hopefully this gets fixed asap…
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.
Removing the
prettierPathin 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.