Skip to content

Commit a2f888d

Browse files
authored
docs: enhance documentation with links and fix typos (#19761)
* docs: enhance documentation with links and fix typos * wip * wip: address comments * revert: `formatters/index.md` * wip: address comments * wip
1 parent dbba058 commit a2f888d

File tree

12 files changed

+49
-44
lines changed

12 files changed

+49
-44
lines changed

docs/src/extend/ways-to-extend.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This page explains the ways to extend ESLint, and how these extensions all fit t
1515

1616
Plugins let you add your own ESLint custom rules and custom processors to a project. You can publish a plugin as an npm module.
1717

18-
Plugins are useful because your project may require some ESLint configuration that isn't included in the core `eslint` package. For example, if you're using a frontend JavaScript library like React or framework like Vue, these tools have some features that require custom rules outside the scope of the ESLint core rules.
18+
Plugins are useful because your project may require some ESLint configuration that isn't included in the core `eslint` package. For example, if you're using a frontend JavaScript library like [React](https://react.dev/) or framework like [Vue](https://vuejs.org/), these tools have some features that require custom rules outside the scope of the ESLint core rules.
1919

2020
Often a plugin is paired with a configuration for ESLint that applies a set of features from the plugin to a project. You can include configurations in a plugin as well.
2121

@@ -35,15 +35,15 @@ ESLint shareable configs are pre-defined configurations for ESLint that you can
3535

3636
You can either publish a shareable config independently or as part of a plugin.
3737

38-
For example, a popular shareable config is [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb), which contains a variety of rules in addition to some [parser options](../use/configure/language-options#specifying-parser-options). This is a set of rules for ESLint that is designed to match the style guide used by the [Airbnb JavaScript style guide](https://github.com/airbnb/javascript). By using the `eslint-config-airbnb` shareable config, you can automatically enforce the Airbnb style guide in your project without having to manually configure each rule.
38+
For example, a popular shareable config is [`eslint-config-airbnb`](https://www.npmjs.com/package/eslint-config-airbnb), which contains a variety of rules in addition to some [parser options](../use/configure/language-options#specifying-parser-options). This is a set of rules for ESLint that is designed to match the style guide used by the [Airbnb JavaScript style guide](https://github.com/airbnb/javascript). By using the `eslint-config-airbnb` shareable config, you can automatically enforce the Airbnb style guide in your project without having to manually configure each rule.
3939

40-
To learn more about creating a shareable config, refer to [Share Configuration](shareable-configs).
40+
To learn more about creating a shareable config, refer to [Share Configurations](shareable-configs).
4141

4242
## Custom Formatters
4343

4444
Custom formatters take ESLint linting results and output the results in a format that you define. Custom formatters let you display linting results in a format that best fits your needs, whether that's in a specific file format, a certain display style, or a format optimized for a particular tool. You only need to create a custom formatter if the [built-in formatters](../use/formatters/) don't serve your use case.
4545

46-
For example, the custom formatter [eslint-formatter-gitlab](https://www.npmjs.com/package/eslint-formatter-gitlab) can be used to display ESLint results in GitLab code quality reports.
46+
For example, the custom formatter [eslint-formatter-gitlab](https://www.npmjs.com/package/eslint-formatter-gitlab) can be used to display ESLint results in [GitLab](https://about.gitlab.com/) code quality reports.
4747

4848
To learn more about creating a custom formatter, refer to [Custom Formatters](custom-formatters).
4949

docs/src/integrate/nodejs-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ While ESLint is designed to be run on the command line, it's possible to use ESL
1515

1616
The `ESLint` class is the primary class to use in Node.js applications.
1717

18-
This class depends on the Node.js `fs` module and the file system, so you cannot use it in browsers. If you want to lint code on browsers, use the [Linter](#linter) class instead.
18+
This class depends on the Node.js [`fs`](https://nodejs.org/api/fs.html) module and the file system, so you cannot use it in browsers. If you want to lint code on browsers, use the [`Linter`](#linter) class instead.
1919

2020
Here's a simple example of using the `ESLint` class:
2121

@@ -68,7 +68,7 @@ const { ESLint } = require("eslint");
6868
});
6969
```
7070

71-
And here is an example of using the `ESLint` class with `lintText` API:
71+
And here is an example of using the `ESLint` class with [`lintText`](#-eslintlinttextcode-options) API:
7272

7373
```js
7474
const { ESLint } = require("eslint");

docs/src/pages/flags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ The `ESLint` class also reads the `ESLINT_FLAGS` environment variable to set fla
114114

115115
### Enable Feature Flags in VS Code
116116

117-
To enable flags in the VS Code ESLint Extension for the editor, specify the flags you'd like in the `eslint.options` setting in your `settings.json` file:
117+
To enable flags in the VS Code ESLint Extension for the editor, specify the flags you'd like in the `eslint.options` setting in your [`settings.json`](https://code.visualstudio.com/docs/configure/settings#_settings-json-file) file:
118118

119119
```json
120120
{

docs/src/use/command-line-interface.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The ESLint Command Line Interface (CLI) lets you execute linting from the termin
1414

1515
## Run the CLI
1616

17-
ESLint requires Node.js for installation. Follow the instructions in the [Getting Started Guide](getting-started) to install ESLint.
17+
ESLint requires [Node.js](https://nodejs.org/) for installation. Follow the instructions in the [Getting Started Guide](getting-started) to install ESLint.
1818

1919
Most users use [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) to run ESLint on the command line like this:
2020

@@ -193,7 +193,7 @@ This example uses the configuration file at `~/my.eslint.config.js`, which is us
193193

194194
#### `--inspect-config`
195195

196-
**Flat Config Mode Only.** This option runs `npx @eslint/config-inspector@latest` to start the config inspector. You can use the config inspector to better understand what your configuration is doing and which files it applies to. When you use this flag, the CLI does not perform linting.
196+
**Flat Config Mode Only.** This option runs `npx @eslint/config-inspector@latest` to start the [config inspector](https://github.com/eslint/config-inspector). You can use the config inspector to better understand what your configuration is doing and which files it applies to. When you use this flag, the CLI does not perform linting.
197197

198198
- **Argument Type**: No argument.
199199

@@ -839,7 +839,7 @@ Strategy for the cache to use for detecting changed files.
839839
- **Multiple Arguments**: No
840840
- **Default Value**: `metadata`
841841

842-
The `content` strategy can be useful in cases where the modification time of your files changes even if their contents have not. For example, this can happen during git operations like `git clone` because git does not track file modification time.
842+
The `content` strategy can be useful in cases where the modification time of your files changes even if their contents have not. For example, this can happen during git operations like [`git clone`](https://git-scm.com/docs/git-clone) because git does not track file modification time.
843843

844844
##### `--cache-strategy` example
845845

@@ -922,7 +922,7 @@ Ignore unused suppressions. By default, ESLint exits with exit code `2` and disp
922922

923923
#### `--init`
924924

925-
This option runs `npm init @eslint/config` to start the config initialization wizard. It's designed to help new users quickly create an `.eslintrc` file by answering a few questions. When you use this flag, the CLI does not perform linting.
925+
This option runs `npm init @eslint/config` to start the config initialization wizard. It's designed to help new users quickly create an `eslint.config.js` file by answering a few questions. When you use this flag, the CLI does not perform linting.
926926

927927
- **Argument Type**: No argument.
928928

@@ -1105,5 +1105,5 @@ This option starts the ESLint MCP server for use with AI agents.
11051105
When linting files, ESLint exits with one of the following exit codes:
11061106

11071107
- `0`: Linting was successful and there are no linting errors. If the [`--max-warnings`](#--max-warnings) flag is set to `n`, the number of linting warnings is at most `n`.
1108-
- `1`: Linting was successful and there is at least one linting error, or there are more linting warnings than allowed by the `--max-warnings` option.
1108+
- `1`: Linting was successful and there is at least one linting error, or there are more linting warnings than allowed by the [`--max-warnings`](#--max-warnings) option.
11091109
- `2`: Linting was unsuccessful due to a configuration problem or an internal error.

docs/src/use/configure/combine-configs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In many cases, you won't write an ESLint config file from scratch, but rather, y
1111

1212
## Apply a Config Object
1313

14-
If you are importing an object from another module, in most cases, you can just pass the object directly to the `defineConfig()` helper. For example, you can use the recommended rule configurations for JavaScript by importing the `recommended` config and using it in your array:
14+
If you are importing a [config object](../core-concepts/glossary#config-object) from another module, in most cases, you can just pass the object directly to the `defineConfig()` helper. For example, you can use the recommended rule configurations for JavaScript by importing the `recommended` config and using it in your array:
1515

1616
```js
1717
// eslint.config.js
@@ -54,7 +54,7 @@ Here, the `js/recommended` config object is applied only to files that match the
5454

5555
## Apply a Config Array
5656

57-
If you are importing an array from another module, pass the array directly to the `defineConfig()` helper. Here's an example:
57+
If you are importing a [config array](../core-concepts/glossary#config-array) from another module, pass the array directly to the `defineConfig()` helper. Here's an example:
5858

5959
```js
6060
// eslint.config.js

docs/src/use/configure/debug.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ESLint creates a configuration for each file that is linted based on your config
1515

1616
**Use When:** You aren't sure if the correct configuration file is being read. This may happen if you have multiple configuration files in the same project.
1717

18-
**What To Do:** Run ESLint with the `--debug` command line flag and pass the file to check, like this:
18+
**What To Do:** Run ESLint with the [`--debug`](../command-line-interface#--debug) command line flag and pass the file to check, like this:
1919

2020
{{ npx_tabs({
2121
package: "eslint",
@@ -35,7 +35,7 @@ eslint:eslint Config file URL is file:///C:/Users/nzakas/projects/eslint/eslint/
3535

3636
**Use When:** You aren't sure why linting isn't producing the expected results, either because it seems like your rule configuration isn't being honored or the wrong language options are being used.
3737

38-
**What To Do:** Run ESLint with the `--print-config` command line flag and pass the file to check, like this:
38+
**What To Do:** Run ESLint with the [`--print-config`](../command-line-interface#--print-config) command line flag and pass the file to check, like this:
3939

4040
{{ npx_tabs({
4141
package: "eslint",
@@ -69,7 +69,7 @@ You won't see any entries for `files`, `ignores`, or `name`, because those are o
6969

7070
**Use When:** You aren't sure if certain configuration objects in your configuration file match a given filename.
7171

72-
**What To Do:** Run ESLint with the `--inspect-config` command line flag and pass the file to check, like this:
72+
**What To Do:** Run ESLint with the [`--inspect-config`](../command-line-interface#--inspect-config) command line flag and pass the file to check, like this:
7373

7474
{{ npx_tabs({
7575
package: "eslint",

docs/src/use/configure/ignore.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default defineConfig([globalIgnores([".config/*"])]);
3434

3535
This configuration specifies that all of the files in the `.config` directory should be ignored. This pattern is added after the default patterns, which are `["**/node_modules/", ".git/"]`.
3636

37-
You can also ignore files on the command line using `--ignore-pattern`, such as:
37+
You can also ignore files on the command line using [`--ignore-pattern`](../command-line-interface#--ignore-pattern), such as:
3838

3939
{{ npx_tabs({
4040
package: "eslint",
@@ -116,7 +116,7 @@ Note that only global `ignores` patterns can match directories.
116116
`ignores` patterns that are specific to a configuration will only match file names.
117117
:::
118118

119-
You can also unignore files on the command line using `--ignore-pattern`, such as:
119+
You can also unignore files on the command line using [`--ignore-pattern`](../command-line-interface#--ignore-pattern), such as:
120120

121121
{{ npx_tabs({
122122
package: "eslint",
@@ -128,8 +128,8 @@ You can also unignore files on the command line using `--ignore-pattern`, such a
128128
How glob patterns are evaluated depends on where they are located and how they are used:
129129

130130
1. When using `ignores` in an `eslint.config.js` file, glob patterns are evaluated relative to the `eslint.config.js` file.
131-
1. When using `ignores` in an alternate configuration file specified using the `--config` command line option, glob patterns are evaluated relative to the current working directory.
132-
1. When using `--ignore-pattern`, glob patterns are evaluated relative to the current working directory.
131+
1. When using `ignores` in an alternate configuration file specified using the [`--config`](../command-line-interface#-c---config) command line option, glob patterns are evaluated relative to the current working directory.
132+
1. When using [`--ignore-pattern`](../command-line-interface#--ignore-pattern), glob patterns are evaluated relative to the current working directory.
133133

134134
## Name the Global Ignores Config
135135

@@ -140,7 +140,7 @@ By default, `globalIgnores()` will assign a name to the config that represents y
140140
import { defineConfig, globalIgnores } from "eslint/config";
141141

142142
export default defineConfig([
143-
globalIgnores(["build/**/*"], "Ignore build directory"),
143+
globalIgnores(["build/**/*"], "Ignore Build Directory"),
144144
]);
145145
```
146146

@@ -177,7 +177,7 @@ This message occurs because ESLint is unsure if you wanted to actually lint the
177177

178178
## Including `.gitignore` Files
179179

180-
If you want to include patterns from a `.gitignore` file or any other file with gitignore-style patterns, you can use [`includeIgnoreFile`](https://github.com/eslint/rewrite/tree/main/packages/compat#including-ignore-files) utility from the [`@eslint/compat`](https://www.npmjs.com/package/@eslint/compat) package.
180+
If you want to include patterns from a [`.gitignore`](https://git-scm.com/docs/gitignore) file or any other file with gitignore-style patterns, you can use [`includeIgnoreFile`](https://github.com/eslint/rewrite/tree/main/packages/compat#including-ignore-files) utility from the [`@eslint/compat`](https://www.npmjs.com/package/@eslint/compat) package.
181181

182182
```js
183183
// eslint.config.js

docs/src/use/suppressions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ You can address any of the reported violations by making the necessary changes t
5454
There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.
5555
```
5656

57-
To remove the suppressions that are no longer needed, you can use the `--prune-suppressions` flag.
57+
To remove the suppressions that are no longer needed, you can use the [`--prune-suppressions`](./command-line-interface#--prune-suppressions) flag.
5858

5959
```bash
6060
eslint --prune-suppressions

docs/src/use/troubleshooting/couldnt-find-the-plugin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ Common resolutions for this issue include:
6060

6161
For more information, see:
6262

63-
- [Legacy ESLint configuration files](../configure/configuration-files-deprecated#using-a-shareable-configuration-package) for documentation on the legacy ESLint configuration format
64-
- [Configure Plugins](../configure/plugins) for documentation on how to extend from plugins
65-
- [Create Plugins](../../extend/plugins#configs-in-plugins) for documentation on how to define plugins
63+
- [Legacy ESLint configuration files](../configure/configuration-files-deprecated#using-a-shareable-configuration-package) for documentation on the legacy ESLint configuration format.
64+
- [Configure Plugins](../configure/plugins) for documentation on how to extend from plugins.
65+
- [Create Plugins](../../extend/plugins#configs-in-plugins) for documentation on how to define plugins.

templates/formatter-examples.md.ejs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edit_link: https://github.com/eslint/eslint/edit/main/templates/formatter-exampl
1010

1111
ESLint comes with several built-in formatters to control the appearance of the linting results, and supports third-party formatters as well.
1212

13-
You can specify a formatter using the `--format` or `-f` flag in the CLI. For example, `--format json` uses the `json` formatter.
13+
You can specify a formatter using the [`--format` or `-f`](../command-line-interface#-f---format) flag in the CLI. For example, `--format json` uses the `json` formatter.
1414

1515
The built-in formatter options are:
1616

@@ -20,7 +20,7 @@ The built-in formatter options are:
2020

2121
## Example Source
2222

23-
Examples of each formatter were created from linting `fullOfProblems.js` using the `.eslintrc.json` configuration shown below.
23+
Examples of each formatter were created from linting `fullOfProblems.js` using the `eslint.config.js` configuration shown below.
2424

2525
`fullOfProblems.js`:
2626

@@ -34,19 +34,24 @@ function addOne(i) {
3434
};
3535
```
3636

37-
`.eslintrc.json`:
38-
39-
```json
40-
{
41-
"extends": "eslint:recommended",
42-
"rules": {
43-
"consistent-return": 2,
44-
"indent" : [1, 4],
45-
"no-else-return" : 1,
46-
"semi" : [1, "always"],
47-
"space-unary-ops" : 2
48-
}
49-
}
37+
`eslint.config.js`:
38+
39+
```js
40+
import { defineConfig } from "eslint/config";
41+
import js from "@eslint/js";
42+
43+
export default defineConfig([
44+
js.configs.recommended,
45+
{
46+
rules: {
47+
"consistent-return": 2,
48+
"indent" : [1, 4],
49+
"no-else-return" : 1,
50+
"semi" : [1, "always"],
51+
"space-unary-ops" : 2
52+
}
53+
}
54+
]);
5055
```
5156

5257
Tests the formatters with the CLI:

0 commit comments

Comments
 (0)