Back to all reviewers

use consistent JavaScript syntax

semgrep/semgrep
Based on 2 comments
JavaScript

Maintain consistent use of modern JavaScript syntax throughout networking code to improve reliability and maintainability. Use `const` or `let` instead of `var` for variable declarations, and prefer strict equality (`===`) over loose equality (`==`) for comparisons.

Networking JavaScript

Reviewer Prompt

Maintain consistent use of modern JavaScript syntax throughout networking code to improve reliability and maintainability. Use const or let instead of var for variable declarations, and prefer strict equality (===) over loose equality (==) for comparisons.

This is particularly important in networking code where subtle bugs from variable scoping issues or type coercion can cause runtime errors that are difficult to debug. Consistent syntax also makes the codebase more predictable for team members.

Examples:

// Preferred
const proxy = process.env[ssl ? "HTTPS_PROXY" : "HTTP_PROXY"];
if (globalThis.process.platform === "win32" && path === "NUL") {

// Avoid  
var proxy = process.env[ssl ? "HTTPS_PROXY" : "HTTP_PROXY"];
if (globalThis.process.platform === "win32" && path == "NUL") {
2
Comments Analyzed
JavaScript
Primary Language
Networking
Category

Source Discussions