Imports used exclusively in the <template>
part of Vue SFCs are considered "never used" by Volar
#1757
Labels
duplicate
This issue or pull request already exists
This issue was originally raised in simonhaenisch/prettier-plugin-organize-imports, a library which sorts imports and removes unused ones.
Originally posted by @simonhaenisch in simonhaenisch/prettier-plugin-organize-imports#71 (comment):
It seems that imports exclusively used in the
<template>
part of Vue SFCs are incorrectly considered as "never used" by Volar. Here is a minimal working example:package.json
:types.ts
:sfc.vue
:import { ThemeColor } from "@/types"
is incorrectly considered as "never used" by Volar and then removed bysimonhaenisch/prettier-plugin-organize-imports
. If I addconst color = ThemeColor.PRIMARY
to the<script setup>
part ofsfc.vue
, the import is not considered "never used" by Volar.The same happens with functions used exclusively in the
<template>
part of Vue SFCs:helpers.ts
:sfc.vue
:Here,
import { helloWorld } from "@/helpers"
is marked as "never used" by Volar. However, if I addconst hello = helloWorld()
to the<script setup>
part, the import is kept untouched.The text was updated successfully, but these errors were encountered: