Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: CLI documentation standardization #16563

Merged
merged 23 commits into from Dec 9, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 19 additions & 19 deletions docs/src/user-guide/command-line-interface.md
Expand Up @@ -38,7 +38,7 @@ npx eslint "lib/**"

**Note:** You can also use alternative package managers such as [Yarn](https://yarnpkg.com/) or [pnpm](https://pnpm.io/) to run ESLint. Please refer to your package manager's documentation for the correct syntax.

## Pass multiple values to an option
## Pass Multiple Values to an Option

Options that accept multiple values can be specified by repeating the option or with a comma-delimited list (other than [`--ignore-pattern`](#--ignore-pattern), which does not allow the second style).

Expand Down Expand Up @@ -116,7 +116,7 @@ Miscellaneous:
--print-config path::String Print the configuration for the given file
```

### Basic configuration
### Basic Configuration

#### `--no-eslintrc`

Expand Down Expand Up @@ -171,7 +171,7 @@ This option allows you to specify which file extensions ESLint uses when searchi
* **Multiple Arguments**: Yes
* **Default Value**: `.js` and the files that match the `overrides` entries of your configuration.

`--ext` is only used when the the patterns to lint are directories. If you use glob patterns or file names, then `--ext` is ignored. For example, `npx eslint lib/* --ext .js` matches all files within the `lib/` directory, regardless of extension.
`--ext` is only used when the the patterns to lint are directories. If you use glob patterns or file names, then `--ext` is ignored. For example, `npx eslint "lib/*" --ext .js` matches all files within the `lib/` directory, regardless of extension.

##### `--ext` example

Expand Down Expand Up @@ -212,7 +212,7 @@ This option allows you to specify a parser to be used by ESLint.

```shell
# Use TypeScript ESLint parser
npx eslint --parser @typescript-eslint/parser files.ts
npx eslint --parser @typescript-eslint/parser file.ts
```

#### `--parser-options`
Expand All @@ -233,11 +233,11 @@ echo '3 ** 4' | npx eslint --stdin --parser-options ecmaVersion:7 # succeeds, ya

Changes the folder where plugins are resolved from.
bpmutter marked this conversation as resolved.
Show resolved Hide resolved

* **Argument Type**: String. Path to file.
* **Argument Type**: String. Path to directory.
* **Multiple Arguments**: No
* **Default Value**: By default, plugins are resolved from the current working directory.
* **Default Value**: By default, plugins are resolved from the directory in which your configuration file is found.

This option should be used when plugins were installed by someone other than the end user. It should be set to the project directory of the project that has a dependency on the necessary plugins. If you use npm to install plugins, the path ends with `/node_modules/`.
This option should be used when plugins were installed by someone other than the end user. It should be set to the project directory of the project that has a dependency on the necessary plugins.

For example:

Expand All @@ -248,10 +248,10 @@ For example:

```shell
npx eslint --config ~/personal-eslintrc.js \
--resolve-plugins-relative-to /usr/local/lib/node_modules/
--resolve-plugins-relative-to /usr/local/lib/
```

### Specify rules and plugins
### Specify Rules and Plugins

#### `--plugin`

Expand Down Expand Up @@ -311,7 +311,7 @@ npx eslint --rulesdir my-rules/ file.js
npx eslint --rulesdir my-rules/ --rulesdir my-other-rules/ file.js
```

### Fix problems
### Fix Problems

#### `--fix`

Expand Down Expand Up @@ -369,7 +369,7 @@ npx eslint --fix --fix-type suggestion --fix-type problem .
npx eslint --fix --fix-type suggestion,layout .
```

### Ignore files
### Ignore Files

#### `--ignore-path`

Expand Down Expand Up @@ -406,7 +406,6 @@ This option allows you to specify patterns of files to ignore (in addition to th

* **Argument Type**: String. The supported syntax is the same as for [`.eslintignore` files](configuring/ignoring-code#the-eslintignore-file), which use the same patterns as the [`.gitignore` specification](https://git-scm.com/docs/gitignore). You should quote your patterns in order to avoid shell interpretation of glob patterns.
* **Multiple Arguments**: Yes
* **Default Value**: whatever the default value is OR N/A

##### `--ignore-pattern` example

Expand Down Expand Up @@ -443,7 +442,7 @@ This is useful when processing files from STDIN and you have rules which depend
cat myfile.js | npx eslint --stdin --stdin-filename myfile.js
```

### Handle warnings
### Handle Warnings

#### `--quiet`

Expand Down Expand Up @@ -520,19 +519,20 @@ Use a local custom formatter:
npx eslint -f ./customformat.js file.js
```

Use npm-installed formatter:
Use an npm-installed formatter:

```shell
npm install eslint-formatter-pretty
# THEN

# Then run one of the following commands
npx eslint -f pretty file.js
# OR
# or alternatively
npx eslint -f eslint-formatter-pretty file.js
```

#### `--color` and `--no-color`

These options forces the enabling/disabling of colorized output.
These options force the enabling/disabling of colorized output.

* **Argument Type**: No argument.

Expand All @@ -545,7 +545,7 @@ npx eslint --color file.js | cat
npx eslint --no-color file.js
```

### Inline configuration comments
### Inline Configuration Comments

#### `--no-inline-config`

Expand Down Expand Up @@ -754,7 +754,7 @@ This option outputs the configuration to be used for the file passed. When prese
npx eslint --print-config file.js
```

## Exit codes
## Exit Codes

When linting files, ESLint exits with one of the following exit codes:

Expand Down