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
Space after function keyword in anonymous functions #3847
Comments
why not provide a |
+1 for space after
|
y, For a generic tools, we need keep simple options as possible. but lots of project lint with |
@allex Don't lint stylistic issues when you use Prettier and all the problems are gone. If you say that generic tools should provide simple options why is standard not providing an option to turn stylistic linting off? |
How should a generator function be formatted? const identity = function *(value) {
// ^ space here
return value;
}
// or:
const identity = function* (value) {
// ^ space here
return value;
}
// or:
const identity = function * (value) {
// ^ ^ spaces here
return value;
} |
Since this is all about consistency with named functions, the spaces should be exactly like for a named generator function. |
I agree with @lydell. In this case, I'd consider the keyword to be |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm down to have that as default without an option for Version 2. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think we should reopen #3903 and merge to next branch |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Removing the “help wanted” label, because we already have #3903. Code is the easy part here. This requires some core coordination to get done. |
See #7028 for a related discussion about generator stars. I think consideration of generator stars is the strongest argument for adding a space after the function keyword. Also IMO having this done as an option is the worst of all possible choices. |
I modified the milestone to 2.0. if there is problems please let me know |
* Always add a space after the `function` keyword * WIP update snapshots * WIP put generator function asterisk before space #3847 (comment) * WIP update snapshots * Add changelog * Add tests for anonymouse generator function * print space between `function` and generator star * update changelog * print space between yield and * Co-authored-by: Joseph Frazier <1212jtraceur@gmail.com> Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com> Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
fixed by #3903 |
NOTE: This issue is raised due to confusion in #1139.
This issue is only about anonymous functions:
(Prettier currently does not put a space there.)
The key argument is:
Consistency: This means that there's always a space after the
function
keyword.The text was updated successfully, but these errors were encountered: