knip icon indicating copy to clipboard operation
knip copied to clipboard

Add support for Vue composables unused properties detection

Open maiolica opened this issue 6 months ago • 1 comments

A Vue composable is a function usually structured this way:

const useUserRole = (user: User) => {
  const isAdmin = computed(() => user.role === UsersRole.ADMIN);
  const isRegularUser = computed(() => user.role === UsersRole.REGULAR);

  return {
    isAdmin,
    isRegularUser,
  };
};

If isRegularUser is never exported in another file, ex.

const { isAdmin } = useUserRole();

could Knip detect it?

maiolica avatar Aug 13 '24 15:08 maiolica