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

Standardize arrow functions #1144

Open
NicoGorr opened this issue May 31, 2018 · 6 comments

Comments

@NicoGorr
Copy link

commented May 31, 2018

Could you please add some rules to arrow functions so the code will be more consistent?

I suggest:
arrow-body-style set to as-needed
arrow-parens set to always
implicit-arrow-linebreak set to beside

Thank you.

@LinusU

This comment has been minimized.

Copy link
Member

commented May 31, 2018

I think this would be great as well, my own code is a total mix between (err) => ... and err => ..., sometimes even in the same project 😆

I'm okay with both, but I think that always having the parenthesis is easier...

@NicoGorr

This comment has been minimized.

Copy link
Author

commented May 31, 2018

Yes, it is. Using parens make the code more consistent.

@LinusU

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

Looking at the current eco-system impact of enabling arrow-parens:

"arrow-parens": ["error", "always"]

# tests 271
# pass  246
# fail  25
# violations 696
"arrow-parens": ["error", "as-needed"]

# tests 271
# pass  244
# fail  27
# violations 616

Hmm, this one is very very close.

I'm looking at being able to fetch the full list of packages depending on standard directly from Npm, instead of using our manually sampled list. Perhaps that can shed some more light on it...

@stale

This comment has been minimized.

Copy link

commented Sep 25, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Sep 25, 2018

@stale stale bot closed this Oct 2, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Dec 31, 2018

@standard standard unlocked this conversation Aug 12, 2019

@feross feross reopened this Aug 12, 2019

@stale stale bot removed the stale label Aug 12, 2019

@feross feross added the enhancement label Aug 12, 2019

@mightyiam

This comment has been minimized.

Copy link
Contributor

commented Aug 12, 2019

'arrow-body-style': ['error', 'as-needed', { requireReturnForObjectLiteral: false }]

Because I've been using the () => ({}) pattern for a long while and I am used to reading it. I like it that way.

'arrow-parens': 'always'. I used to prefer 'as-needed' but since writing so much strict TypeScript, it has been impossible to omit the parens. So yea. 'always'.

I could live with 'implicit-arrow-linebreak': ['error', 'beside']. I could not live with 'below'.

@LinusU

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

My vote also goes to 'arrow-parens': 'always'

@feross feross added this to the standard 15 milestone Aug 13, 2019

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