2
votes

VSCode Prettier

You have legacy settings in your VS Code config. They are being ignored Would you like to migrate them to '.prettierrc'?.

When saving a react js file in VSCode which has the Prettier extension enabled I get the following warning all the time.

My .prettierrc.json file:

{
  "trailingComma": "all",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true
}

My '.vscode/settings.json':

{
  "editor.formatOnSave": true
}

Prettier log:

[INFO - 8:42:09 AM] Prettier Options:
{
  "filepath": ".......\\reactjs\\.vscode\\settings.json",
  "parser": "json",
  "trailingComma": "all",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true
}
[INFO - 8:42:09 AM] Formatting completed in 46.9194ms.
[WARN - 8:42:12 AM] Configuration value 'prettier.arrowParens' found in global configuration.

Even if I add the prettier.arrowParens option to the .prettierrc.json file I get the same warning.

In VSCode - File - Preferences - Settings - Extensions - Prettier-Code formatter configuration if I search for arrowParens I have the following:

Prettier: Arrow Parens Include parentheses around a sole arrow function parameter This extension no longer supports setting Prettier options using VS Code configuration. Use the prettier configuration file instead. https://prettier.io/docs/en/configuration.html

How can I properly configure this option so I get rid of that warning every time I save a file?

Also in File - Preferences - Settings - Extensions - Prettier-Code formatter configuration there is an option for Prettier: Config Path which is empty. Should that be set as well?

VSCode Version: 1.40.0 (user setup)

Edit: The issue seems to be solved with the latest Prettier update.

4

4 Answers

3
votes

First move all your Prettier rules from the VSCode settings.json into the .prettierrc file.

Go to extensions and search for the Prettier plugin. You should already see a reload button in the extension

If this does not work then:

Try to uninstall and install the VSCode Prettier Plugin again

1
votes

I had the same issue. Removed all related settings to prettier from VS Code config and it still throws an error. But removing Prettier Now and turning off and on again prettier itself solved the issue for me

1
votes

The issue seems to be solved with the latest Prettier update.

0
votes

from their github: https://github.com/prettier/prettier-vscode

If you recieve this error message it means that one of the following settings were found in your VS Code config. Either in your global or workspace settings.

Remove any of the following configurations by moving them to the Prettier Configuration.

  • prettier.printWidth
  • prettier.tabWidth
  • prettier.singleQuote
  • prettier.trailingComma
  • prettier.bracketSpacing
  • prettier.jsxBracketSameLine
  • prettier.semi
  • prettier.useTabs
  • prettier.proseWrap
  • prettier.arrowParens
  • prettier.jsxSingleQuote
  • prettier.htmlWhitespaceSensitivity
  • prettier.endOfLine
  • prettier.quoteProps