eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

Bug: using `--ext` throws an invalid option error #18399

Closed SamSalvatico closed 3 weeks ago

SamSalvatico commented 3 weeks ago

Environment

Node version: v20.11.1 npm version: v10.5.2 Local ESLint version: v9.1.1 Global ESLint version: Not found Operating System: darwin 23.4.0

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration ``` "scripts": { "lint": "eslint . --ext .ts" } ```

What did you expect to happen?

--ext works as expected or remove it from docs

What actually happened?

Moving to v9.1.1 I am getting the following error

package@0.0.1 lint:fix
> eslint . --ext .ts --fix

Invalid option '--ext' - perhaps you meant '-c'?
You'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.

I opened the URL, but --ext is extensively used in docs

Link to Minimal Reproducible Example

https://eslint.org/play/

Participation

Additional comments

No response

aladdin-add commented 3 weeks ago

it's working as expected. --ext is eslintrc-mode-only, and has been documented: https://eslint.org/docs/latest/use/command-line-interface#--ext

aladdin-add commented 3 weeks ago

In flat configs, you can use {files: ["**/*.ts"], ...config}, and it just works.

SamSalvatico commented 3 weeks ago

Thank you!

SamSalvatico commented 3 weeks ago

it's working as expected. --ext is eslintrc-mode-only, and has been documented: https://eslint.org/docs/latest/use/command-line-interface#--ext

One note: the examples under the disclaimer are not working, if no additional configurations are set

npx eslint . --ext .ts
image