Back to all reviewers

Use modern syntax

discourse/discourse
Based on 5 comments
Other

Adopt modern JavaScript and Ember syntax patterns instead of legacy approaches to improve code readability and maintainability. Key modern patterns to use:

Code Style Other

Reviewer Prompt

Adopt modern JavaScript and Ember syntax patterns instead of legacy approaches to improve code readability and maintainability.

Key modern patterns to use:

Native private methods - Use # prefix instead of underscore convention:

// ❌ Legacy
_buildEventObject(from, to) {
  // implementation
}

// ✅ Modern
#buildEventObject(from, to) {
  // implementation  
}

Boolean attributes - Use proper boolean syntax instead of explicit true/false:

<!-- ❌ Legacy -->
<input disabled=true />

<!-- ✅ Modern -->
<input disabled />

Optional chaining - Use ?. for cleaner conditional calls:

// ❌ Legacy
if (this.onBlur) {
  this.onBlur(this.normalize(this.hexValue));
}

// ✅ Modern  
this.onBlur?.(this.normalize(this.hexValue));

Modern array methods - Use .at() for array access:

// ❌ Legacy
const lastWord = words[words.length - 1];

// ✅ Modern
const lastWord = words.at(-1);

These modern syntax patterns are now well-supported and provide cleaner, more expressive code that aligns with current JavaScript and Ember best practices.

5
Comments Analyzed
Other
Primary Language
Code Style
Category

Source Discussions