<!-- PLEASE READ THIS: - If you are not sure is a bug, OPEN a DISCUSSION, if is a legitimate bug, is easy to create a bug from a discussion. - Empty reports won't be considered and eventually be closed by a bot. - Include debugging notes will help to fix it faster. - If you remove this template, ticket will be closed immediately. - No English perfect is required, use public translators if is need it, we will do our best to help you. - Extra bonus: The most complete this report is delivered, the faster you will get a response. - Extra bonus: include screenshots, logs (remove sensitive data). - If you are willing to fix it, there is a checkbox at the bottom. --> **Your Environment** * **Prettier version**: 3.6.2 * **node version**: 22.14.0 * **package manager**: 11.3.0 * **IDE**: Cursor and `prettier` CLI **Describe the bug** <!-- A clear and concise description of what the bug is. --> Comments before `"use strict"` and an `import` line are duplicated below the import line. This also makes formatting not idempotent. **To Reproduce** <!-- IMPORTANT: - How to reproduce the issue - Steps to reproduce the issue Be aware, the lack of reproducible steps the issue might cause your ticket to be closed. --> Format the following: ```js // foo /* bar */ "use strict"; import "foo"; ``` **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> Prettier spits out some reasonable transformation of the code. **Actual behaviour** The comment is duplicated below the import line: ```js // foo /* bar */ "use strict"; import "foo"; // foo /* bar */ ``` This also makes formatting not idempotent, as formatting again produces: ```js // foo /* bar */ "use strict"; import "foo"; // foo /* bar */ // foo /* bar */ ``` ad infinitum. **Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)** <!-- Please be careful do not leak any sensitive information, remove tokens --> ```json { "plugins": ["@trivago/prettier-plugin-sort-imports"] } ``` **Error log** N/A **Contribute to @trivago/prettier-plugin-sort-imports** - [ ] I'm willing to fix this bug 🥇 <!-- IMPORTANT: please do not attach external files, all content should be visible from any device. -->