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

Question about allowed function call #530

Closed
LinusU opened this issue May 25, 2016 · 5 comments

Comments

@LinusU
Copy link
Member

commented May 25, 2016

Should this style of function calling be allowed? I haven't seen it anywhere in the wild until a coworker tried merging it to one of our repos today...

window.addEventListener
  ('keydown', myKeydownHandler, false)

I feel that the allowed options should be

window.addEventListener('keydown', myKeydownHandler, false)

,

window.addEventListener(
  'keydown',
  myKeydownHandler,
  false
)

and possibly

window.addEventListener(
  'keydown', myKeydownHandler, false
)

as this is what I've seen being used by the community the most.

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented May 25, 2016

window.addEventListener
  ('keydown', myKeydownHandler, false)

seems definitely off. All the other ones feel like a bit of a smell to me, but sure - there's probably a valid use case for them

@timoxley

This comment has been minimized.

Copy link
Contributor

commented May 25, 2016

I use the others on occasion, but parens on a new line seems bad

@feross

This comment has been minimized.

Copy link
Member

commented May 25, 2016

Agreed. The paren should not go on a separate line. I don't think there is an eslint rule for this.

Does someone want to volunteer to open an issue / send a PR to eslint to add this?

@dcousens

This comment has been minimized.

Copy link
Member

commented May 26, 2016

Agreed, that is incredibly confusing.
I use the others on occasion, but never parens on a new line.

@feross

This comment has been minimized.

Copy link
Member

commented Aug 19, 2016

This will be fixed in standard v8! I just replaced the deprecated "no-spaced-func" rule with "func-call-spacing" which checks for this!

Commit: standard/eslint-config-standard@f419de5

Rule: http://eslint.org/docs/rules/func-call-spacing

@feross feross removed the blocked label Aug 19, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

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