Bug: eslint-plugin-import can't resolve typescript-eslint modules in flat eslint config #7565
Closed
4 tasks done
Labels
bug
Something isn't working
working as intended
Issues that are closed as they are working as intended
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
I'm using
typescript-eslint
in conjunction witheslint-plugin-import
. I've migrated to the new flat eslint config format. Here is a minimal reproduction of my issue:Naturally, I run eslint on the
eslint.config.js
file itself, which gives the following errors:This wasn't happening pre-6.0 - importing these modules worked without any issue.
I think the underlying issue is import-js/eslint-plugin-import#2132 and import-js/eslint-plugin-import#2703. It seems that starting in v6.0 of this repo, there is no longer a
main
field inpackage.json
.I tested my theory by manually adding
"main": "./dist/index.js"
tonode_modules/@typescript-eslint/parser/package.json
andnode_modules/@typescript-eslint/eslint-plugin/package.json
, and this resolved the eslint errors.It seems this is also semi-related to #7300, wherein it was decided to not re-add the
main
field topackage.json
. Perhaps my issue can act as another data point supporting re-adding it?Disclaimer: I understand that this is not a "bug" in
typescript-eslint
. Hopefully support forexports
will come toeslint-plugin-import
, but until then, it seems like this issue could be more easily be resolved here? (Would @ljharb like to chime in?)Reproduction Repository Link
https://github.com/b0o/ts-eslint-import-bug
Repro Steps
npm install
eslint eslint.config.js
Versions
@typescript-eslint/eslint-plugin
6.5.0
@typescript-eslint/parser
6.5.0
eslint-plugin-import
2.28.1
TypeScript
5.2.2
ESLint
8.48.0
node
20.5.1
The text was updated successfully, but these errors were encountered: