Skip to content

Import sort work buggy in some specifc scenario: when destructiring imports #373

@eriknyk

Description

@eriknyk

Import sort work buggy in some specifc scenario: when destructiring imports

Your Environment

  • Prettier version: 3.6.2
  • node version: v22.12.0
  • package manager: [email protected]
  • IDE: [WebStorm 2025.1.3]

Describe the bug

Import sort work buggy in some specifc scenario: when destructiring imports

To Reproduce
to have exports that prettier is destructuring on single line, by example:

from:

import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";

to:

import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/components/ui/tooltip";
Screen.Recording.2025-07-22.at.1.32.27.PM.mp4

Expected behavior

  • do not adding extra blank new lines
  • do not undo destructing imports

Addition Info

.prettierrc file configuration

{
  "semi": true,
  "printWidth": 80,
  "jsxSingleQuote": false,
  "bracketSameLine": false,
  "trailingComma": "es5",
  "plugins": [
    "@trivago/prettier-plugin-sort-imports"
  ],
  "importOrder": [
    "^react$",
    "<THIRD_PARTY_MODULES>",
    "^@/.*",
    "^[./]"
  ],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions