Back to all reviewers

avoid underscore prefixes

discourse/discourse
Based on 3 comments
JavaScript

Do not use underscore prefixes (`_`) for private or internal methods and properties. The team consensus is to avoid this naming convention. Instead, use one of these alternatives:

Naming Conventions JavaScript

Reviewer Prompt

Do not use underscore prefixes (_) for private or internal methods and properties. The team consensus is to avoid this naming convention. Instead, use one of these alternatives:

  1. Remove the prefix entirely for methods that don’t need to be explicitly marked as private
  2. Use proper private syntax with # prefix for truly private class members

Examples:

❌ Avoid:

_isInLightMode() {
  return this.interfaceColor.colorModeIsLight;
}

_getUserColorSchemeDifferences() {
  // implementation
}

✅ Prefer:

// Option 1: Remove prefix
isInLightMode() {
  return this.interfaceColor.colorModeIsLight;
}

// Option 2: Use proper private syntax
#getUserColorSchemeDifferences() {
  // implementation
}

// Option 3: Convert to getter when appropriate
get userColorSchemeDifferences() {
  // implementation
}

This convention improves code clarity and follows modern JavaScript standards while maintaining team consistency.

3
Comments Analyzed
JavaScript
Primary Language
Naming Conventions
Category

Source Discussions