ESLint plugin to enforce ACROCase naming conventions.
Acronyms Consistently Retain Original Case
npm install eslint-plugin-acrocase --save-dev{
"plugins": ["acrocase"],
"rules": {
"acrocase/acrocase": "error"
}
}Or use the recommended config:
{
"extends": ["plugin:acrocase/recommended"]
}The rule enforces that known acronyms retain their uppercase form in camelCase and PascalCase identifiers. It also catches abbreviations that are commonly mistaken for acronyms (like ID instead of Id).
const imageURL = "https://example.com/img.png";
const userId = 12345;
element.innerHTML = "<p>Hello</p>";
data.toJSON();
class HTTPClient {}
class APIResponse {}const imageUrl = "https://example.com/img.png"; // imageURL
const userID = 12345; // userId
data.toJson(); // toJSON
class HttpClient {} // HTTPClient
class ApiResponse {} // APIResponseAdd project-specific acronyms on top of the built-in dictionary:
{
"acrocase/acrocase": ["error", {
"acronyms": ["GCP", "NATS"]
}]
}The rule is fixable. Run eslint --fix to correct violations automatically.
The plugin ships with a dictionary of common acronyms sourced from web platform APIs and general programming. It includes exceptions for abbreviations like Id and Intl that follow normal casing despite looking like acronyms.
MIT