axesthetic
axesthetic

Reputation: 71

Why Prettier doesn't follow my .prettierrc.json file?

Edited: I'm trying to set my custom rules for prettierrc.json and it shows another value in the output. It happens with every rules that i tried to change

Thats my .prettierrc.json

{
  "useTabs": false,
  "tabWidth": 2,
  "semi": true,
  "singleQuote": false, //// my custom value
  "arrowParens": "avoid",
  "trailingComma": "none",
  "endOfLine": "auto"
}

And it shows in the console

["INFO" - 16:33:14] Formatting c:\Users\User\Desktop\repos\boludeces\.prettierrc.json
["INFO" - 16:33:14] Using config file at 'c:\Users\User\Desktop\repos\boludeces\.prettierrc.json'
["INFO" - 16:33:14] Using ignore file (if present) at c:\Users\User\Desktop\repos\boludeces\.prettierignore
["INFO" - 16:33:14] File Info:
{
  "ignored": false,
  "inferredParser": "json"
}
["INFO" - 16:33:14] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 16:33:14] Prettier Options:
{
  "filepath": "c:\\Users\\User\\Desktop\\repos\\boludeces\\.prettierrc.json",
  "parser": "json",
  "useTabs": false,
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true, // the output value
  "arrowParens": "avoid",
  "trailingComma": "none",
  "endOfLine": "auto"
}
["INFO" - 16:33:14] Formatting completed in 12.8338ms.

What's wrong?

Upvotes: 5

Views: 7429

Answers (1)

Matthew Marichiba
Matthew Marichiba

Reputation: 2092

I experienced a similar infuriating issue in which vscode was not respecting the config values in my .prettierrc.json file. I discovered an override hiding in my vscode settings.json file that pointed to a different formatter (and thus, to a different set of formatting rules). You might want to check for entries like the [html] section below in your settings.json file and remove them.

    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },

Upvotes: 1

Related Questions