Search code examples
javascriptprettier

Prettier - unknown options trailingComma


I have a problem with prettier. I'm trying to update prettier version in Angular project. After moving to 2.0.5 version, prettier do not see some options from config file. Config in package.json file looks like this:

"prettier": {
    "trailingComma ": "none",
    "htmlWhitespaceSensitivity": "strict",
    "semi": true,
    "singleQuote": true,
    "printWidth": 140,
    "arrowParens": "avoid",
    "tabWidth": 2,
    "endOfLine": "auto"
  },

Unfortunately, this does not work. When I'm running prettier from console I got an error and prettier messing up trailing commas in all files (I don't want them).

$ prettier --write --config ./package.json "src/**/*.ts" Ignored unknown option { "trailingComma ": "none" }. Did you mean trailingComma?

How can I fix this?


Solution

  • There is a single space between the word trailingComma and the ". Try to remove it in your config file.

    "trailingComma": "none",