Search code examples
visual-studio-codeprettier

VSCode Prettier warning on save - Arrow Parens


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.


Solution

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