You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
decodeURI
getElementById
XMLHttpRequest
😱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
andXMLHttpRequest
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.
The text was updated successfully, but these errors were encountered: