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

Space before function arguments (space-after-function) (space-after-named-function) #608

Closed
adius opened this issue Jan 27, 2015 · 16 comments

Comments

@adius
Copy link

adius commented Jan 27, 2015

There should be flag to force a space before the function arguments like this:

function foo (bar, baz) {
    // …
}

maybe: {"space_before_arguments": true}

@bitwiseman
Copy link
Member

There's a --space-after-anon-function. Probably call this --space-after-function.

@bcomnes
Copy link

bcomnes commented Feb 16, 2015

👍

@doque
Copy link

doque commented Aug 18, 2015

Yes, please.

@yeahoffline
Copy link

so?

@bitwiseman
Copy link
Member

It's an enhancement. I'm fixing higher priority issues. Pull requests are welcome.

@atripes
Copy link

atripes commented Mar 29, 2016

Can somebody please point me in a direction on how to hack this into /js/lib/beautify.js myself? In line 681 I found the statement handling anon_functions. I couldn't get anything going by fiddling with different kinds of statements, e.g.: if (current_token.text === '(' && last_last_word === 'function') ...

@jsejcksn
Copy link

@bitwiseman I think calling it --space-after-named-function would be the most clear, yes? Like @atrioom, I'm interested to work on this. Where do I start?

@jsejcksn
Copy link

jsejcksn commented Sep 1, 2016

@atrioom I don't really know what I'm looking at, but maybe here's a good place to look?

@bitwiseman
Copy link
Member

@jsejcksn - Name sounds fine.
And you're in the right area, but you'll want to separate else if with last_type === 'TK_WORD'.

@laggingreflex
Copy link

Please also consider async functions

const a = async () {...}
async function b () {...}

@lironess
Copy link

--space-after-named-function is a good name

@zekida
Copy link

zekida commented Mar 17, 2017

+1
i do really hope this gets some more attention as 'javascript standard style' is getting more popular.

@tahaerden
Copy link

@zekida And it should, it's "standard"! 😄

@bitwiseman
Copy link
Member

NOTE: When implemented this will need to not break "dynamic import()" - #1393

@bitwiseman bitwiseman changed the title Space before function arguments Space before function arguments (space-after-function) Jun 30, 2018
@jaysaurus
Copy link

jaysaurus commented Sep 25, 2018

Not to sound mean, but given this is a specification of js standard it's kind of surprising it hasn't been a higher priority. I imagine most of us lint with standard these days, heck, most Vue frameworks have it by default. It kind of renders the whole thing pretty redundant if you have to go back and tidy up the spaces.

@bitwiseman
Copy link
Member

bitwiseman commented Sep 25, 2018

@jaysaurus
The existence of this project (and its ever growing list of requests for different formatting options) is one more living proof that formatting wars are alive and well in the land of JavaScript. Your "standard" is an other developer's "never-doing-it-that-way".

You are absolutely right: it would be great if there were more people willing to spend the time to implement features for this widely used library. If only there were more contributors...

@bitwiseman bitwiseman modified the milestones: v1.8.x, v1.8.7 Oct 12, 2018
@bitwiseman bitwiseman changed the title Space before function arguments (space-after-function) Space before function arguments (space-after-function) (space-after-named-function) Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests