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

Automatic paren changes semantics and broke code #1201

Closed
wyuenho opened this issue Apr 12, 2017 · 1 comment
Closed

Automatic paren changes semantics and broke code #1201

wyuenho opened this issue Apr 12, 2017 · 1 comment
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@wyuenho
Copy link
Contributor

wyuenho commented Apr 12, 2017

We recently upgraded from prettier 0.19 to 0.22. Prettier now starts to strip parens in expressions like this:

// before
var fooInstance = new (classFactory('Foo'))(...);

// after
var fooInstance = new classFactory('Foo')(...);

This stripping is not safe because the invocation operator () has higher precedence than new, so the interpreter will try to invoke the returned class like a function first then attempt to new the result of the function invocation.

@vjeux
Copy link
Contributor

vjeux commented Apr 12, 2017

Sorry about this! This is fixed in master #1169. We're going to do a release this week. In the meantime, you can add // prettier-ignore in the line before to workaround it.

@vjeux vjeux closed this as completed Apr 12, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

2 participants