Skip to content

Comment at beginning of file gets replicated every time #344

@ben221199

Description

@ben221199

Your Environment

  • Prettier version: 3.4.2
  • node version: 22.13.0
  • package manager: [email protected]
  • IDE: PhpStorm

Describe the bug

Whenever I run yarn prettier . --write, the comment at the beginning of the while gets replicated every time. Its replicate will appear UNDER the imports.

To Reproduce

Have the following code:

// Offerte aanvragen
"use client";

import axios from "axios";
import Cookies from "js-cookie";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { RotatingLines } from "react-loader-spinner";
import { v4 as uuidv4 } from "uuid";
import ClientsTellSmall from "~/components/ClientsTellSmall";
import ErrorMessage from "~/components/ErrorMessage";
import FormSubmittedMessage from "~/components/FormSubmittedMessage";
import Heading from "~/components/Heading";
import LabelCard from "~/components/LabelCard";
import PortableContent from "~/components/PortableContent";

/**
 * OFFER / OFFERTE AANVRAGEN
 */
const RequestQuoteForm = () => {};

Expected behavior

The expected behavior is having // Offerte aanvragen just once in the code.

Screenshots, code sample, etc

Image
Image

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

/**@type {import("prettier").Config}*/
const prettierConfig = {
  importOrderSeparation: true,
  importOrderSortSpecifiers: true,
  plugins: ["@trivago/prettier-plugin-sort-imports"],
};

export default prettierConfig;

Error log

N/A

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

  • I'm willing to fix this bug 🥇

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