trivago / prettier-plugin-sort-imports

A prettier plugin to sort imports in typescript and javascript files by the provided RegEx order.
Apache License 2.0
3.4k stars 135 forks source link

Not working with prettier-ignore #297

Open justingolden21 opened 5 months ago

justingolden21 commented 5 months ago

Your Environment

Describe the bug

When I add a // prettier-ignore comment above an export, then it still underlines red and formats it, just in a different format

To Reproduce

I try to export functions like so:

// prettier-ignore
export {
    getCurrentTimestampSeconds,
    getCurrentTimestampMilliseconds,
    timestampToDate,
    timestampToDateUTC,
    dateToTimestamp,
    msToUnits,
    getTimestampDiff,
    unitsToString
};

Expected behavior

Because I have a // prettier-ignore comment, there should be no underline

Screenshots, code sample, etc

Red Underline

image

Error Message

image

image

Incorrect result after selecting fix the first problem

image

Incorrectly formatted after alt+shift+F

image

// prettier-ignore
export {
dateToTimestamp,getCurrentTimestampMilliseconds,getCurrentTimestampSeconds,getTimestampDiff,msToUnits,timestampToDate,

timestampToDateUTC,unitsToString

};

https://github.com/trivago/prettier-plugin-sort-imports/assets/30274440/e5be58b8-cbfd-4674-930d-0f51f5a4c44d

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

{
    "bracketSameLine": true,
    "printWidth": 100,
    "quoteProps": "consistent",
    "singleQuote": true,
    "trailingComma": "none",
    "useTabs": true,
    "endOfLine": "crlf",
    "plugins": [
        "prettier-plugin-tailwindcss",
        "prettier-plugin-organize-imports",
        "prettier-plugin-svelte"
    ],
    "organizeImportsSkipDestructiveCodeActions": true
}

Error log

N/A

Contribute to @trivago/prettier-plugin-sort-imports

discoverlance-com commented 5 months ago

Any updates on this?

yordis commented 2 months ago

Are you sure you are using this plugin, based on your config you are using prettier-plugin-organize-imports package which is different