Closed aabmets closed 1 week ago
This is the invalid result when biome check --write
is executed on a file which
requires import sorting and contains a license header:
import ElectronLogo from "@assets/electron.svg";
/*
* European Union Public License 1.2
*
* Copyright (c) 2024, My Company Name
*
* The contents of this file are subject to the terms and conditions defined in the License.
* You may not use, modify, or distribute this file except in compliance with the License.
*
* SPDX-License-Identifier: EUPL-1.2
*/
import { Fragment, type ReactNode } from "react";
import Versions from "./Versions.tsx";
This is the expected result:
/*
* European Union Public License 1.2
*
* Copyright (c) 2024, My Company Name
*
* The contents of this file are subject to the terms and conditions defined in the License.
* You may not use, modify, or distribute this file except in compliance with the License.
*
* SPDX-License-Identifier: EUPL-1.2
*/
import ElectronLogo from "@assets/electron.svg";
import { Fragment, type ReactNode } from "react";
import Versions from "./Versions.tsx";
This isn't a bug, but the expected result.
Your comment (because it's a comment, even though it is a fancy one) is technically attached to the import statement right after, because there aren't any newlines.
If want to have your comments to be "sticky", you have to add a newline after the comment.
This is called "group" and it's explained in the relative chapter of our docs: https://biomejs.dev/analyzer/import-sorting/#grouped-imports
If you feel strongly about this kind of comments, feel free to open a discussion with concrete ideas on how support these cases
Environment information
Configuration
Playground link
https://biomejs.dev/playground/?code=LwAqAAoAIAAqACAAIAAgAEUAdQByAG8AcABlAGEAbgAgAFUAbgBpAG8AbgAgAFAAdQBiAGwAaQBjACAATABpAGMAZQBuAHMAZQAgADEALgAyAAoAIAAqAAoAIAAqACAAIAAgAEMAbwBwAHkAcgBpAGcAaAB0ACAAKABjACkAIAAyADAAMgA0ACwAIABNAHkAIABDAG8AbQBwAGEAbgB5ACAATgBhAG0AZQAKACAAKgAKACAAKgAgACAAIABUAGgAZQAgAGMAbwBuAHQAZQBuAHQAcwAgAG8AZgAgAHQAaABpAHMAIABmAGkAbABlACAAYQByAGUAIABzAHUAYgBqAGUAYwB0ACAAdABvACAAdABoAGUAIAB0AGUAcgBtAHMAIABhAG4AZAAgAGMAbwBuAGQAaQB0AGkAbwBuAHMAIABkAGUAZgBpAG4AZQBkAC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