-
-
Notifications
You must be signed in to change notification settings - Fork 944
oxfmt: Header Comments / Preambles are moved when using sort-imports #16655
Copy link
Copy link
Labels
A-formatterArea - FormatterArea - Formatter
Description
When having a file with header comments / preambles they are moved when using sort-imports.
Example Pre-Formatting:
// THIS IS A GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { apiClient } from "../../apiClient";
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
import { ApiErrorDisconnected, ApiError } from "../../apiErrors";
import { validateResponse } from "../../validateResponse";
import { z } from "zod";Will be formatted to:
import { z } from "zod";
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
// THIS IS A GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { apiClient } from "../../apiClient";
import { ApiErrorDisconnected, ApiError } from "../../apiErrors";
import { validateResponse } from "../../validateResponse";My .oxfmtrc.jsonc:
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 80,
"trailingComma": "all",
"experimentalSortImports": {
"ignoreCase": true
}
}The same happens when using a multi line comment /* some comment */ instead of a line comment.
We are currently using biome and have used prettier (with @ianvs/prettier-plugin-sort-imports) in the past, neither of these move(d) the header comments.
(I am aware of the experimental state of import sorting, but this is the only thing blocking us to switch fully to oxfmt and I did not find another issue tracking this yet).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-formatterArea - FormatterArea - Formatter
Type
Fields
Give feedbackPriority
None yet
Effort
None yet