27,611
stars
+7+7+-13
5,207
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
ESLint
Website |
Configure ESLint |
Rules |
Contribute to ESLint |
Report Bugs |
Code of Conduct |
X |
Discord |
Mastodon |
Bluesky
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:
- ESLint uses Espree for JavaScript parsing.
- ESLint uses an AST to evaluate patterns in code.
- ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.
Table of Contents
1. Installation and Usage
1. Configuration
1. Version Support
1. Code of Conduct
1. Filing Issues
1. Frequently Asked Questions
1. Releases
1. Security Policy
1. Semantic Versioning Policy
1. ESM Dependencies
1. License
1. Team
1. Sponsors
1. Technology Sponsors
Installation and Usage
Prerequisites
To use ESLint, you must have Node.js (^20.19.0, ^22.13.0, or =24) installed and built with SSL and ICU support. (If you are using an official Node.js distribution, both SSL and ICU are always built in.)
If you use ESLint's TypeScript type definitions, TypeScript 5.3 or later is required.
npm Installation
You can install and configure ESLint using this command:
shell
npm init @eslint/config@latest
After that, you can run ESLint on any file or directory like this:
shell
npx eslint yourfile.js
pnpm Installation
To use ESLint with pnpm, we recommend setting up a .npmrc file with at least the following settings:
text
auto-install-peers=true
node-linker=hoisted
This ensures that pnpm installs dependencies in a way that is more compatible with npm and is less likely to produce errors.
Configuration
You can configure rules in your eslint.config.js files as in this example:
js
import { defineConfig } from "eslint/config";
export default defineConfig([
{
files: ["/.js", "/.cjs", "/.mjs"],
rules: {
"prefer-const": "warn",
"no-constant-binary-expression": "error",
},
},
]);
The names "prefer-const" and "no-constant-binary-expression" are the names of rules in ESLint. The first value is the error level of the rule and can be one of these values:
- "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)
The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the configuration docs).
Version Support
The ESLint team provides ongoing support for the current version and six months of limited support for the previous version. Limited support includes critical bug fixes, security issues, and compatibility issues only.
ESLint offers commercial support for previous versions through our partner, [HeroDevs][herodevs].
See Version Support for more details.
Code of Conduct
ESLint adheres to the OpenJS Foundation Code of Conduct.
Filing Issues
Before filing an issue, please be sure to read the guidelines for what you're reportin