# FP S1128: False positive with Vue.js imports

**URL:** <https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778>\
**Category:** SonarQube Cloud\
**Tags:** vue, typescript\
**Created:** [May 31, 2023, 10:36am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778 "2023-05-31T10:36:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferferga](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ferferga/32/45633_2.png) [@ferferga](https://community.sonarsource.com/u/ferferga)\
**Post date:** [May 31, 2023, 10:36am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/1 "2023-05-31T10:36:17Z")

</div>

Hello

This is a follow-up of [Fix FP S1128 (`unused-imports`): Vue.js imports used in templates · Issue #3484 · SonarSource/SonarJS · GitHub](https://github.com/SonarSource/SonarJS/issues/3484) (the issue it’s not fully resolved for me) and what I commented [beginning here](https://github.com/SonarSource/SonarJS/issues/3484#issuecomment-1541969937)

I copy-paste the body of that issue, so it can be searchable here in the forums as well:

```auto
I can share the full files without issues, since I'm working in a open source project. This code smell is reported 3 times in my repo. I attach the relevant line that SonarCloud highlights and the ID of the detected code smell in the dashboard (obtained from the `open` query parameter):

* `AYdGwQKIUNJ8O0FnkdeL`: https://github.com/jellyfin/jellyfin-vue/blob/master/frontend/src/components/Layout/Carousel/Carousel.vue#L53
* `AYdGwQLbUNJ8O0FnkdeO`: https://github.com/jellyfin/jellyfin-vue/blob/master/frontend/src/components/Layout/SwiperSection.vue#L47
* `AYdGwQTPUNJ8O0Fnkde-`: https://github.com/jellyfin/jellyfin-vue/blob/master/frontend/src/pages/playback/music/index.vue#L85

Some key things I noticed:

* All 3 of them are `Remove this unused import of 'Swiper'`. It looks like `SwiperSlide` is correctly detected as used without issues.
* I wonder if it has to do because I also import `Swiper` as a type? (But I don't in all of them)
* I have another guess in that the import is from `swiper/vue` and not `swiper`, and all the affected files import both from `swiper` and `swiper/vue`.
* Local eslint (with `eslint-plugin-imports`) doesn't detect any of those as unused. It does if I remove those components from the template (as expected), so this issue is solely in Sonar's side.

Don't hesitate in contacting me if you need further details to triage this issue or there's something else I can be helpful with to help with this.

```

- **ALM used** : GitHub
- **CI system used** : GitHub SonarCloud app
- **Languages of the repository** : TypeScript
- **Only if the SonarCloud project is public, the URL** : [GitHub - jellyfin/jellyfin-vue: A modern web client for Jellyfin based on Vue](https://github.com/jellyfin/jellyfin-vue)

---

<div class="post-metadata">

**Author:** ![ilia](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ilia/32/33594_2.png) [@ilia](https://community.sonarsource.com/u/ilia)\
**Post date:** [June 6, 2023, 10:39am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/4 "2023-06-06T10:39:57Z")

</div>

Hello Fernando,

Thank you for bring this issue up.

If you use [PascalCase](https://en.wiktionary.org/wiki/Pascal_case) for your tags in the template, it should be fine. Is that fine for you?

Example:

```plaintext
  <Swiper
      ...
  >
  </Swiper>

```

Best,  
Ilia

---

<div class="post-metadata">

**Author:** ![ferferga](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ferferga/32/45633_2.png) [@ferferga](https://community.sonarsource.com/u/ferferga)\
**Post date:** [June 6, 2023, 1:14pm UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/5 "2023-06-06T13:14:00Z")

</div>

Hello Ilia

I’d like not to for consistency purposes. I understand that I could always mark it a false positive in SonarCloud dashboard, even if that means that in the future it might reappear when the file is modified or other users are affected by this.

However, if may I ask, why it’s difficult to fix it from your side? Local eslint setup (with Vue-eslint-parser, eslint-plugin-vue and eslint-plugin-imports) has no problems recognising this import as used.

Thank you very much in advance.

---

<div class="post-metadata">

**Author:** ![ilia](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ilia/32/33594_2.png) [@ilia](https://community.sonarsource.com/u/ilia)\
**Post date:** [June 12, 2023, 10:29am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/6 "2023-06-12T10:29:30Z")

</div>

Hello Fernando,

I have opened an issue for this: [Fix FP S1128 (`unused-import`): support lowercase tag name · Issue #3973 · SonarSource/SonarJS · GitHub](https://github.com/SonarSource/SonarJS/issues/3973)

Best,  
Ilia

---

<div class="post-metadata">

**Author:** ![ferferga](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ferferga/32/45633_2.png) [@ferferga](https://community.sonarsource.com/u/ferferga)\
**Post date:** [June 12, 2023, 10:41am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/7 "2023-06-12T10:41:35Z")

</div>

Thank you very much Ilia!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 23, 2023, 7:47am UTC](https://community.sonarsource.com/t/fp-s1128-false-positive-with-vue-js-imports/91778/9 "2023-06-23T07:47:22Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
