Inclusive Class Name
ID |
javascript.inclusive_class |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
JavaScript |
Tags |
inclusive, naming |
Description
Reports class declarations and class expressions whose name contains a non-inclusive term such as blacklist/whitelist, master/slave, grandfather, dummy or sanity.
Rationale
Non-inclusive terms carry social and historical weight that has no technical value; replacing them with neutral, intent-carrying words (allowlist/denylist, primary/replica, legacy, stub, smoke) makes the code friendlier to contributors and more precise about what it actually describes. Major industry style guides have deprecated these terms.
// Bad
class UserBlacklist { /* ... */ }
class MasterDatabase { /* ... */ }
// Good
class UserDenyList { /* ... */ }
class PrimaryDatabase { /* ... */ }
Anonymous class expressions (const X = class {}) carry no name and are not reported.
Remediation
Rename the class using a neutral equivalent. Common substitutions:
-
blacklist→denylist/blocklist -
whitelist→allowlist -
master→primary/leader/main -
slave→replica/follower/secondary -
grandfather→legacy -
dummy→stub/placeholder -
sanity check→smoke test/check