Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint(import/named) reports not found errors in 2.30.0 #3048

Open
artaommahe opened this issue Sep 4, 2024 · 8 comments
Open

eslint(import/named) reports not found errors in 2.30.0 #3048

artaommahe opened this issue Sep 4, 2024 · 8 comments

Comments

@artaommahe
Copy link

After upgrading from 2.29.1 to 2.30.0 we got some not found errors from import/named rule

import Select, { ClearIndicatorProps, GroupBase, OptionProps, Props, createFilter } from 'react-select';
Error:   2:18  error  ClearIndicatorProps not found in 'react-select'  import/named
Error:   2:39  error  GroupBase not found in 'react-select'            import/named
Error:   2:50  error  OptionProps not found in 'react-select'          import/named
Error:   2:63  error  Props not found in 'react-select'                import/named

import { DocumentNode } from 'graphql';
Error:   5:10  error  DocumentNode not found in 'graphql'  import/named

in both cases only imported interfaces are marked with error

@ljharb
Copy link
Member

ljharb commented Sep 4, 2024

if they're types, is there a reason you can't use import type?

@artaommahe
Copy link
Author

using import type helps, but it requires to do this manually. By default vscode add auto-imports without type. It's not a good idea to force developers manually check imports list and add type to random places (and frequently imports list is just collapsed by default).

@ljharb
Copy link
Member

ljharb commented Sep 5, 2024

I agree, and we do need a lint rule for that (#2390).

In the meantime, let's figure this out. Can you confirm you're using the latest version of the TS resolver?

@Pespiri
Copy link

Pespiri commented Sep 9, 2024

This "rule change" seems to be very inconsistent, as it seems to only trigger on external dependencies, at least in our project.
Any internal types and interfaces imported as "import { SomeType } from "./someInterface"" are not affected.
image

We would very much like to keep using our old importing style, and would appreciate if this, if not a bug, could be configured.
This issue seems to happen after upgrading "eslint-module-utils" to version"2.9.0" or above.
Our temporary solution has been to pin both "eslint-module-utils" and "eslint-plugin-import" to "2.8.2" and "2.29.0" respectively.

@artaommahe
Copy link
Author

@ljharb what's ts resolver?) just in case "typescript": "5.5.4",

@ljharb
Copy link
Member

ljharb commented Sep 9, 2024

@artaommahe eslint-import-resolver-typescript - it’s required to be able to lint typescript files properly with this plugin; see the readme.

@artaommahe
Copy link
Author

@ljharb eslint-import-resolver-typescript@3.6.3

@hiurylf

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants