liveBook · Manning

ESLint

As explained in "Looks Good to Me"

An open-source JavaScript and TypeScript linting tool that detects coding errors, style violations, and other source-code problems.

ESLint turns team code conventions and selected coding checks into rules that run during development, moving low-stakes debates and cleanup out of code review. section 5.1 section 5.2.1

Teams can introduce ESLint incrementally:

  • Start with a focused rule such as no-console: "error" to catch leftover debugging calls. section 5.1
  • Encode style decisions such as Stroustrup brace placement instead of repeatedly debating them in reviews. section 5.2.1
  • Use warnings while developers adjust, then promote selected rules to errors when the team is ready. section 5.3.2
  • Expand checks to concerns including no-var, duplicate imports, await in loops, equality operators, alerts, consoles, and unnecessary ternaries. section 5.3.2

From a noisy check to a simple condition

A team can configure no-unneeded-ternary and replace let thingToCheck = input === 3 ? true : false; with let thingToCheck = input === 3;. The rule catches the unnecessary complication before review. section 5.3.2

Listing 5.1 ESLint Rule enforcing Stroustrup brace style
// eslint rule that enforces Stroustrup brace style.

brace-style: ["error", "stroustrup"]

Inspect the compact configuration for enforcing Stroustrup brace style, then compare compliant and triggering JavaScript examples. section 5.2.1

Listing 5.7 ESLint Rules used by Adrienne’s team
"rules": {
    no-var: "error",           #1
    no-duplicate-imports: "error",   #2
    no-await-in-loop: "error",       #3
    eqeqeq: "error",                #4
    no-alert: "error",              #5
    no-console: "error",           #6
    no-unneeded-ternary: "error"    #7
}

Browse a representative ESLint ruleset covering declarations, imports, asynchronous loops, equality, debugging remnants, and conditional expressions. section 5.3.2

How "Looks Good to Me" covers it

How deep it goes
Explains rule selection, severity changes, configuration, and representative code, but does not detail ESLint internals or custom rule development.
Examples
Uses no-console, brace-style, declaration, import, asynchronous-loop, equality, alert, and ternary rules with contrasting JavaScript snippets.
What it assumes
Assumes JavaScript development and team conventions, while explaining style rules and gradual warning-to-error adoption.
What you can do after
Apply it via ESLint configuration and editor integration to catch agreed violations before code review.
How it connects
Connects automation with style guides, code conventions, JavaScript, ES6, development environments, and code review.

Also explained in

Compare how 2 books explain ESLint →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of "Looks Good to Me". The section links point to the parts of the book it draws on.