Course contentsShow
← JavaScript
Lesson 2602 of 2,72352. Linting and FormattingFree lesson

What Linters Actually Do

Understanding that linters analyze code for errors, style issues, and potential bugs without executing it.

What Linters Actually Do

You'll learn: How linters analyze your code without running it to catch errors, style issues, and potential bugs.

The Core Concept

A linter is a static analysis tool. The key word here is "static"—it reads and examines your code as plain text, checking it against rules and patterns, but never executes it. Think of a linter like a grammar checker for your writing: it scans sentences for mistakes and style violations without needing to "speak" them aloud.

When you run ESLint (or any linter), it:

  1. Parses your code into an Abstract Syntax Tree (AST)—a structured representation of your code's logic
  2. Checks each node of that tree against configured rules
  3. Reports violations when patterns match known problems or style preferences

What Linters Catch

Linters look for three main categories:

  • Syntax errors: Malformed code that would break at runtime (const x =;)
  • Logic errors: Valid syntax but likely bugs (unused variables, unreachable code)
  • Style issues: Code that works but violates team conventions (spacing, quotes, naming)

The Power of Static Analysis

Because linters don't execute code, they're fast and safe. They can analyze thousands of lines in seconds without worrying about infinite loops, API calls, or side effects. They catch issues before runtime—often before you even save the file if your editor is configured properly.

However, linters have limits: they can't catch runtime-only bugs (like type mismatches in loosely-typed operations) or logic errors that require execution context to understand.

Key Takeaway: Linters perform static code analysis—scanning and checking your code against rules without running it—to catch errors, bugs, and style violations early in development.