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

Loses @ts-directives nested inside an Import sometimes #79

Closed fbartho closed 1 year ago

fbartho commented 1 year ago

Not filling out the template, just providing a code-snippet and then trying to fix it.

import { readFileSync } from "fs";
import * as path from "path";
import { PackageJson } from "type-fest";

import {
    isHCAPackageRegexp,
    HCA_PACKAGE_DEFAULT_PREFIX as HCA_PACKAGE_DEFAULT_PREFIX_,
    // @ts-expect-error
} from "./PackageDefsJS";

When formatting this, // @ts-expect-error gets deleted! You can replicate this if you add it as a test-case in tests/ImportCommentsPreserved/