Lesson 20 / 25

Debugging Linting Issues

Troubleshoot common ESLint and Prettier problems.

Common issues

Config not found, parser errors, plugin conflicts, and rule misconfigurations are common. Use debug mode to trace issues.

Debugging techniques

Use debug flag and --print-config to diagnose issues.

# Enable debug output
DEBUG=eslint* eslint .

# Print effective config for a file
eslint --print-config src/app.js

# Test a single file with verbose output
eslint src/app.js --debug

# Check plugin loading
eslint --print-config src/app.js | grep -A 5 plugins

Output:

Debug output shows config and plugin info

Use CLI vs config

If a rule works via CLI (eslint --fix) but not in your config, check for syntax errors in .eslintrc.json. Validate JSON or YAML.

Quick check

Quick check: How do you debug ESLint config issues?

  • Use DEBUG=eslint* or eslint --print-config to see active rules.
  • Guess and try random configs.
  • Restart the editor.
Answer

Use DEBUG=eslint* or eslint --print-config to see active rules. — Debug output and --print-config help you see which rules are active and why issues occur.