Lesson 6 / 25

Understanding ESLint Rules

Learn how ESLint rules work and enforce code quality.

Rule severity levels

Each rule has a severity: off (disabled), warn (warning), or error (blocks build). Use warn for learning, error for production-critical issues.

Common rules and severities

Set different severity levels for different rules based on importance.

"rules": {
  "no-unused-vars": "warn",
  "no-undef": "error",
  "no-var": "error",
  "prefer-const": "warn",
  "semi": ["error", "always"],
  "no-console": "warn"
}

Output:

Rules configured with mixed severity levels

Progressive enforcement

Start with 'warn' for new rules. Upgrade to 'error' once the team adapts. This reduces friction during adoption.

Quick check

Quick check: What does severity 'error' mean?

  • Blocks the build; must be fixed.
  • Just a warning, doesn't block build.
  • The rule is disabled.
Answer

Blocks the build; must be fixed. — 'error' severity prevents the build from succeeding until the issue is resolved.