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:

  • blacklistdenylist / blocklist

  • whitelistallowlist

  • masterprimary / leader / main

  • slavereplica / follower / secondary

  • grandfatherlegacy

  • dummystub / placeholder

  • sanity checksmoke test / check

Configuration

The list of non-inclusive terms is configurable via the terms property in the YAML configuration:

properties:
  terms:
    - blacklist
    - whitelist
    - master
    - slave
    - grandfather
    - dummy
    - sanity
    - your-custom-term