Why you should always use a Linter

…and/or a pretty formatter

Alberto Gimeno
Jun 22, 2017 · 4 min read
const runnable = {}
if (Math.random() < 0.0001) {
runable.run()
}
const fs = require('fs')fs.readFile('foo.txt', 'utf8', (err, data) => {
console.log('data', data.toLowerCase())
})

Automation

Using a plugin in your text editor

Create an NPM script

{
"name": "my-cool-package",
"devDependencies": {
"standard": "*"
},
"scripts": {
"lint": "standard",
"test": "npm run lint && test-runner-name"
}
}

Git hook

Automatic fixes

Prettier

foo(arg1, arg2, arg3, arg4);
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);

Other style guides

DailyJS

JavaScript news and opinion.