prettiereditorconfig

How to use the "editorconfig" in a .prettierrc in v3.0.3


I have prettier v3.0.3 and this .prettierrc config:

{
  "editorconfig": true,
  "bracketSpacing": true,
  "htmlWhitespaceSensitivity": "css",
  "proseWrap": "preserve",
  "quoteProps": "as-needed",
  "semi": true,
  "trailingComma": "none",
  "arrowParens": "avoid",
  "singleAttributePerLine": true
}

But when I run "prettier:fix" I get this warning: [warn] Ignored unknown option { editorconfig: true }.

Whats wrong here? Also I wonder where prettier looks for the .editorconfig file. In the same folder where the .prettierrc is, or also in parent folders?

See: https://github.com/prettier/prettier/discussions/15603


Solution

  • You cannot use the editorconfig option inside .prettierrc. Prettier use .editorconfig as the configuration file if .prettierrc does not exist and a .editorconfig file exists.

    source @sosukesuzuki: https://github.com/prettier/prettier/discussions/15603#discussioncomment-7586261