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

Arrow function should not return assignment #552

Closed
vdclouis opened this issue Jun 21, 2016 · 3 comments

Comments

@vdclouis
Copy link

commented Jun 21, 2016

Hello!

Just switched to standard with our team. Loving the simplicity!
I do have one question.

Can you somehow hide the Arrow function should not return assignment error?
I feel like it should not be an error.

I love the simplicity of
tags.map(tag => tag.name = text.text)

Cheers

@LinusU

This comment has been minimized.

Copy link
Member

commented Jun 21, 2016

I think it's very good, since it can be used to avoid confusion when you missed one of the =, e.g.

tags.filter(tag => tag.name = text.text)
@dougwilson

This comment has been minimized.

Copy link

commented Jun 21, 2016

And I believe you can just signal that you really meant an assignment by wrapping in parenthesis:

tags.filter(tag => (tag.name = text.text))

@dcousens dcousens added the i disagree label Jun 21, 2016

@dcousens

This comment has been minimized.

Copy link
Member

commented Jun 21, 2016

As pointed out by @dougwilson, this error is easily averted in a quite aesthetically pleasing way, especially given the safety net it provides as pointed out by @LinusU.

Closing, but don't let that end the conversation if you feel otherwise 👍

@dcousens dcousens closed this Jun 21, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.