/core-rules)
    * [ Governance ](/docs/latest/contribute/governance)
    * [ Report a Security Vulnerability ](/docs/latest/contribute/report-security-vulnerability)
  * [ Maintain ESLint ](/docs/latest/maintain/)
    * [ How ESLint is Maintained ](/docs/latest/maintain/overview)
    * [ Manage Issues and Pull Requests ](/docs/latest/maintain/manage-issues)
    * [ Review Pull Requests ](/docs/latest/maintain/review-pull-requests)
    * [ Manage Releases ](/docs/latest/maintain/manage-releases)
    * [ Working Groups ](/docs/latest/maintain/working-groups)

#  Getting Started with ESLint

##  Table of Contents

  1. Prerequisites 
  2. Quick start 
  3. Configuration 
  4. Global Install 
  5. Manual Set Up 
  6. Next Steps 

ESLint is a tool for identifying and reporting on patterns found in
ECMAScript/JavaScript code, with the goal of making code more consistent and
avoiding bugs.

ESLint is completely pluggable. Every single rule is a plugin and you can add
more at runtime. You can also add community plugins, configurations, and
parsers to extend the functionality of ESLint.

##  Prerequisites

To use ESLint, you must have [ Node.js ](https://nodejs.org/en/) ( ` ^18.18.0
` , ` ^20.9.0 ` , or ` >=21.1.0 ` ) installed and built with SSL support. (If
you are using an official Node.js distribution, SSL is always built in.)

##  Quick start

You can install and configure ESLint using this command:

    
    
    npm init @eslint/config
    
    
    1  
    

If you want to use a specific shareable config that is hosted on npm, you can
use the ` --config ` option and specify the package name:

    
    
    # use `eslint-config-standard` shared config
    
    # npm 7+
    npm init @eslint/config -- --config eslint-config-standard
    
    
    
    1  
    2  
    3  
    4  
    5  
    

**Note:** ` npm init @eslint/config ` assumes you have a ` package.json ` file
already. If you don’t, make sure to run ` npm init ` or ` yarn init `
beforehand.

After that, you can run ESLint on any file or directory like this:

    
    
    npx eslint yourfile.js
    
    # or
    
    yarn run eslint yourfile.js
    
    
    1  
    2  
    3  
    4  
    5  
    

##  Configuration

**Note:** If you are coming from a version before 9.0.0 please see the [
migration guide ](configure/migration-guide) .

After running ` npm init @eslint/config ` , you’ll have an ` eslint.config.js
` (or ` eslint.config.mjs ` ) file in your directory. In it, you’ll see some
rules configured like this:

    
    
    // eslint.config.js
    export default [
        {
            rules: {
                "no-unused-vars": "error",
                "no-undef": "error"
            }
        }
    ];
    
    
    1  
    2  
    3  
    4  
    5  
    6  
    7  
    8  
    9  
    

The names ` "no-unused-vars" ` and ` "no-undef" ` are the names of [ rules
](../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 ](configure/) ).

Your ` eslint.config.js ` configuration file will also include a recommended
configuration, like this:

    
    
    // eslint.config.js
    import js from "@eslint/js";
    
    export default [
        js.configs.recommended,
    
        {
            rules: {
                "no-unused-vars": "warn",
                "no-undef": "warn"
            }
        }
    ];
    
    
    1  
    2  
    3  
    4  
    5  
    6  
    7  
    8  
    9  
    10  
    11  
    12  
    13  
    

The ` js.configs.recommended ` object contains configuration to ensure that
all of the rules marked as recommended on the [ rules page