ACROCase
Acronyms Consistently Retain Original Case
The web platform has hundreds of APIs that contain acronyms. With remarkable consistency, those acronyms are kept uppercase:innerHTML, XMLDocument, toJSON, encodeURIComponent. ACROCase is simply a name for the convention that already exists.
Acronyms in Web APIs
Across the DOM, CSS Object Model, and every major browser API, acronyms retain their original casing. This pattern holds whether the acronym appears at the start, middle, or end of an identifier.
| Acronym | Web platform APIs |
|---|---|
| HTML | HTMLElement, HTMLCollection, innerHTML, outerHTML |
| CSS | CSSStyleSheet, CSSRule, CSSStyleDeclaration |
| DOM | DOMParser, DOMRect, DOMTokenList, DOMException |
| SVG | SVGElement, SVGPathElement, SVGRectElement |
| URL | URL, URLSearchParams, URLPattern, createObjectURL |
| URI | encodeURI, decodeURI, encodeURIComponent |
| JSON | JSON.parse(), JSON.stringify(), toJSON |
| XML | XMLDocument, XMLSerializer, XMLHttpRequest |
| GPU | GPUDevice, GPUBuffer, GPUTexture, GPUAdapter |
| RTC | RTCPeerConnection, RTCDataChannel, RTCSessionDescription |
| IDB | IDBDatabase, IDBObjectStore, IDBTransaction |
| USB | USB, USBDevice, USBConfiguration |
| HID | HID, HIDDevice, HIDConnectionEvent |
| MIDI | MIDIAccess, MIDIInput, MIDIOutput |
| GATT | BluetoothRemoteGATTServer, BluetoothRemoteGATTService |
| BYOB | ReadableStreamBYOBReader, ReadableStreamBYOBRequest |
| VTT | VTTCue, VTTRegion |
| XR | XRSystem, XRSession, XRFrame |
| DTMF | RTCDTMFSender, RTCDTMFToneChangeEvent |
This is not a handful of cherry-picked examples. There are over a hundred HTML*Element interfaces, over eighty SVG* interfaces, over fifty CSS* interfaces, and over thirty each for GPU*, RTC*, and XR*. The pattern is the default, not the exception.
Abbreviations That Are Not Acronyms
Not everything short is an acronym. The web platform draws a clear line between acronyms (which stay uppercase) and abbreviations (which follow normal casing).
Id
Id is an abbreviation for "identifier," not an acronym. The DOM uses it consistently: getElementById, elementId, clientId, requestId. Writing userID is wrong by web platform convention.
Intl
The Internationalization API is Intl, not INTL. It follows normal PascalCase as an abbreviation, not an acronym.
Where It Breaks Down
The convention is not perfectly consistent. Every exception tells a story about what happens when acronyms collide.
XMLHttpRequest
The most famous API on the web gets its own acronyms wrong.XML is uppercase, but Http is titlecased. By the web platform's own rules, it should be XMLHTTPRequest.
But read XMLHTTP out loud. Where does XML end and HTTP begin? This is the original sin of acronym chaining: two uppercase acronyms next to each other produce an unreadable wall of capitals. The titlecasing of Http was a readability compromise, and it happened so early in the web's history that it became the name everyone knows.
The Web Crypto API
AES, RSA, HMAC, and SHA are universally recognized as acronyms. But the Web Crypto API titlecases all of them:
AesCbcParams, notAESCBCParamsRsaOaepParams, notRSAOAEPParamsHmacKeyGenParams, notHMACKeyGenParams
The same chaining problem drove this decision. Most crypto parameter types combine two acronyms (AES+CBC, RSA+OAEP), and the team chose to titlecase everything for internal consistency rather than mix styles. This means even AesKeyGenParamsis titlecased, where AESKeyGenParams would have been perfectly readable.
WebRTC Sub-Protocols
WebRTC keeps RTC uppercase in every interface name: RTCPeerConnection, RTCDataChannel, RTCDTMFSender. But when a second acronym follows RTC, it gets titlecased:
RTCDtlsTransport, notRTCDTLSTransportRTCRtpSender, notRTCRTPSenderRTCSctpTransport, notRTCSCTPTransport
Unlike the Crypto API, WebRTC only titlecases where chaining actually occurs.RTCDTMF would be unreadable, so RTCDTMFSender is... wait. That one actually keeps DTMF uppercase. The inconsistency runs deep.
The Pattern
Every exception to uppercase acronyms in the web platform exists because two acronyms ended up next to each other. The solution is always the same: titlecase one of them. The convention itself is never in question. The problem is always chaining.
When naming new code, restructure to avoid adjacent acronyms. When that is not possible, titlecasing the second acronym is the established precedent.
The Convention
ACROCase is camelCase with one rule: known acronyms keep their uppercase form.
| acroCase | UpperACROCase | |
|---|---|---|
| Acronym at start | urlString | URLString |
| Acronym at end | imageURL | ImageURL |
| Multiple acronyms | htmlToJSON | HTMLToJSON |
When an acronym starts a camelCase identifier, it is lowercased like any other first word: urlString, httpRequest, jsonData. In UpperACROCase (PascalCase with acronyms), it stays uppercase: URLString, HTTPRequest, JSONData.
ESLint Plugin
eslint-plugin-acrocase enforces the convention automatically:
npm install eslint-plugin-acrocase --save-dev{
"plugins": ["acrocase"],
"rules": {
"acrocase/acrocase": "error"
}
}The rule is auto-fixable. It ships with a dictionary of 139 acronyms sourced from web platform APIs and common programming usage. Add project-specific acronyms through configuration:
{
"acrocase/acrocase": ["error", {
"acronyms": ["GCP", "NATS"]
}]
}If you use ESLint's built-in camelcase rule, disable it. It enforces lowercase acronyms, which contradicts the web platform.