vitejs/vite-plugin-react

ESLint upgrade needed

Closed this issue · 1 comments

Describe the bug

ESLint recently upgraded to v9.x. This brought big changes with itself, including changing the default name of the config file to eslint.config.js; any other name that worked until now is deprecated, including .eslintrc.cjs: source.
Now, whenever I generate a project with npm create vite@latest and choose React and TypeScript with SWC (although I think the issue would still stand if I chose anything with React) I am greeted with the same .eslintrc.cjs file. Given that I have ESLint v9 downloaded globally to my machine, when I run the task from a terminal it will try to run it with my linter, not the one that was specified in the package.json file. I am well aware that if the package would not be installed on my machine it would run perfectly fine, but the project should also be upgraded, since the version vite-plugin-react uses is deprecated.

The error I am getting is irrelevant as it offers no real explanation as to why this is happening, but I will paste it here anyway:

npm run lint

> backend@0.0.0 lint
> eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0

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.

Reproduction

vite.new/react

Steps to reproduce

Run npm i -g eslint to install ESLint globally. This installs v9.x.
After, run npm run lint in the project folder. You will see the error message I dropped above, because of the version mismatch.

System Info

System:
    OS: Linux 6.2 Linux Mint 21.1 (Vera)
    CPU: (16) x64 AMD Ryzen 9 6900HX with Radeon Graphics
    Memory: 23.99 GB / 30.60 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm
  Browsers:
    Chrome: 120.0.6099.216

Used Package Manager

npm

Logs

No response

Validations

Hi, tools like linter are not expected to be installed globally. Support for ESLint v9 is tracked in this PR