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

Coding Standards: Naming conventions for abbreviated camel-case #2511

Closed
aduth opened this issue Aug 23, 2017 · 2 comments
Closed

Coding Standards: Naming conventions for abbreviated camel-case #2511

aduth opened this issue Aug 23, 2017 · 2 comments
Labels
[Type] Question Questions about the design or development of the editor.

Comments

@aduth
Copy link
Member

aduth commented Aug 23, 2017

How should we capitalize abbreviations and acronyms? This is an area where Core JavaScript Coding Standards are not prescriptive (but perhaps should be).

For example, in assigning a user ID variable, which is preferable:

  • userId
  • userID

The language / DOM are not especially consistent here:

There was a similar discussion in developing adapted standards in Calypso, resulting in camel-case covering abbreviations and acronyms:

https://github.com/Automattic/wp-calypso/blob/master/docs/coding-guidelines/javascript.md#naming-conventions

The reasoning being: It simplified the documentation and thought-process to recommend camelCase for everything, including abbreviations and acronyms.

In retrospect, the language itself is quite consistent on upper-cased abbreviations and acronyms (getElementById and XMLHttpRequest are browser-specific additions). Anecdotally, other libraries tend toward the same, e.g. ReactDOM, TinyMCE. I've started to adopt this in my Gutenberg work (withAPIData), but I feel we should formalize one way or the other, and update inconsistencies (withInstanceId).

Yes, this is a bikeshed.

@aduth aduth added the [Type] Question Questions about the design or development of the editor. label Aug 23, 2017
@mtias
Copy link
Member

mtias commented Nov 20, 2017

Going to close this :)

@aduth
Copy link
Member Author

aduth commented Jul 9, 2018

Effectively closed by #7670.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests

2 participants