SoominHan / import-sorter

MIT License
87 stars 28 forks source link

`removeUnusedImports` is removing used imports in certain cases #107

Open twilkinson3421 opened 2 months ago

twilkinson3421 commented 2 months ago

The removeUnusedImports setting is causing used imports to be removed, in my experience, where the following is the case:

export const FieldHelp = Interface.Methods.createComponent<
  React.ElementRef<typeof Tooltip.Trigger>,
  React.ComponentPropsWithoutRef<typeof Tooltip.Trigger>,
  typeof fieldHelpVariants,
  {}
>({
  debugName: "FieldHelp",
  Component: ({ children, className, ...props }, ref) => {
    const { help } = useFormFieldContext();

    return (
      <Tooltip.Root>
        //...
    );
  };
});

In a file like the above, useFormFieldContext will be removed from the imports even though it is being used.