Skip to main content

Running ESLint

With your config in place, run ESLint as you normally would.

Lint your code

npx eslint src/

Auto-fix

npx eslint src/ --fix

Add scripts to package.json

For convenience, add these to your package.json:

{
"scripts": {
"lint": "eslint src/",
"lint:fix": "eslint src/ --fix"
}
}

Then run:

npm run lint
npm run lint:fix

What gets enforced

Out of the box, uglier enforces:

  • No semicolons (ASI)
  • Double quotes
  • 2-space indentation
  • No spaces after control keywords (if(x) not if (x))
  • Arrow parens only when needed (x => not (x) =>)
  • 1TBS brace style
  • Mandatory blank lines after control statements
  • No internal object spacing ({a: 1} not { a: 1 })
  • 80 character max line length
  • JSDoc documentation requirements (when using lints-jsdoc)

All of these can be customized — see Customization.