I came across this GitHub issue, which helped me resolve the problem.

phongpt156 posted:

"importOrder": ["^[./].*(?<!\\.(c|le|sc)ss)"]

The use of the negative lookahead solved it. Hopefully it helps someone

Final

// .prettierrc
{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "arrowParens": "always",
  "importOrder": ["^[./].*(?<!\\.(c|le|sc)ss)$", "\\.(c|le|sc)ss$"],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true,
  "plugins": ["@trivago/prettier-plugin-sort-imports"]
}
Answer from nop on Stack Overflow
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports
trivago/prettier-plugin-sort-imports
A prettier plugin to sort import declarations by provided Regular Expression order.
Author   trivago
🌐
npm
npmjs.com › package › @ianvs › prettier-plugin-sort-imports
@ianvs/prettier-plugin-sort-imports - npm
February 4, 2026 - A prettier plugin to sort import declarations by provided Regular Expression order, while preserving side-effect import order. This project is based on @trivago/prettier-plugin-sort-imports, but adds additional features:
      » npm install @ianvs/prettier-plugin-sort-imports
    
Discussions

Prettier @trivago/prettier-plugin-sort-imports fails to place .css imports at the bottom
I'm using @trivago/prettier-plugin-sort-imports to automatically sort imports in my React project. The sorting works for most cases, but I'm having issues getting .css and .scss imports that doesn't More on stackoverflow.com
🌐 stackoverflow.com
prettier-plugin-sort-imports with prettier >=3
Environment Prettier version**: 3.0.3 node version 18 package manager: yarn@2 IDE: VScode Describe the bug with version >=3 prettier-plugin-sort-imports doesn't work while with version 2.0.8 it wor... More on github.com
🌐 github.com
10
August 30, 2023
Need your opinion on the preferred way of sorting TS Imports
Ask yourself: Does the fix require a functional change to your code? Like maybe using arrow functions instead of function declarations? If yes: eslint If no: prettier Import sorting is not a functional change (or shouldn't be at least), therefore use prettier. More on reddit.com
🌐 r/typescript
22
14
July 24, 2023
node.js - prettier-plugin-sort-imports ignores import order - Stack Overflow
I am using @trivago/prettier-plugin-sort-imports 4.0.0 with prettier 2.6.2 and it seems that it just plainly ignores what I am writing in there. Or I cannot figure out how to correctly specify what I More on stackoverflow.com
🌐 stackoverflow.com
🌐
trivago
tech.trivago.com › presenting @trivago/prettier-plugin-sort-imports
Presenting @trivago/prettier-plugin-sort-imports · trivago tech blog
December 17, 2021 - The @trivago/prettier-plugin-sort-imports prettier plugin sorts the import declarations by using prettier.
🌐
Medium
medium.com › @diballesteros › how-to-quickly-sort-imports-with-prettier-14f82b16a956
How to quickly sort imports with Prettier | by Diego Ballesteros (Relatable Code) | Medium
March 30, 2022 - This plugin receives an array of strings. It uses these strings to decide the order of our imports! So for example in my small sample project I have the following files: ... So we’ll have to set up the rules to configure them.
🌐
npm
npmjs.com › package › @trivago › prettier-plugin-sort-imports
@trivago/prettier-plugin-sort-imports - npm
January 28, 2025 - A prettier plugin to sort import declarations by provided Regular Expression order.
      » npm install @trivago/prettier-plugin-sort-imports
    
Published   Nov 04, 2025
Version   6.0.0
Author   Ayush Sharma
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports › releases
Releases · trivago/prettier-plugin-sort-imports
A prettier plugin to sort imports in typescript and javascript files by the provided RegEx order. - trivago/prettier-plugin-sort-imports
Author   trivago
🌐
npm Trends
npmtrends.com › @trivago › prettier-plugin-sort-imports
@trivago/prettier-plugin-sort-imports | npm trends
Comparing trends for @trivago/prettier-plugin-sort-imports 6.0.0 which has 2,533,378 weekly downloads and 3,855 GitHub stars.
Find elsewhere
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports › issues › 251
prettier-plugin-sort-imports with prettier >=3 · Issue #251 · trivago/prettier-plugin-sort-imports
August 30, 2023 - Environment Prettier version**: 3.0.3 node version 18 package manager: yarn@2 IDE: VScode Describe the bug with version >=3 prettier-plugin-sort-imports doesn't work while with version 2.0.8 it wor...
Published   Aug 30, 2023
🌐
Bundlephobia
bundlephobia.com › package › @trivago › prettier-plugin-sort-imports
@trivago/prettier-plugin-sort-imports ❘ Bundlephobia
Find the size of javascript package @trivago/prettier-plugin-sort-imports. Bundlephobia helps you find the performance impact of npm packages.
🌐
Tessl
tessl.io › registry › tessl › npm-trivago--prettier-plugin-sort-imports › 5.2.0 › files › docs › configuration.md
tessl/npm-trivago--prettier-plugin-sort-imports@5.2.x - Registry - Tessl
A Prettier plugin that automatically sorts import declarations in JavaScript and TypeScript files according to configurable Regular Expression patterns.
🌐
CodeSandbox
codesandbox.io › examples › package › @trivago › prettier-plugin-sort-imports
@trivago/prettier-plugin-sort-imports examples - CodeSandbox
Use this online @trivago/prettier-plugin-sort-imports playground to view and fork @trivago/prettier-plugin-sort-imports example apps and templates on CodeSandbox.
🌐
Reddit
reddit.com › r/typescript › need your opinion on the preferred way of sorting ts imports
r/typescript on Reddit: Need your opinion on the preferred way of sorting TS Imports
July 24, 2023 -

Which of these options is the best for sorting imports? What cons and pros, maybe in your experience you rated them and can say what is better in terms of ease of use or configurations.

Prettier:

  • trivago/prettier-plugin-sort-imports

  • IanVS/prettier-plugin-sort-imports

ESLint:

  • build-in "sort-imports"

  • eslint-plugin-import (import/order)

  • eslint-plugin-simple-import-sort

EDIT: Now I stack on the question of what is better to use ESLINT or Prettier for imports sorting? It seems to me that sorting imports is more a specialization of the formatter and not of the linter?

🌐
npm
npmjs.com › package › @plasmohq › prettier-plugin-sort-imports
@plasmohq/prettier-plugin-sort-imports - npm
July 14, 2023 - This was forked from IanVS/prettier-plugin-sort-imports, which was a fork of @trivago/prettier-plugin-sort-imports.
      » npm install @plasmohq/prettier-plugin-sort-imports
    
Published   Jul 14, 2023
Version   4.0.1
Author   Plasmo Corp.
🌐
GitHub
github.com › IanVS › prettier-plugin-sort-imports
GitHub - IanVS/prettier-plugin-sort-imports: An opinionated but flexible prettier plugin to sort import statements · GitHub
A prettier plugin to sort import declarations by provided Regular Expression order, while preserving side-effect import order. This project is based on @trivago/prettier-plugin-sort-imports, but adds additional features:
Author   IanVS
🌐
DEV Community
dev.to › josephciullo › how-to-customize-import-sorting-in-javascript-with-prettier-and-regex-1h8j
Customizing JavaScript Import Sorting in VSCode Using Prettier (and Regex) - DEV Community
January 20, 2024 - @trivago/prettier-plugin-sort-imports: By incorporating this package, we gain the capability to leverage Prettier for not only code formatting but also the systematic arrangement of import statements.
🌐
npm Trends
npmtrends.com › @trivago › prettier-plugin-sort-imports-vs-import-sort-vs-prettier-plugin-organize-imports
@trivago/prettier-plugin-sort-imports vs import-sort vs prettier-plugin-organize-imports | npm trends
Comparing trends for @trivago/prettier-plugin-sort-imports 6.0.2 which has 2,254,076 weekly downloads and 3,875 GitHub stars vs. import-sort 6.0.0 which has 60,541 weekly downloads and 464 GitHub stars vs. prettier-plugin-organize-imports 4.3.0 ...
🌐
Stack Overflow
stackoverflow.com › questions › 76127977 › prettier-plugin-sort-imports-ignores-import-order
node.js - prettier-plugin-sort-imports ignores import order - Stack Overflow
I'm considering opening up some sort of bug report ticket. Though I don't see what could cause the issue. It is clearly doing something different, just not what it is being told lol ... For me it was something stupid, I think I put @components instead of @/components so that was the difference I think, check for that and if that does not work double check your regexes. Hope it works for you too! ... Something like this will get you far. { "importOrder": ["^react", "^.(css|scss)$", "<THIRD_PARTY_MODULES>", "^components/(.*)$", "^[./]"], "importOrderSeparation": true, "importOrderSortSpecifiers": true }
🌐
UNPKG
app.unpkg.com › @trivago › prettier-plugin-sort-imports@5.2.1
trivago/prettier-plugin-sort-imports
A prettier plugins to sort imports in provided RegEx order · github.com/trivago/prettier-plugin-sort-imports