backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[DX] JS coding standards: ensure there is a space after anonymous functions #3432

Open klonos opened 5 years ago

klonos commented 5 years ago

I think that we should not be deviating from the official Drupal coding standards:

https://www.drupal.org/docs/develop/standards/javascript/javascript-coding-standards#functions

  • The function keyword MUST be followed by one space.
  • Named functions MUST NOT have a space between the function name and the following left parenthesis.

https://github.com/backdrop/backdrop-issues/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc

There should be no space between the function name and the following left parenthesis. ... When defining anonymous functions, there should be no space between the function name and the following left parenthesis.

I think that the last statement is either a type, or will cause DX confusion if intentional. So, two tasks here:

klonos commented 5 years ago

I do not have admin/editor access in api.b.org, so please someone that does can you update the docs (I think that d.org does a good job using bullet points by the way)?

klonos commented 5 years ago

...and let me know if we agree upon having a space in unnamed functions, so that I can start working on a PR 😉

opi commented 5 years ago

Same convention between Drupal, Airbnb, and mostly CrockFord. So agreed!

jenlampton commented 5 years ago

no PR here, removing milestone. Adding the milestone-candidate tag so it can get into the next bug-fix release as soon as we have a PR.