Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

0.50.0 ignores trailing comma option #375

Closed
onemeta opened this issue Feb 9, 2018 · 9 comments
Closed

0.50.0 ignores trailing comma option #375

onemeta opened this issue Feb 9, 2018 · 9 comments

Comments

@onemeta
Copy link

onemeta commented Feb 9, 2018

I have trailing comma set to "es5" in both the plugin settings and my .prettierrc. After upgrading to 0.50.0, it now removes the trailing commas. Other options seem to be respected. I did test setting trailing comma to "all" in both locations; the commas are still removed.

No other changes were made in my environment (e.g. updates to Atom or other packages, changing prettier version, etc). Reverting to 0.49.2 restores the correct behavior.

Prettier:Debug output and .prettierrc below.

Prettier:Debug
Atom version: 1.23.3
prettier-atom version: 0.50.0
prettier version: 1.10.2
prettier-eslint version: 8.8.1
prettier-atom configuration: {
  "formatOnSaveOptions": {
    "enabled": true,
    "isDisabledIfNoConfigFile": true,
    "respectEslintignore": true,
    "showInStatusBar": false,
    "javascriptScopes": [
      "source.js",
      "source.jsx",
      "source.js.jsx",
      "source.babel",
      "source.js-semantic",
      "text.html.basic",
      "text.html.vue"
    ],
    "typescriptScopes": [
      "source.ts",
      "source.tsx",
      "source.ts.tsx"
    ],
    "cssScopes": [
      "source.css",
      "source.less",
      "source.css.less",
      "source.scss",
      "source.css.scss",
      "source.css.postcss"
    ],
    "jsonScopes": [
      "source.json"
    ],
    "graphQlScopes": [
      "source.graphql"
    ],
    "markdownScopes": [
      "source.md",
      "source.gfm",
      "text.md"
    ],
    "vueScopes": [
      "text.html.vue"
    ],
    "excludedGlobs": [],
    "whitelistedGlobs": [],
    "isDisabledIfNotInPackageJson": false
  },
  "prettierEslintOptions": {
    "prettierLast": false
  },
  "prettierOptions": {
    "bracketSpacing": false,
    "jsxBracketSameLine": true,
    "printWidth": 100,
    "singleQuote": true,
    "trailingComma": "es5",
    "useTabs": true,
    "semi": true,
    "tabWidth": "auto",
    "parser": "babylon",
    "arrowParens": "avoid"
  },
  "useEslint": false,
  "useStylelint": false,
  "useEditorConfig": true
}
.prettierrc
{
	"arrowParens": "avoid",
	"bracketSpacing": false,
	"jsxBracketSameLine": true,
	"parser": "babylon",
	"printWidth": 100,
	"semi": true,
	"singleQuote": true,
	"trailingCommna": "es5",
	"useTabs": true,
}
@SavePointSam
Copy link
Collaborator

@olsonpm any ideas on how this happened with your changes?

@olsonpm
Copy link
Contributor

olsonpm commented Feb 9, 2018

i'll look into it

@olsonpm
Copy link
Contributor

olsonpm commented Feb 9, 2018

haha - I was going hardcore getting a clean vm set up making sure all the versions matched, when I noticed:

  "trailingCommna": "es5"
               ▴

The reason this worked before is the update prevents your prettier configuration from being merged into your prettier settings located in the plugin. And the reason we want that behavior is to allow a single source of formatting configurations for teams.

There's a lot of (fragmented) conversation here if you're interested, but feel free to ask questions if something doesn't make sense.

Thanks for the detailed report on your issue! Makes life much simpler.

@robwise
Copy link
Collaborator

robwise commented Feb 9, 2018

Should we close?

@olsonpm
Copy link
Contributor

olsonpm commented Feb 9, 2018

I would. I know some repo ownerers let the OP close but that seems to allow for a litter of open issues in my experience.

@robwise
Copy link
Collaborator

robwise commented Feb 9, 2018

Yeah I usually just go ahead and do it and we can always reopen

@SavePointSam
Copy link
Collaborator

Just to clarify for future readers. The issue here was that the user misspelled trailingComma as trailingCommna in their .prettierrc.

Be sure to check your .prettierrc for mistakes when making one by hand!

@onemeta
Copy link
Author

onemeta commented Feb 10, 2018

Totally missed that. Thanks for the catch, and apologies for wasting folks' time.

@olsonpm
Copy link
Contributor

olsonpm commented Feb 10, 2018

not a waste - personally I feel prettier should throw an error upon invalid input. A lot of devs don't seem to like throwing errors though or validating input :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants