Skip to content

Commit

Permalink
Docs: Clarify --ext only works with directories (fixes #7939) (#8095)
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto committed Feb 18, 2017
1 parent 013a454 commit 14d146d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/developer-guide/nodejs-api.md
Expand Up @@ -164,7 +164,7 @@ The `CLIEngine` is a constructor, and you can create a new instance by passing i
* `configFile` - The configuration file to use (default: null). Corresponds to `-c`.
* `cwd` - Path to a directory that should be considered as the current working directory.
* `envs` - An array of environments to load (default: empty array). Corresponds to `--env`.
* `extensions` - An array of filename extensions that should be checked for code. The default is an array containing just `".js"`. Corresponds to `--ext`.
* `extensions` - An array of filename extensions that should be checked for code. The default is an array containing just `".js"`. Corresponds to `--ext`. It is only used in conjunction with directories, not with filenames or glob patterns.
* `fix` - True indicates that fixes should be included with the output report, and that errors and warnings should not be listed if they can be fixed. However, the files on disk will not be changed. To persist changes to disk, call [`outputFixes()`](#outputfixes).
* `globals` - An array of global variables to declare (default: empty array). Corresponds to `--global`.
* `ignore` - False disables use of `.eslintignore`, `ignorePath` and `ignorePattern` (default: true). Corresponds to `--no-ignore`.
Expand Down
7 changes: 4 additions & 3 deletions docs/user-guide/command-line-interface.md
Expand Up @@ -80,9 +80,9 @@ Options that accept array values can be specified by repeating the option or wit

Example:

eslint --ext .jsx --ext .js file.js
eslint --ext .jsx --ext .js lib/

eslint --ext .jsx,.js file.js
eslint --ext .jsx,.js lib/

### Basic configuration

Expand Down Expand Up @@ -137,7 +137,8 @@ Examples:
# Also use both .js and .js2
eslint . --ext .js,.js2

**Note:** If you use a glob pattern, then `--ext` is ignored
**Note:** `--ext` is only used when the arguments are directories. If you use glob patterns or file names, then `--ext` is ignored.

For example, `eslint lib/* --ext .js` will match all files within the `lib/` directory, regardless of extension.

#### `--global`
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/configuring.md
Expand Up @@ -728,7 +728,7 @@ Both the JSON and YAML configuration file formats support comments (`package.jso

## Specifying File extensions to Lint

Currently the sole method for telling ESLint which file extensions to lint is by specifying a comma separated list of extensions using the [`--ext`](./command-line-interface#ext) command line option.
Currently the sole method for telling ESLint which file extensions to lint is by specifying a comma separated list of extensions using the [`--ext`](./command-line-interface#ext) command line option. Note this flag only takes effect in conjunction with directories, and will be ignored if used with filenames or glob patterns.

## Ignoring Files and Directories

Expand Down

0 comments on commit 14d146d

Please sign in to comment.