Skip to content

Commit 651649b

Browse files
bpmutternzakas
andauthoredOct 21, 2022
docs: Core concepts page (#16399)
* docs: add stubbed out core concepts page * partial stub out of page * draft full page * copy edits * remove editor generated markdown toc * Apply suggestions from NZ code review Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com> * draft NZ feedback changes * make paragraphs 1-line * copy edits * Apply suggestions from NZ code review Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com> * remove .vscode conf * mention espree Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
1 parent 4715787 commit 651649b

File tree

7 files changed

+90
-7
lines changed

7 files changed

+90
-7
lines changed
 

‎docs/src/pages/rules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ eleventyNavigation:
66
key: rules
77
parent: user guide
88
title: Rules
9-
order: 4
9+
order: 5
1010
---
1111

1212
{% from 'components/rule-categories.macro.html' import ruleCategories, recommended, fixable, hasSuggestions %}

‎docs/src/user-guide/command-line-interface.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ eleventyNavigation:
55
key: command line interface
66
parent: user guide
77
title: Command Line Interface
8-
order: 3
8+
order: 4
99

1010
---
1111

‎docs/src/user-guide/configuring/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ eleventyNavigation:
55
key: configuring
66
parent: user guide
77
title: Configuring
8-
order: 2
8+
order: 3
99

1010
---
1111

‎docs/src/user-guide/core-concepts.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Core Concepts
3+
layout: doc
4+
eleventyNavigation:
5+
key: core concepts
6+
title: Core Concepts
7+
parent: user guide
8+
order: 2
9+
---
10+
11+
This page contains a high-level overview of some of the core concepts of ESLint.
12+
13+
## What is ESLint?
14+
15+
ESLint is a configurable JavaScript linter. It helps you find and fix problems in your JavaScript code. Problems can be anything from potential runtime bugs, to not following best practices, to styling issues.
16+
17+
## Rules
18+
19+
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.
20+
21+
For example, the [`semi`](../rules/semi`) rule lets you specify whether or not JavaScript statements should end with a semicolon (`;`). You can set the rule to either always require semicolons or require that a statement never ends with a semicolon.
22+
23+
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](#plugins).
24+
25+
For more information, refer to [Rules](../rules/).
26+
27+
## Configuration Files
28+
29+
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.
30+
31+
For more information, refer to [Configuration Files](./configuring/configuration-files).
32+
33+
## Shareable Configurations
34+
35+
Shareable configurations are ESLint configurations that are shared via npm.
36+
37+
Often shareable configurations are used to enforce style guides using ESLint's built-in rules. For example the sharable configuration [eslint-config-airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base) implements the popular Airbnb JavaScript style guide.
38+
39+
For more information, refer to [Using a shareable configuration package](./configuring/configuration-files#using-a-shareable-configuration-package).
40+
41+
## Plugins
42+
43+
An ESLint plugin is an npm module that can contain a set of ESLint rules, configurations, processors, and environments. Often plugins include custom rules. Plugins can be used to enforce a style guide and support JavaScript extensions (like TypeScript), libraries (like React), and frameworks (Angular).
44+
45+
A popular use case for plugins is to enforce best practices for a framework. For example, [@angular-eslint/eslint-plugin](https://www.npmjs.com/package/@angular-eslint/eslint-plugin) contains best practices for using the Angular framework.
46+
47+
For more information, refer to [Configuring Plugins](./configuring/plugins.md).
48+
49+
## Parsers
50+
51+
An ESLint parser converts code into an abstract syntax tree that ESLint can evaluate. By default, ESLint uses the built-in [Espree](https://github.com/eslint/espree) parser, which is compatible with standard JavaScript runtimes and versions.
52+
53+
Custom parsers let ESLint parse non-standard JavaScript syntax. Often custom parsers are included as part of shareable configurations or plugins, so you don't have to use them directly.
54+
55+
For example, [@typescript-eslint/parser](npmjs.com/package/@typescript-eslint/parser) is a custom parser included in the [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) project that lets ESLint parse TypeScript code.
56+
57+
## Custom Processors
58+
59+
An ESLint processor extracts JavaScript code from other kinds of files, then lets ESLint lint the JavaScript code. Alternatively, you can use a processor to manipulate JavaScript code before parsing it with ESLint.
60+
61+
For example, [eslint-plugin-markdown](https://github.com/eslint/eslint-plugin-markdown) contains a custom processor that lets you lint JavaScript code inside of Markdown code blocks.
62+
63+
## Formatters
64+
65+
An ESLint formatter controls the appearance of the linting results in the CLI.
66+
67+
For more information, refer to [Formatters](./formatters/index.md).
68+
69+
## Integrations
70+
71+
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.
72+
73+
For more information, refer to [Integrations](./integrations).
74+
75+
## CLI & Node.js API
76+
77+
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.
78+
79+
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.
80+
81+
Unless you are extending ESLint in some way, you should use the CLI.
82+
83+
For more information, refer to [Command Line Interface](./command-line-interface) and [Node.js API](../developer-guide/nodejs-api).

‎docs/src/user-guide/formatters/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ eleventyNavigation:
55
key: formatters
66
parent: user guide
77
title: Formatters
8-
order: 5
8+
order: 6
99
edit_link: https://github.com/eslint/eslint/edit/main/templates/formatter-examples.md.ejs
1010
---
1111

@@ -43,7 +43,7 @@ function addOne(i) {
4343
};
4444
```
4545

46-
### `.eslintrc`:
46+
### `.eslintrc`
4747

4848
```json
4949
{

‎docs/src/user-guide/integrations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ eleventyNavigation:
55
key: integrations
66
parent: user guide
77
title: Integrations
8-
order: 6
8+
order: 7
99

1010
---
1111

‎docs/src/user-guide/migrating-to-8.0.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ eleventyNavigation:
55
key: migrating to v8
66
parent: user guide
77
title: Migrating to v8.x
8-
order: 6
8+
order: 7
99

1010
---
1111

0 commit comments

Comments
 (0)
Please sign in to comment.