Prettier-atom: Double quotes are replacing single quotes on save

Created on 22 Jun 2017  路  7Comments  路  Source: prettier/prettier-atom

I have this configuration in Settings:
screen shot 2017-06-22 at 14 05 49
...but every time a save a js file, the single quotes are being replaced by double quotes. It is a recent issue and also affects my colleague in the same way. I am running v0.34.0 of the package and v1.18.0 of Atom.

Any thoughts/solutions?

question

Most helpful comment

Aaah! I wondered why there were so few options. That makes sense and a restart has the .prettierrc file working perfectly.

Thanks for clarifying.

All 7 comments

I can't reproduce the issue.

Can you publish your prettier-atom config displayed by command prettier:debug, your ESLint config and also give us an example so we can have more context?

I am going to close this for now, please let me know if there is still something that needs to be addressed and I will reopen.

I'm having the same issue. Here's the debug information that's printed:

  ...
  "prettierOptions": {
    "semi": false,
    "singleQuote": true,
    "bracketSpacing": true,
    "useTabs": false,
    "jsxBracketSameLine": false,
    "printWidth": 80,
    "tabWidth": "auto",
    "trailingComma": "none",
    "parser": "babylon",
    "arrowParens": "avoid"
  },

and running yarn prettier src/index.ts uses the correct quotes but the editor's "fix on save" does not. It doesn't happen in my JS projects, only this one TS one, but I can't find any conflicting rules. Any help would be much appreciated.

Never mind, I got it working by actually removing the .prettierrc file and using only the package's options :)

Hi there,

I'm having a similar issue with single quotes in package settings. I've noticed it when it was a bare bones project and I didn't have any ESLint .eslintrc or Prettier .prettierrc configs in place. This is when I would assume the package defaults would prevail.

This is my Prettier debug info...

Atom version: 1.21.2
prettier-atom version: 0.55.2
prettier: bundled
prettier version: 1.13.4
prettier-eslint version: 8.8.2
prettier-atom configuration: {
  "formatOnSaveOptions": {
    "enabled": true,
    "showInStatusBar": true,
    "respectEslintignore": true,
    "excludedGlobs": [],
    "whitelistedGlobs": [],
    "isDisabledIfNotInPackageJson": false,
    "isDisabledIfNoConfigFile": false
  },
  "prettierOptions": {
    "jsxBracketSameLine": true,
    "printWidth": 120,
    "singleQuote": true
  },
  "useEslint": true,
  "useStylelint": false,
  "prettierEslintOptions": {
    "prettierLast": false
  }
}

I tried changing the useEslint option but nothing changed.

In addition, I added a .prettierrc file with these options which were also ignored...

{
  "semi": false,
  "singleQuote": true
}

I feel like there is something simple I'm doing wrong! Would be good to hear your thoughts.

Many thanks

@mikeebee There is an annoying Atom bug that leaves options that were deleted in a newer version of a package inside of your config. prettier-atom actual prettier settings no longer can be configured from within prettier-atom. You must use a .prettierrc (either a global one in your home directory or on a per-project basis).

Please make sure to restart Atom after adding a .prettierrc as the lookup is cached for performance reasons.

Aaah! I wondered why there were so few options. That makes sense and a restart has the .prettierrc file working perfectly.

Thanks for clarifying.

Was this page helpful?
0 / 5 - 0 ratings