Skip to content

Extra linebreak above side-effect imports in some cases. #208

@MaKTaiL

Description

@MaKTaiL

Your Environment

  • Prettier version: 3.5.3
  • node version: 22.14.0
  • package manager: pnpm@10
  • IDE: VSCode

Describe the bug

I'm trying to separate only type imports from the rest but the script is adding a blank line between all different imports instead.

To Reproduce

This is the import order I'm trying to use:

importOrder: ["<TYPES>", "", "<THIRD_PARTY_MODULES>", "^@/", "^[./]"]

Expected output:

import type { Metadata } from "next";

import { Geist, Geist_Mono } from "next/font/google";
import "@/app/globals.css";
import Test from "./components/test";

Actual output:

import type { Metadata } from "next";

import { Geist, Geist_Mono } from "next/font/google";

import "@/app/globals.css";

import Test from "./components/test";

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

/**
 * @see https://prettier.io/docs/configuration
 * @type {import("prettier").Config}
 * @type {import("prettier-plugin-tailwindcss").PluginOptions}
 * @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig}
 */
const config = {
  plugins: [
    "@ianvs/prettier-plugin-sort-imports",
    "prettier-plugin-tailwindcss",
  ],
  importOrder: ["<TYPES>", "", "<THIRD_PARTY_MODULES>", "^@/", "^[./]"],
  endOfLine: "auto",
};

export default config;

Contribute to @ianvs/prettier-plugin-sort-imports

  • I'm willing to fix this bug 🥇

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions