Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing comma missing #1229

Closed
ledermann opened this issue May 13, 2022 · 4 comments
Closed

Trailing comma missing #1229

ledermann opened this issue May 13, 2022 · 4 comments

Comments

@ledermann
Copy link

After upgrading from 2.1.0 to 3.1.1, the trailingComma option seems to be ignored.

Metadata

  • Operating system: MacOS 12.3.1
  • Ruby version: 3.1.2
  • Node version: 18.0.0
  • @prettier/plugin-ruby version: 3.1.1
  • syntax_tree version: 2.4.1

Prettier config

{
  "trailingComma": "all",
  "singleQuote": true,
  "rubyPlugins": "plugin/single_quotes",
  "printWidth": 80,
  "tabWidth": 2
}

Input

def foo(value)
  [
    Rails.configuration.x.foo.beginning_of_month,
    value.beginning_of_month
  ].max
end

Current output

def foo(value)
  [
    Rails.configuration.x.foo.beginning_of_month,
    value.beginning_of_month # comma missing
  ].max
end

Expected output

def foo(value)
  [
    Rails.configuration.x.foo.beginning_of_month,
    value.beginning_of_month,  # this one!
  ].max
end
@boris-petrov
Copy link
Contributor

Unfortunately there doesn't seem to be a plugin for syntax-tree for a trailing comma... which is unfortunate. 😄 I'll also keep back using v2 until this is resolved.

@kddnewton
Copy link
Member

I will hopefully get to this eventually. If anyone is looking to help out, this would be a great one.

@kddnewton
Copy link
Member

Going to close this for now since I'm tracking it over on syntax tree.

@timkrins
Copy link

Just came across this issue when upgrading.

Changed our .prettierrc file to include

  "rubyPlugins": "plugin/single_quotes,plugin/trailing_comma",

and now works.
(syntax_tree 2.7.1)

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

No branches or pull requests

4 participants