8.57.0 • Published 10 days ago

eslint v8.57.0

Weekly downloads
16,741,292
License
MIT
Repository
github
Last release
10 days ago

NPM version build status Build status Test coverage Downloads Bountysource Join the chat at https://gitter.im/eslint/eslint FOSSA Status

ESLint

Website | Configuring | Rules | Contributing | Reporting Bugs | Code of Conduct | Twitter | Mailing List | Chat Room

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.

Installation and Usage

Prerequisites: Node.js (>=4.x), npm version 2+.

There are two ways to install ESLint: globally and locally.

Local Installation and Usage

If you want to include ESLint as part of your project's build system, we recommend installing it locally. You can do so using npm:

$ npm install eslint --save-dev

You should then setup a configuration file:

$ ./node_modules/.bin/eslint --init

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

$ ./node_modules/.bin/eslint yourfile.js

Any plugins or shareable configs that you use must also be installed locally to work with a locally-installed ESLint.

Global Installation and Usage

If you want to make ESLint available to tools that run across all of your projects, we recommend installing ESLint globally. You can do so using npm:

$ npm install -g eslint

You should then setup a configuration file:

$ eslint --init

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

$ eslint yourfile.js

Any plugins or shareable configs that you use must also be installed globally to work with a globally-installed ESLint.

Note: eslint --init is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.

Configuration

After running eslint --init, you'll have a .eslintrc file in your directory. In it, you'll see some rules configured like this:

{
    "rules": {
        "semi": ["error", "always"],
        "quotes": ["error", "double"]
    }
}

The names "semi" and "quotes" 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).

Sponsors

Team

These folks keep the project moving and are resources for help.

Technical Steering Committee (TSC)

Development Team

Releases

We have scheduled releases every two weeks on Friday or Saturday.

Code of Conduct

ESLint adheres to the JS Foundation Code of Conduct.

Filing Issues

Before filing an issue, please be sure to read the guidelines for what you're reporting:

Semantic Versioning Policy

ESLint follows semantic versioning. However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:

  • Patch release (intended to not break your lint build)
    • A bug fix in a rule that results in ESLint reporting fewer errors.
    • A bug fix to the CLI or core (including formatters).
    • Improvements to documentation.
    • Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
    • Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
  • Minor release (might break your lint build)
    • A bug fix in a rule that results in ESLint reporting more errors.
    • A new rule is created.
    • A new option to an existing rule that does not result in ESLint reporting more errors by default.
    • An existing rule is deprecated.
    • A new CLI capability is created.
    • New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
    • A new formatter is created.
  • Major release (likely to break your lint build)
    • eslint:recommended is updated.
    • A new option to an existing rule that results in ESLint reporting more errors by default.
    • An existing formatter is removed.
    • Part of the public API is removed or changed in an incompatible way.

According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (~) in package.json e.g. "eslint": "~3.1.0" to guarantee the results of your builds.

License

FOSSA Status

Frequently Asked Questions

I heard ESLint is going to replace JSCS?

Yes. Since we are solving the same problems, ESLint and JSCS teams have decided to join forces and work together in the development of ESLint instead of competing with each other. You can read more about this in both ESLint and JSCS announcements.

So, should I stop using JSCS and start using ESLint?

Maybe, depending on how much you need it. JSCS has reached end of life, but if it is working for you then there is no reason to move yet. We are still working to smooth the transition. You can see our progress here. We’ll announce when all of the changes necessary to support JSCS users in ESLint are complete and will start encouraging JSCS users to switch to ESLint at that time.

If you are having issues with JSCS, you can try to move to ESLint. We are focusing our time and energy on JSCS compatibility issues.

Is ESLint just linting or does it also check style?

ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both.

Why can't ESLint find my plugins?

ESLint can be globally or locally installed. If you install ESLint globally, your plugins must also be installed globally; if you install ESLint locally, your plugins must also be installed locally.

If you are trying to run globally, make sure your plugins are installed globally (use npm ls -g).

If you are trying to run locally:

  • Make sure your plugins (and ESLint) are both in your project's package.json as devDependencies (or dependencies, if your project uses ESLint at runtime).
  • Make sure you have run npm install and all your dependencies are installed.

In all cases, make sure your plugins' peerDependencies have been installed as well. You can use npm view eslint-plugin-myplugin peerDepencies to see what peer dependencies eslint-plugin-myplugin has.

Does ESLint support JSX?

Yes, ESLint natively supports parsing JSX syntax (this must be enabled in configuration). Please note that supporting JSX syntax is not the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using eslint-plugin-react if you are using React and want React semantics.

What ECMAScript versions does ESLint support?

ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, and 2018. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through configuration.

What about experimental features?

ESLint doesn't natively support experimental ECMAScript language features. You can use babel-eslint to use any option available in Babel.

Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the TC39 process), we will accept issues and pull requests related to the new feature, subject to our contributing guidelines. Until then, please use the appropriate parser and plugin(s) for your experimental feature.

Where to ask for help?

Join our Mailing List or Chatroom.

react-scripts@wirunekaewjai/reactyoyuo-scriptsvite-plugin-lintwhzbcx_web_comswhzbcx_web_cxwhzbcx_web_cx3whzbcx_web_cxewhzbcx_web_cxgiswhzbcx_web_gwwhzbcx_web_sjzxwhzbcx_web_swdzwhzbcx_web_xjwhzbcx_web_yzwmc-eslintxmi-scriptsxcc-standard-eslintzhouhaifei-react-scripts@bridge-tools/config@adbayb/scripts@beskar-labs/gravity@bsolution/dev@bsolution/fast@bsolution/scripts@azul-tecnologia/eslint-config@arturo.soto/rtve-module-layout@linan919/nan-image-slider@linan919/nan-test@lincworld/eslint-config@linc.world/eslint-config@lintdog/caddi-core-ui@lintdog/eslint-config@lawandorga/components@let/eslint-config@lofty87/cli@londonu/cm3070@minozzzi/eslint-config@modern-js-app/eslint-config@monodrom/monodrom@she11sh0cked/eslint-config@proteria/react-scripts@spongelearning/eslint-config-spongelearning@redrabbit/content-api@tractorzoom/eslint-config@plone/volto@obstinate/react-script@obstinate/vue-script@jvfmatos/templatecomponent@tenatek/eslint-config@tsparticles/options-updater@usama-pixel/facejs@usama-pixel/faceplugin@uukit/react-dev-kit@uukit/scripts@recognition-game/shared@savaleukhin/react-scripts@scentregroup/react-scripts@procore/core-scripts@polkadot/dev@poofcash/poof-core@darkui_team/darkui@dyrkov/eslint-config@eui/deps-base@feward/web@vividcat/broom@talesman/react-scripts@stoked-cenv/cenv-cli@hyunggyujang/typechain-polkadot@insites/cli@modern-js/plugin-lint@npm.piece/eslint-config-npmpiece@onbbu/eslintal-react-scriptscarrier_anal@crispcode/modux-boilerplate@cuiqg/eslint-config@candle-face/shared@gd-uikit/react-scripts@gestaltjs/eslint-plugin@effective/prettier-eslint@elastic/docsmobile@hashicorp/ember-template-lint-config@hashicorp/eslint-config-ember@hashicorp/eslint-config-node@fiuzagr/boot@finer-group/eslint-plugin@giveerr/eslint-config-prettier@giveerr/eslint-config-prettier-javascript@giveerr/eslint-config-prettier-react@giveerr/eslint-config-prettier-typescript@giveerr/rollpkgcreate-thoo-appcreate-thoo-app-authcbbpa-clientcommit-cz-fixdftdevdevdayo-uicodemirror_idedathoang29101997do-fn
9.0.0-beta.2

10 days ago

8.57.0

24 days ago

9.0.0-beta.1

24 days ago

9.0.0-beta.0

1 month ago

9.0.0-alpha.2

2 months ago

9.0.0-alpha.1

2 months ago

9.0.0-alpha.0

3 months ago

8.56.0

3 months ago

8.52.0

5 months ago

8.53.0

5 months ago

8.54.0

4 months ago

8.55.0

4 months ago

8.50.0

6 months ago

8.51.0

5 months ago

8.49.0

6 months ago

8.47.0

7 months ago

8.48.0

7 months ago

8.45.0

8 months ago

8.46.0

8 months ago

8.44.0

9 months ago

8.41.0

10 months ago

8.42.0

10 months ago

8.43.0

9 months ago

8.40.0

11 months ago

8.39.0

11 months ago

8.35.0

1 year ago

8.36.0

1 year ago

8.37.0

12 months ago

8.38.0

12 months ago

8.34.0

1 year ago

8.32.0

1 year ago

8.33.0

1 year ago

8.25.0

1 year ago

8.30.0

1 year ago

8.26.0

1 year ago

8.31.0

1 year ago

8.27.0

1 year ago

8.28.0

1 year ago

8.29.0

1 year ago

8.23.0

2 years ago

8.23.1

2 years ago

8.24.0

1 year ago

8.22.0

2 years ago

8.19.0

2 years ago

8.15.0

2 years ago

8.16.0

2 years ago

8.17.0

2 years ago

8.20.0

2 years ago

8.18.0

2 years ago

8.21.0

2 years ago

8.12.0

2 years ago

8.13.0

2 years ago

8.14.0

2 years ago

8.11.0

2 years ago

8.10.0

2 years ago

8.4.1

2 years ago

8.4.0

2 years ago

8.5.0

2 years ago

8.6.0

2 years ago

8.7.0

2 years ago

8.8.0

2 years ago

8.9.0

2 years ago

8.2.0

2 years ago

8.3.0

2 years ago

8.1.0

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.0-rc.0

2 years ago

8.0.0-beta.2

3 years ago

8.0.0-beta.1

3 years ago

8.0.0-beta.0

3 years ago

7.32.0

3 years ago

7.31.0

3 years ago

7.30.0

3 years ago

7.29.0

3 years ago

7.28.0

3 years ago

7.25.0

3 years ago

7.27.0

3 years ago

7.26.0

3 years ago

7.24.0

3 years ago

7.23.0

3 years ago

7.22.0

3 years ago

7.21.0

3 years ago

7.20.0

3 years ago

7.19.0

3 years ago

7.18.0

3 years ago

7.17.0

3 years ago

7.16.0

3 years ago

7.15.0

3 years ago

7.14.0

3 years ago

7.13.0

3 years ago

7.12.1

3 years ago

7.12.0

3 years ago

7.11.0

3 years ago

7.10.0

3 years ago

7.9.0

4 years ago

7.8.1

4 years ago

7.8.0

4 years ago

7.7.0

4 years ago

7.6.0

4 years ago

7.5.0

4 years ago

7.4.0

4 years ago

7.3.1

4 years ago

7.3.0

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

7.0.0-rc.0

4 years ago

7.0.0-alpha.3

4 years ago

7.0.0-alpha.2

4 years ago

7.0.0-alpha.1

4 years ago

7.0.0-alpha.0

4 years ago

6.8.0

4 years ago

6.7.2

4 years ago

6.7.1

4 years ago

6.7.0

4 years ago

6.6.0

4 years ago

6.5.1

4 years ago

6.5.0

4 years ago

6.4.0

5 years ago

6.3.0

5 years ago

6.2.2

5 years ago

6.2.1

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.1

5 years ago

6.0.0

5 years ago

6.0.0-rc.0

5 years ago

6.0.0-alpha.2

5 years ago

6.0.0-alpha.1

5 years ago

6.0.0-alpha.0

5 years ago

5.16.0

5 years ago

5.15.3

5 years ago

5.15.2

5 years ago

5.15.1

5 years ago

5.15.0

5 years ago

5.14.1

5 years ago

5.14.0

5 years ago

5.13.0

5 years ago

5.12.1

5 years ago

5.12.0

5 years ago

5.11.1

5 years ago

5.11.0

5 years ago

5.10.0

5 years ago

5.9.0

5 years ago

5.8.0

5 years ago

5.7.0

5 years ago

5.6.1

5 years ago

5.6.0

6 years ago

5.5.0

6 years ago

5.4.0

6 years ago

5.3.0

6 years ago

5.2.0

6 years ago

5.1.0

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

5.0.0-rc.0

6 years ago

5.0.0-alpha.4

6 years ago

5.0.0-alpha.3

6 years ago

5.0.0-alpha.2

6 years ago

5.0.0-alpha.1

6 years ago

5.0.0-alpha.0

6 years ago

4.19.1

6 years ago

4.19.0

6 years ago

4.18.2

6 years ago

4.18.1

6 years ago

4.18.0

6 years ago

4.17.0

6 years ago

4.16.0

6 years ago

4.15.0

6 years ago

4.14.0

6 years ago

4.13.1

6 years ago

4.13.0

6 years ago

4.12.1

6 years ago

4.12.0

6 years ago

4.11.0

6 years ago

4.10.0

6 years ago

4.9.0

6 years ago

4.8.0

6 years ago

4.7.2

6 years ago

4.7.1

7 years ago

4.7.0

7 years ago

4.6.1

7 years ago

4.6.0

7 years ago

4.5.0

7 years ago

4.4.1

7 years ago

4.4.0

7 years ago

4.3.0

7 years ago

4.2.0

7 years ago

4.1.1

7 years ago

4.1.0

7 years ago

4.0.0

7 years ago

4.0.0-rc.0

7 years ago

4.0.0-beta.0

7 years ago

4.0.0-alpha.2

7 years ago

4.0.0-alpha.1

7 years ago

4.0.0-alpha.0

7 years ago

3.19.0

7 years ago

3.18.0

7 years ago

3.17.1

7 years ago

3.17.0

7 years ago

3.16.1

7 years ago

3.16.0

7 years ago

3.15.0

7 years ago

3.14.1

7 years ago

3.14.0

7 years ago

3.13.1

7 years ago

3.13.0

7 years ago

3.12.2

7 years ago

3.12.1

7 years ago

3.12.0

7 years ago

3.11.1

7 years ago

3.11.0

7 years ago

3.10.2

7 years ago

3.10.1

7 years ago

3.10.0

7 years ago

3.9.1

7 years ago

3.9.0

7 years ago

3.8.1

7 years ago

3.8.0

7 years ago

3.7.1

7 years ago

3.7.0

7 years ago

3.6.1

7 years ago

3.6.0

7 years ago

3.5.0

8 years ago

3.4.0

8 years ago

3.3.1

8 years ago

3.3.0

8 years ago

3.2.2

8 years ago

3.2.1

8 years ago

3.2.0

8 years ago

3.1.1

8 years ago

3.1.0

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.13.1

8 years ago

2.13.0

8 years ago

2.12.0

8 years ago

2.11.1

8 years ago

2.11.0

8 years ago

2.10.2

8 years ago

2.10.1

8 years ago

2.10.0

8 years ago

2.9.0

8 years ago

2.8.0

8 years ago

2.7.0

8 years ago

2.6.0

8 years ago

2.5.3

8 years ago

2.5.2

8 years ago

2.5.1

8 years ago

2.5.0

8 years ago

2.4.0

8 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

2.0.0-rc.1

8 years ago

2.0.0-rc.0

8 years ago

2.0.0-beta.3

8 years ago

2.0.0-beta.2

8 years ago

2.0.0-beta.1

8 years ago

2.0.0-alpha-2

8 years ago

2.0.0-alpha-1

8 years ago

1.10.3

8 years ago

1.10.2

8 years ago

1.10.1

8 years ago

1.10.0

8 years ago

1.9.0

8 years ago

1.8.0

8 years ago

1.7.3

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.1

8 years ago

1.5.0

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

1.0.0-rc-3

9 years ago

1.0.0-rc-2

9 years ago

1.0.0-rc-1

9 years ago

0.24.1

9 years ago

0.24.0

9 years ago

0.23.0

9 years ago

0.22.1

9 years ago

0.22.0

9 years ago

0.21.2

9 years ago

0.21.1

9 years ago

0.21.0

9 years ago

0.20.0

9 years ago

0.19.0

9 years ago

0.18.0

9 years ago

0.17.1

9 years ago

0.17.0

9 years ago

0.16.2

9 years ago

0.16.1

9 years ago

0.16.0

9 years ago

0.15.1

9 years ago

0.15.0

9 years ago

0.14.1

9 years ago

0.14.0

9 years ago

0.13.0

9 years ago

0.12.0

9 years ago

0.11.0

9 years ago

0.10.2

9 years ago

0.10.1

9 years ago

0.11.0-alpha.0

9 years ago

0.10.0

9 years ago

0.10.0-alpha.2

9 years ago

0.10.0-alpha.1

9 years ago

0.10.0-alpha

9 years ago

0.9.2

9 years ago

0.9.1

9 years ago

0.9.0

9 years ago

0.8.2

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.7.4

10 years ago

0.7.3

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.6.2

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.5

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.1.0-dev

10 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago