Skip to main content

Installation Guide

This guide covers everything you need to know about installing and configuring ESLint for your JavaScript or TypeScript project.

System Requirements

Node.js Version

Required: ^20.19.0, ^22.13.0, or >=24ESLint requires Node.js built with SSL support (included in all official distributions).

Package Manager

Supported: npm, yarn, pnpm, or bunAny modern JavaScript package manager will work with ESLint.
Check your Node.js version: node --versionIf you need to upgrade, visit nodejs.org to download the latest LTS version.

Quick Installation

The fastest way to get started is with the interactive configuration tool:
This command will:
  1. Guide you through project-specific setup questions
  2. Install ESLint and required dependencies
  3. Create an eslint.config.js configuration file
  4. Set up appropriate plugins (React, TypeScript, etc.)
The initialization wizard was moved from eslint --init to npm init @eslint/config@latest in ESLint v10. The old command still works but redirects to the new one.

Manual Installation

Install ESLint

Create Configuration File

Create eslint.config.js in your project root:
eslint.config.js

Framework-Specific Setup

Install TypeScript Parser

Configure for TypeScript

eslint.config.js
This setup is based on ESLint’s own TypeScript configuration found in eslint.config.js:331-349

Install React Plugin

Configure for React

eslint.config.js
ESLint natively supports JSX syntax parsing. The React plugin adds semantic rules specific to React development.

Install Vue Plugin

Configure for Vue

eslint.config.js

Install Node Plugin

Configure for Node.js

eslint.config.js

Configuration File Formats

ESLint supports multiple configuration file formats. Choose based on your project setup:
Recommended for modern projects
eslint.config.js
  • Uses ES module syntax
  • Supports top-level await
  • Default for new projects

Understanding the Config Structure

ESLint uses a flat config structure. Here’s a breakdown of the key components from the source:
eslint.config.js

Key Configuration Options

files

Glob patterns for which files to lint:

ignores

Patterns to exclude from linting:

languageOptions

Parser and language settings:

rules

Individual rule configuration:
ESLint’s recommended configuration includes 74 carefully selected rules. Here are some key ones from eslint-recommended.js:1-76:
Rules that catch actual bugs:

Environment-Specific Setup

1

Browser Projects

Configure globals for browser environments:
eslint.config.js
This adds globals like window, document, localStorage, etc.
2

Node.js Projects

Configure for Node.js runtime:
eslint.config.js
This adds globals like process, __dirname, Buffer, etc.
3

Test Environments

Configure for testing frameworks:
eslint.config.js

Package.json Scripts

Add these scripts to your package.json for convenient linting:
package.json
The --max-warnings 0 flag treats warnings as errors, useful for CI/CD pipelines where you want to enforce zero issues.

Verifying Installation

After installation, verify everything is working:
1

Check ESLint Version

2

Verify Configuration

This outputs the resolved configuration for a specific file, useful for debugging.
3

Test on a File

If no errors appear and ESLint runs without issues, you’re all set!

Troubleshooting

Error: Cannot find module 'eslint-plugin-*'Solution: Ensure plugins are installed in the same location as ESLint. With pnpm, make sure your .npmrc has node-linker=hoisted.
Error: ESLint couldn't find a configuration fileSolution: ESLint looks for eslint.config.js, eslint.config.mjs, or eslint.config.cjs in the project root. Check:
  1. File is in the correct location
  2. File name is spelled correctly
  3. File exports a valid configuration
You can also specify a config explicitly:
Error: Parsing error: Unexpected tokenSolution: Install the TypeScript parser:
Update your config:
Issue: ESLint is running slowly on large codebasesSolutions:
  1. Enable caching:
  1. Use parallel processing (ESLint automatically uses available CPU cores):
  1. Ignore unnecessary files:
Error: ESLint requires Node.js version ^20.19.0 || ^22.13.0 || >=24Solution: Upgrade Node.js to a supported version:

Next Steps

Configure Rules

Learn how to customize individual rules for your project

Integrations

Set up ESLint with your editor, build tools, and CI/CD

Create Plugins

Build custom plugins to extend ESLint’s functionality

Migration Guide

Upgrading from an older ESLint version? Check the migration guide

Additional Resources

  • Source Code: The ESLint installation is defined in package.json:1-221 with the binary at bin/eslint.js:1-196
  • CLI Options: Full reference in lib/options.js:1-150+
  • Config API: Exported from lib/config-api.js
  • GitHub: github.com/eslint/eslint
  • Discord: eslint.org/chat