Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSpace after function name #318
Comments
This comment has been minimized.
This comment has been minimized.
I like it as stated in #217 (comment) If you adopt it, I bet you'll eventually come to like it. |
jprichardson
closed this
Nov 5, 2015
This comment has been minimized.
This comment has been minimized.
|
So the answer is "just because"? It wouldn't be important if spaces after function name was something someone used, but instead it's a completely goofy choice like 3 spaces for indentation would be. I hope that this "standard" sees only limited adoption, since even if it becomes common, it will look weird to everyone new to JS. |
This comment has been minimized.
This comment has been minimized.
|
@slikts its a bike shed either way. Personally, I didn't like it at first, but, it is more consistent. |
This comment has been minimized.
This comment has been minimized.
|
@slikts The stats in this study show that space-after-function-name style is quite common – 33%. If you're looking for a concrete reason why this style is better, I enjoy being able to search for function definitions vs. function invocations. With this style, it's possible to distinguish the two. For example, search |
dcousens
added
the
question
label
Nov 5, 2015
This comment has been minimized.
This comment has been minimized.
|
Thanks, that's a good answer. |
This comment has been minimized.
This comment has been minimized.
I wonder if that has changed at all with the introduction of standard @feross |
This comment has been minimized.
This comment has been minimized.
|
I'll email the author and see if he wants to update his stats. Might be interesting to see the change. |
This comment has been minimized.
This comment has been minimized.
|
I'm not part of the folks who made this decision, but I can give some anecdotes. I work with a team with various degrees of JavaScript proficiency, and our codebases are often littered with both I see I've probably done the same at some point in the past, but I really wanted to make the way I write JS consistent so I adopted the always-a-space-before style. |
This comment has been minimized.
This comment has been minimized.
tkrotoff
commented
Jan 17, 2016
These stats are wrong: outsideris/popularconvention#62 I did some researches: https://github.com/tkrotoff/space-after-function-name |
yoshuawuyts
added
the
i disagree
label
Jan 17, 2016
This comment has been minimized.
This comment has been minimized.
|
@tkrotoff thanks for the information! |
This comment has been minimized.
This comment has been minimized.
tedstoychev
commented
Oct 10, 2016
|
@feross regarding the:
I would like to share a couple of other (IMO more reliable) methods:
|
This comment has been minimized.
This comment has been minimized.
myknbani
commented
Aug 4, 2017
|
Caught me off-guard as well. I had to search the issues for a |
This comment has been minimized.
This comment has been minimized.
|
The answer is part bunk stats and part making definitions searchable. It's a fair guess that this decision has been one of the main reasons hampering 'standard'.js' adoption. |
This comment has been minimized.
This comment has been minimized.
mikeaustin
commented
Feb 17, 2018
|
In all honesty, it’s actually less consistent, and a hack to make it "searchable”. I agree with every other configuration, and I’ve also adopted trends over time (no semicolon, single quote). I’ve been a JS developer for a long time, and love the functional/immutable direction it’s headed towards. |
slikts commentedNov 5, 2015
What's the reason why spaces after function name rule was chosen? I know this has been asked before, but I didn't see any answer. It just seems orthogonal to the purpose of a standard like this to choose something extremely uncommon in JS or even other languages.