This page contains a high-level overview of some of the core concepts of ESLint.
What is ESLint?
Rules are the core building block of ESLint. A rule validates if your code meets a certain expectation, and what to do if it does not meet that expectation. Rules can also contain additional configuration options specific to that rule.
For example, the
;). You can set the rule to either always require semicolons or require that a statement never ends with a semicolon.
ESLint contains hundreds of built-in rules that you can use. You can also create custom rules or use rules that others have created with plugins.
For more information, refer to Rules.
An ESLint configuration file is a place where you put the configuration for ESLint in your project. You can include built-in rules, how you want them enforced, plugins with custom rules, shareable configurations, which files you want rules to apply to, and more.
For more information, refer to Configuration Files.
Shareable configurations are ESLint configurations that are shared via npm.
For more information, refer to Using a shareable configuration package.
A popular use case for plugins is to enforce best practices for a framework. For example, @angular-eslint/eslint-plugin contains best practices for using the Angular framework.
For more information, refer to Configure Plugins.
For example, @typescript-eslint/parser is a custom parser included in the typescript-eslint project that lets ESLint parse TypeScript code.
An ESLint formatter controls the appearance of the linting results in the CLI.
For more information, refer to Formatters.
One of the things that makes ESLint such a useful tool is the ecosystem of integrations that surrounds it. For example, many code editors have ESLint extensions that show you the ESLint results of your code in the file as you work so that you don’t need to use the ESLint CLI to see linting results.
For more information, refer to Integrations.
CLI & Node.js API
The ESLint CLI is a command line interface that lets you execute linting from the terminal. The CLI has a variety of options that you can pass to its commands.
The ESLint Node.js API lets you use ESLint programmatically from Node.js code. The API is useful when developing plugins, integrations, and other tools related to ESLint.
Unless you are extending ESLint in some way, you should use the CLI.
For more information, refer to Command Line Interface and Node.js API.