sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
290 stars 33 forks source link

`imported multiple times` error due to wrong types? #556

Closed seanlail closed 1 year ago

seanlail commented 1 year ago

Before You File a Bug Report Please Confirm You Have Done The Following...

What version of ESLint are you using?

8.46.0

What version of eslint-plugin-svelte are you using?

2.32.4

What did you do?

In a component I have this:

<script lang="ts">
  import { createEventDispatcher } from "svelte";
  import { fade } from "svelte/transition";

What did you expect to happen?

No warning or error from ESLint

What actually happened?

I see this error in VSCode and when I run eslint:

/Users/.../src/components/Expandable.svelte
  2:41  warning  '/Users/.../node_modules/svelte/types/index.d.ts' imported multiple times  import/no-duplicates
  3:24  warning  '/Users/.../node_modules/svelte/types/index.d.ts' imported multiple times  import/no-duplicates

When I save the file (I have formatOnSave enabled) it moves the fade import to the wrong module and breaks the build:

<script lang="ts">
  import { createEventDispatcher, fade } from "svelte";

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/seanlail/lint-issue-556

Last commit shows the issue. If you run this locally, remove the comment here and you will see the issue.

Additional comments

npm: 9.5.0 node: v18.14.2 svelte: 4.1.2 typescript: 5.1.6

ota-meshi commented 1 year ago

Thank you for posting the issue. However, I think it's an issue with the import/no-duplicates rule. It's the same for *.ts files. Please post an issue in the eslint-plugin-import repository. We can't do anything with this repository, so I'm closing this issue.

image