Troubleshooting ESLint
Quick solutions to common ESLint problems, errors, and configuration issues.Installation Issues
Error: Cannot find module 'eslint'
Error: Cannot find module 'eslint'
Error: peer dependency warning for eslint
Error: peer dependency warning for eslint
Error: Cannot find module '@eslint/js'
Error: Cannot find module '@eslint/js'
@eslint/js package is not installed.Solution:Configuration Issues
Error: ESLint configuration not found
Error: ESLint configuration not found
eslint.config.js.Solutions:1. Create config file:- ✅
eslint.config.js - ✅
eslint.config.mjs - ✅
eslint.config.cjs - ❌
.eslintrc(no longer supported in v10) - ❌
.eslintrc.json(no longer supported in v10)
Error: /* eslint-env */ comments are no longer supported
Error: /* eslint-env */ comments are no longer supported
/* eslint-env */ comments, which are not supported in ESLint v10.Solution:Before (ESLint v8):Error: Invalid configuration object
Error: Invalid configuration object
eslint.config.js has a syntax or structure error.Common mistakes:1. Not exporting an array:Rules not applying to my files
Rules not applying to my files
Error: Failed to load parser
Error: Failed to load parser
@typescript-eslint/parser) is not installed or configured incorrectly.Solution:1. Install parser:Runtime Errors
Error: 'context.getFilename' is not a function
Error: 'context.getFilename' is not a function
context methods removed in ESLint v10.Solution:Before:Error: Unexpected token 'export'
Error: Unexpected token 'export'
Error: Parsing error: Unexpected token
Error: Parsing error: Unexpected token
Error: Failed to load plugin
Error: Failed to load plugin
Performance Issues
ESLint is very slow
ESLint is very slow
Out of memory errors
Out of memory errors
Linting hangs or times out
Linting hangs or times out
Editor Integration Issues
VS Code: ESLint not working
VS Code: ESLint not working
- Install “ESLint” by Microsoft from VS Code marketplace
- View → Output → Select “ESLint” from dropdown
- Look for error messages
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux)- Type “ESLint: Restart ESLint Server”
WebStorm/IntelliJ: ESLint not working
WebStorm/IntelliJ: ESLint not working
- Settings → Languages & Frameworks → JavaScript → Code Quality Tools → ESLint
- Check “Automatic ESLint configuration”
- Settings → Languages & Frameworks → Node.js
- Ensure correct Node.js version (20.19+)
- ESLint settings → Configuration file
- Point to
eslint.config.js
- File → Invalidate Caches / Restart
Conflicting Prettier/ESLint formatting
Conflicting Prettier/ESLint formatting
CI/CD Issues
ESLint passes locally but fails in CI
ESLint passes locally but fails in CI
Exit code 0 even with errors
Exit code 0 even with errors
Migration Issues
Upgrading from v9 to v10
Upgrading from v9 to v10
- ✅ Node.js v20.19.0+
- ✅ Remove
v10_config_lookup_from_fileflag - ✅ Remove
.eslintrcfiles - ✅ Remove
/* eslint-env */comments - ✅ Update
contextmethods in custom rules - ✅ Update
SourceCodemethods
Converting .eslintrc to flat config
Converting .eslintrc to flat config