Closed zapzqc closed 3 weeks ago
The reproduction case you linked to does not show this error. Please provide a repro case where we can see the error in action and we can take a look.
The reproduction case you linked to does not show this error. Please provide a repro case where we can see the error in action and we can take a look.
Hi @nzakas, I could reproduce this. This is related to the no-unresolved
rule from eslint-plugin-import
, but I'm not sure if it is because @eslint/compat
does not have a main
property in its package.json
. The rule does not complain when there is a main
property.
npx eslint .
/home/projects/vitejs-vite-bm5pcp/eslint.config.js
3:34 error Unable to resolve path to module '@eslint/compat' import/no-unresolved
Oh I see. There were no instructions on how to use the StackBlitz repro. I thought from the description that the error shows up immediately upon opening it. I didn't realize I had to manually run ESLint.
This seems more like a bug in eslint-plugin-import
to me, but if adding main
unblocks people, we can do that.
Just a note that we should do this for all the packages, not just @eslint/compat
.
Working on this.
Which packages are affected?
@eslint/compat
@eslint/config-array
@eslint/migrate-config
@eslint/object-schema
Environment
Node version: v18.20.3 pnpm version: 9.1.4 ESLint version: 9.4.0 Operating System: MacOS 11.5.2 VS Code
What did you do?
My project is written in JavaScript, and I would like to add ESLint to it.
What did you expect to happen?
import { fixupConfigRules } from '@eslint/compat';
This line should not be prompted with an errorWhat actually happened?
Unable to resolve path to module '@eslint/compat.'.eslintimport/no-unresolved
Link to Minimal Reproducible Example
https://stackblitz.com/edit/vitejs-vite-bm5pcp
Participation
Additional comments
When I added "main": "./dist/esm/index.js" to the package.json file under the node_modules/@eslint/compact directory, my editor stopped showing errors.