Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prettier vscode "r is not a function"

Been using prettier in vscode for a while, but it recently stopped working and I'm not sure if it's a bug on their end or a misconfiguration of mine.

["INFO" - 02:54:03] Loaded module '[email protected]' from '/Users/paulrberg/.nvm/versions/node/v10.17.0/lib/node_modules/prettier'
["INFO" - 02:54:03] Formatting using 'prettier-eslint'
["ERROR" - 02:54:03] Error formatting document.
r is not a function
TypeError: r is not a function
    at /Users/paulrberg/.vscode/extensions/esbenp.prettier-vscode-3.13.0/dist/extension.js:1:352891
    at t.default.safeExecution (/Users/paulrberg/.vscode/extensions/esbenp.prettier-vscode-3.13.0/dist/extension.js:1:353582)
    at t.default.<anonymous> (/Users/paulrberg/.vscode/extensions/esbenp.prettier-vscode-3.13.0/dist/extension.js:1:352865)
    at Generator.next (<anonymous>)
    at s (/Users/paulrberg/.vscode/extensions/esbenp.prettier-vscode-3.13.0/dist/extension.js:1:347571)
like image 319
Paul Razvan Berg Avatar asked Dec 15 '19 00:12

Paul Razvan Berg


People also ask

How do I fix prettier in VSCode?

Open up VSCode settings in UI mode by selecting File > Preferences > Settings or press Ctrl + ,. Input “formatter” in the search box. Once you see Editor: Default Formatter section, select . This setting allows you to define a default formatter which takes precedence over all other formatter settings.

Does prettier automatically format my code in Visual Studio Code?

This article will guide you through setting up Prettier to format your code in Visual Studio Code automatically. For demo purposes, here’s the sample code we will be formatting. If you’re picky about code formatting, you might pick up on some apparent missteps immediately.

How to fix prettier not working on VSCode?

Make sure your Editor: Default Formatter field is not null but rather esbenp.prettier-vscode and that all the languages below are ticked. This fixed my issue. I did this and also tried the solution from @miha to no avail. Finally uninstalled/reinstalled and it worked Sometimes, prettier stops working when there are syntactic errors in the code.

Why can't I use prettier-VSCode with Vue?

This is not a problem with Prettier itself, but prettier-vscode, the VSCode extension. According to its documentation, Vue formatting is disabled by default: A list of languages IDs to disable this extension on. Restart required.

How do I install the prettier extension in Visual Studio Code?

To work with Prettier in Visual Studio Code, you’ll need to install the extension. Search for Prettier - Code Formatter. You can see the extension below. If you’re installing it for the first time, you’ll see an “install” button instead of the “uninstall” button you see on mine.


1 Answers

There was a bug in version 3.13.0. Upgrade to the latest and the issue will go away.

like image 97
Sigit Avatar answered Oct 17 '22 08:10

Sigit