eslint

(★ 27,468)

Find and fix problems in your JavaScript code.

File Explorer

  • .c8rc
  • .codeclimate.yml
  • .editorconfig
  • .git-blame-ignore-revs
  • .gitattributes
  • .gitignore
  • .markdownlint.yml
  • .npmrc
  • .pre-commit-hooks.yaml
  • .prettierignore
  • .prettierrc.json
  • CHANGELOG.md
  • CONTRIBUTING.md
  • cypress.config.js
  • eslint.config.js
  • knip.jsonc
  • LICENSE
  • Makefile.js
  • package.json
  • README.md
  • SUPPORT.md
  • tsconfig.base.json
  • tsconfig.types-legacy.json
  • tsconfig.types.json
  • webpack.config.js

# Installation Guide

node
Prerequisites

Setup Steps

npm init @eslint/config@latest

Initialize ESLint and create a configuration file.

npx eslint yourfile.js

Run ESLint on the target file to check code quality.

Key Commands

npm init @eslint/config@latest

Interactively configure ESLint for your project and install required packages.

npx eslint src/**/*.js

Perform linting on specific files or directories using ESLint.

If using pnpm, it is recommended to create a .npmrc file with auto-install-peers=true and node-linker=hoisted in the root directory.

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

eslint

View Details ▼

A pluggable linting utility for JavaScript and JSX.

eslint --init

Create the ESLint configuration file:

eslint {{path/to/file1.js path/to/file2.js ...}}

Lint one or more files:

eslint --fix

Fix lint issues:

🔍

npm init

View Details ▼

Create a `package.json` file.

npm init

Initialize a new package with prompts:

npm init {{[-y|--yes]}}

Initialize a new package with default values:

npm init {{create-react-app}} {{my-app}}

Initialize a new package using a specific initializer:

🔍

npm install

View Details ▼

Install Node packages.

npm {{[i|install]}}

Install dependencies listed in `package.json`:

npm {{[i|install]}} {{package_name}}@{{version}}

Download a specific version of a package and add it to the list of dependencies in `package.json`:

npm {{[i|install]}} {{package_name}} {{[-D|--save-dev]}}

Download the latest version of a package and add it to the list of dev dependencies in `package.json`:

🔍

npx

View Details ▼

This command is an alias of `npm exec`.

tldr npm exec

View documentation for the original command:

// repository documentation