-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[import/no-duplicates] Autofix merges imports incorrectly - single index.d.ts but multiple modules #2992
Comments
Are you using eslint-import-resolver-typescript? Please share your config if that doesn't fix it. |
Thanks for the quick reply. I am using eslint-import-resolver-typescript. If it helps I created a sample app that uses the standard create svelte app skeleton project. https://github.com/mpellegrini/eslint-import-plugin-no-duplicates-issue config being used is here - https://github.com/mpellegrini/eslint-import-plugin-no-duplicates-issue/blob/main/.eslintrc.cjs The specific file that is exhibiting this behavior is here https://github.com/mpellegrini/eslint-import-plugin-no-duplicates-issue/blob/main/src/routes/%2Bpage.svelte#L2 I have already added the eslint disable on one of the imports that is auto fixing incorrectly. For other types of imports it is working for me, bot collapsing and keeping things separate as expected. Just specifically with these imports from Svelte. If there is anything else I can provide please let me know. |
I'm having the same issue. Compilation breaks because of this: // The following:
import { format, Locale } from 'date-fns';
import { enUS } from 'date-fns/locale';
// is auto-fixed as:
import { enUS, format, Locale } from 'date-fns';
// which results in the following error:
Module '"date-fns"' has no exported member 'enUS' I'm using |
Here's an even more minimal reproduction. You don't need to actually use svelte to reproduce, just import it. package.json{
"dependencies": {
"eslint": "^9.16.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"svelte": "^5.9.1"
}
} index.mjsimport { quadOut } from 'svelte/easing'
import { crossfade } from 'svelte/transition' eslint.config.mjsimport importPlugin from 'eslint-plugin-import';
export default [
importPlugin.flatConfigs.recommended,
{
settings: {
'import/resolver': {
typescript: {
}
}
}
}
]; I couldn't reproduce with |
Working on a Svelte project. For a majority of their packages, they have a single index.d.ts that is used but the d.ts file uses modules for namespacing.
Subset of the package.json exports
so for the above fragment I have an imports that looks like this
This yields the following warning:
but auto fix changes this to the following - which is not correct and doesn't work from a code perspective
Trying to determine if there is any way to keep this rule but allow for exception to the rules.
Thanks in advance for any help / guidance.
The text was updated successfully, but these errors were encountered: