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

Wrongly removed parentheses around expression over class prototype #165

Closed
eugenet8k opened this issue Jan 23, 2020 · 5 comments · Fixed by #166
Closed

Wrongly removed parentheses around expression over class prototype #165

eugenet8k opened this issue Jan 23, 2020 · 5 comments · Fixed by #166

Comments

@eugenet8k
Copy link

This valid CoffeeScript code

export default class MyClass extends MyOtherClass
  DEFAULTS: {
    (@::DEFAULTS)...
    a: 1
    b: 1
  }

Prettier turns to invalid one

export default class MyClass extends MyOtherClass
  DEFAULTS: {
    @::DEFAULTS...
    a: 1
    b: 1
  }

Thanks for your attention!

@eugenet8k
Copy link
Author

eugenet8k commented Jan 24, 2020

Same problem with existential expressions

Working code:

{(opts?.data?.root)..., (opts?.data)...}

is turned to broken:

{opts?.data?.root..., opts?.data...}

@helixbass
Copy link
Owner

Ok this is really a Coffeescript parser bug (opened jashkenas/coffeescript#5291)

But in the meantime I updated the Prettier plugin to ensure parentheses around these non-parsing object spread expressions

I can release a new version of the Prettier plugin soon, but in the meantime you could use a Github dependency if you want:

yarn add --dev github:helixbass/prettier-plugin-coffeescript#d63278a7

@eugenet8k
Copy link
Author

@helixbass thank you! Stellar response speed and support!

Btw is your forked prettier will land in official prettier with a first class support for coffeescript? Or is it going to be continuously supported via fork?

@helixbass
Copy link
Owner

Btw is your forked prettier will land in official prettier with a first class support for coffeescript? Or is it going to be continuously supported via fork?

I think we'll be able to land the modifications in official prettier. There's an open PR for all of the changes needed to support Coffeescript, but no-one from Prettier core team has stepped up and really reviewed it

Now that we've released the Prettier plugin, I'll dig back into the Prettier side soon and try and help get it merged

@GeoffreyBooth
Copy link

There's an open PR for all of the changes needed to support Coffeescript, but no-one from Prettier core team has stepped up and really reviewed it

Try cc'ing @lydell, he’s a former maintainer of CoffeeScript who is/was also active in Prettier, he might be able to help.

I'm happy to fast-track a 2.5.1 release of CoffeeScript to get out various bugfixes.

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