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

style: Update Arrays 4.7 to add best style rule #2188

Closed
wants to merge 1 commit into from

Conversation

umairx97
Copy link

@umairx97 umairx97 commented Mar 2, 2020

Closes #2187

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this adds any value to this particular rule; that we're using simple logic here for the sake of examples isn't really material. Pretend that each return value is 10 statements, and it can't be collapsed into a single expression.

@umairx97
Copy link
Author

umairx97 commented Mar 3, 2020

The example I added was on the assumption of the good case rule where there are just two conditions to be checked

@ljharb
Copy link
Collaborator

ljharb commented Mar 3, 2020

and in the case of this specific code, I agree your "best" is better :-) however, adding that would be irrelevant to demonstrating the point of this section in the guide, which is to talk about array callback return patterns.

@umairx97
Copy link
Author

umairx97 commented Mar 3, 2020

so would you consider adding this to this section ?
inbox.filter(({ subject, author }) => subject === 'Mockingbird' && author === 'Harper Lee';

as it is implicit return pattern
if Yes I can just push new changes to the PR :)

@ljharb
Copy link
Collaborator

ljharb commented Mar 3, 2020

I'm not convinced its presence would be helpful; i think it would distract from the purpose of the section.

@umairx97
Copy link
Author

umairx97 commented Mar 3, 2020

Oh okay, understandable

@umairx97 umairx97 closed this Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add best conditional rule to Arrays 4.7
2 participants