eslint /eslint
Find and fix problems in your JavaScript code.
★ 27,619⑂ 5,203👁 326⑃ 9,060● 11,098▤ 397
+1
日增长
+15
周增长
+56
月增长
27,619
stars
5,203
forks
326
watchers
9,060
prs
11,098
issues
397
releases
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 reportinTop issues
#19118Bug: File ignored because outside of base path (the behaviour of 9.X is different from 8.X)58 comments · 2024-11-09#18696Change Request: Ability to disable autofixes on a per-rule basis47 comments · 2024-07-17#20442Change Request: Evaluate Codemod to replace config migrator and eslint-transforms46 comments · 2026-01-19#18087Change Request: Flat Config does not support FileEnumerator42 comments · 2024-02-06#19418Bug: @types/estree type errors after upgrading ESLint to 9.20.040 comments · 2025-02-10#19173Change Request: Make rules TypeScript syntax-aware39 comments · 2024-11-25#14679Default Severity38 comments · 2021-06-07#14936Feature request: Support snapshot testing36 comments · 2021-08-16
Discussions
#21471eslint-plugin-portable-paths: cross-platform file and directory name checks0 comments · 2026-11-01#21454eslint-plugin-webhook-safety and eslint-plugin-bullmq: rules for webhook and queue bugs that only show up in production0 comments · 2026-10-29#21428Where in eslint's source code is the vsc warning from my defined config added?1 comments · 2026-10-20#21353Sorry, completely lost1 comments · 2026-09-25#21244eslint10-matrix: 54 plugins executed against ESLint 9 and 10, nightly0 comments · 2026-08-22#21231Ways to run it without littering current directory7 comments · 2026-08-16#21228A compact ESLint 9 flat config for a React + Tauri desktop app0 comments · 2026-08-15#21152Clarification requested regarding 'extends' in defineConfig() vs raw Flat Config objects1 comments · 2026-07-27
Latest release
v10.15.0 v10.15.0 2026-11-13Features ec52157 feat: check __proto__ and assignment targets in func-names (21521) (Lê Văn Xuân Hoàn) 34a8b1b feat: recognize string and computed keys in accessor-pairs descriptors (21519) (Lê Văn Xuân Hoàn) 663c825 feat: handle TS type assertions in no-invalid-this (21464) (Valentin) 4941015 feat: check individual specifier importKind in no-shadow (21518) (Lê Văn Xuân Hoàn) 17f17cd feat: update error location to head for default-case (21469) (Tanuj Kanti) Bug Fixes 23ac66c fix: update dependency @eslint/config-array to ^0.23.6 (21550) (renovate[bot]) df71e34 fix: skip no-prototype-b