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: Add note about invalid CLI flags when using flat config. #17664

Merged
merged 4 commits into from Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions docs/src/use/command-line-interface.md
Expand Up @@ -121,7 +121,7 @@ Miscellaneous:

#### `--no-eslintrc`

Disables use of configuration from `.eslintrc.*` and `package.json` files.
**eslintrc Mode Only.** Disables use of configuration from `.eslintrc.*` and `package.json` files. For flat config mode, use `--no-config-lookup` instead.

* **Argument Type**: No argument.

Expand Down Expand Up @@ -150,7 +150,7 @@ If `.eslintrc.*` and/or `package.json` files are also used for configuration (i.

#### `--env`

This option enables specific environments.
**eslintrc Mode Only.** This option enables specific environments.

* **Argument Type**: String. One of the available environments.
* **Multiple Arguments**: Yes
Expand All @@ -166,7 +166,7 @@ npx eslint --env browser --env node file.js

#### `--ext`

This option allows you to specify which file extensions ESLint uses when searching for target files in the directories you specify.
**eslintrc Mode Only.** This option allows you to specify which file extensions ESLint uses when searching for target files in the directories you specify.

* **Argument Type**: String. File extension.
* **Multiple Arguments**: Yes
Expand Down Expand Up @@ -232,7 +232,7 @@ echo '3 ** 4' | npx eslint --stdin --parser-options ecmaVersion:7 # succeeds, ya

#### `--resolve-plugins-relative-to`

Changes the directory where plugins are resolved from.
**eslintrc Mode Only.** Changes the directory where plugins are resolved from.

* **Argument Type**: String. Path to directory.
* **Multiple Arguments**: No
Expand Down Expand Up @@ -374,7 +374,7 @@ npx eslint --fix --fix-type suggestion,layout .

#### `--ignore-path`

This option allows you to specify the file to use as your `.eslintignore`.
**eslintrc Mode Only.** This option allows you to specify the file to use as your `.eslintignore`.

* **Argument Type**: String. Path to file.
* **Multiple Arguments**: No
Expand Down
9 changes: 8 additions & 1 deletion lib/cli.js
Expand Up @@ -318,7 +318,14 @@ const cli = {
options = CLIOptions.parse(args);
} catch (error) {
debug("Error parsing CLI options:", error.message);
log.error(error.message);

let errorMessage = error.message;

if (usingFlatConfig) {
errorMessage += "\nYou're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.";
}

log.error(errorMessage);
return 2;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -64,7 +64,7 @@
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
"@eslint/js": "8.51.0",
"@humanwhocodes/config-array": "^0.11.11",
"@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.12.4",
Expand Down