IanVS / prettier-plugin-sort-imports

An opinionated but flexible prettier plugin to sort import statements
Apache License 2.0
951 stars 21 forks source link

Preserve trailing comments on specifiers #80

Closed fbartho closed 1 year ago

fbartho commented 1 year ago

Fixes #79

Trailing comments on specifiers don't get automatically saved like top-level ones do. This ensures that such comments are not lost

Before:

import {
    b2,a2,
    // @ts-expect-error
} from "b";

import {
    b1,
    a1,

    // @ts-expect-error
} from "a";

After

import {
    a1,
    b1,
    // @ts-expect-error
} from "a";
import {
    a2,
    b2,
    // @ts-expect-error
} from "b";
fbartho commented 1 year ago

I think we could potentially merge with this PR and see if it bugs anyone in the wild? idk, at least we're not losing important comments.