JavaScript / TypeScript Styleguide

Semicolons vs No Semicolons

To semicolon or not to semicolon? Explore the JavaScript style war with real-world data from popular open source projects.

73%

Use Semicolons

27%

Use No Semicolons

Team Semicolons

Explicit, traditional, and leaves nothing to chance with JavaScript's automatic semicolon insertion.

Code Example

example.js (with semicolons)
function greet(name) {
  const message = `Hello, ${name}!`;
  console.log(message);
  return message;
}

const users = ["Alice", "Bob"];
users.forEach((user) => {
  greet(user);
});

Key Benefits

  • Explicit statement termination
  • Avoids ASI edge cases and gotchas
  • Traditional C-family syntax style
  • Clear visual separation of statements
  • Safer for minification and bundling
  • Preferred by TypeScript and Java developers

Statistics

Team No Semicolons

Clean, minimal, and trusts JavaScript's automatic semicolon insertion to do the right thing.

Code Example

example.js (no semicolons)
function greet(name) {
  const message = `Hello, ${name}!`
  console.log(message)
  return message
}

const users = ["Alice", "Bob"]
users.forEach((user) => {
  greet(user)
})

Key Benefits

  • Cleaner, less cluttered code
  • Fewer keystrokes and characters
  • JavaScript handles it automatically
  • Popular in modern frameworks
  • Enforced by StandardJS style
  • Common in Vue.js and other ecosystems

Statistics

Additional Insights

More data points to help you make an informed decision for your team.

995

repositories analyzed