o9s
is a microblog
home archives search feed blogroll


Rules I Don’t Like On StandardJS

space-before-function-paren

function name (arg) { ... }   // ✓ ok
function name(arg) { ... }    // ✗ avoid

The latter looks better.

semi

window.alert('hi')   // ✓ ok
window.alert('hi');  // ✗ avoid

Again, the latter looks better. I’m too used to semicolons.

comma-dangle

var obj = {
  message: 'hello',   // ✗ avoid
}

Trailing commas are useful for shorter diffs.

But…

Even though there are some rules I don’t like, I am still going to use it vanilla-style. It’s important to have a consistent code style in a project. It’s a hard thing to enforce when multiple developers work in the same codebase. This npm package makes it a much easier goal to achieve.

To install standard, run the following command.

npm install standard --save-dev

To fix your code style, run the following command.

standard --fix

StandardJS

Posted on 2018-02-22   #javascript  






← Next post    ·    Previous post →