Skip to main content

ESLint Rules

ESLint rules are the core of the linter - they analyze your code and report problems. Each rule is independent and can be configured individually.

Rule Types

Rules are categorized by their purpose:
  • Problem Rules: These rules identify code that will cause errors or unexpected behavior
  • Suggestion Rules: These rules suggest alternate ways of doing things
  • Layout Rules: These rules care about how the code looks rather than how it executes

Using Rules

Configure rules in your ESLint configuration file:
module.exports = {
  rules: {
    'semi': ['error', 'always'],
    'quotes': ['error', 'single'],
    'no-unused-vars': 'warn'
  }
};

Rule Severity

Each rule can be set to one of three severity levels:
  • "off" or 0 - turn the rule off
  • "warn" or 1 - turn the rule on as a warning (doesn’t affect exit code)
  • "error" or 2 - turn the rule on as an error (exit code will be 1)

Browse Rules by Category

View rules organized by their purpose:

Search Rules

Use the search below to find specific rules:
You can search by rule name, category, or keywords related to what the rule checks.

Problem Detection

Best Practices

  • eqeqeq - Require === and !==
  • no-eval - Disallow eval()
  • curly - Enforce consistent brace style

Code Style

  • semi - Enforce semicolons
  • quotes - Enforce quote style
  • indent - Enforce consistent indentation