I am facing the following issues while adding new commit, I have project configured with eslint + husky + prettier + react + vite
1:1 error 'vite' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies
2:1 error '@vitejs/plugin-react-swc' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies
2
Answers
Inside eslint config file, add "import/no-extraneous-dependencies": "off" as key/value inside rules object, might fix
This can happen due to following:
import/no-extraneous-dependencies
.vite.config.js
for the lint errors and yourvite.config.js
hasimport
statement referring tovite
and@vite/plugin-react-swc
packages.Ideally, you should not lint
vite.config.js
file. You should ignore it completely:Or, if you still wish to lint the file but resolve this particular error, then you should put the following comment in your
vite.config.js
file: