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

Prefer arrow callbacks in ES6 code #572

Closed
edg2s opened this issue May 17, 2024 · 1 comment · Fixed by #573
Closed

Prefer arrow callbacks in ES6 code #572

edg2s opened this issue May 17, 2024 · 1 comment · Fixed by #573

Comments

@edg2s
Copy link
Member

edg2s commented May 17, 2024

We should consider the following rules in ES6 code:

This results in arrow functions being used for callbacks (unless they reference this or arguments, in which case they would need be converted manually). When arrow functions contain a single return statement, the body-less style is prefered (e.g. ( x ) => x + 1. Also a single line is prefered for such body-less functions.

@jdforrester
Copy link
Member

Seems sensible. Worth posting in https://www.mediawiki.org/wiki/Manual_talk:Coding_conventions/JavaScript for visibility?

edg2s added a commit that referenced this issue May 17, 2024
Also prefer single-line body-less style when possible.

Fixes #572
edg2s added a commit that referenced this issue May 21, 2024
Also prefer single-line body-less style when possible.

Fixes #572
edg2s added a commit that referenced this issue May 21, 2024
Also prefer single-line body-less style when possible.

Fixes #572
Krinkle pushed a commit that referenced this issue May 21, 2024
Also prefer single-line body-less style when possible.

Fixes #572.
Closes #573.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants