Skip to content

[prettier-plugin-sort-imports]: import sorting aborted due to babel parsing error for .md files #364

@nasraldin

Description

@nasraldin

Your Environment

  • Prettier version: 3.5.3
  • node version: 20.x.x
  • package manager: [email protected]
  • IDE: VScode

Describe the bug
When running pnpm lint or pnpm format, the import sorting plugin fails on Markdown files with the error:[prettier-plugin-sort-imports]: import sorting aborted due to babel parsing error

To Reproduce

  1. Create a Markdown file in the project
  2. Run prettier --write --list-different .
  3. The error occurs even though Markdown files don't contain imports

Error log

.md [error] [prettier-plugin-sort-imports]: import sorting aborted due to babel parsing error

Expected behavior
Markdown files should be formatted normally without triggering import sorting.

Screenshots, code sample, etc
The error occurs in files like:.md

Configuration File

{
  "semi": true,
  "singleQuote": true,
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 84,
  "arrowParens": "always",
  "trailingComma": "all",
  "importOrder": [
    "^(react/(.*)$)|^(react$)",
    "^(next/(.*)$)|^(next$)",
    "<THIRD_PARTY_MODULES>",
    "",
    "^@.*",
    "",
    "^[./]"
  ],
  "tailwindAttributes": ["theme"],
  "tailwindFunctions": ["clsx", "cva", "tw", "cn", "twMerge", "createTheme"],
  "importOrderParserPlugins": [
    "typescript",
    "jsx",
    "decorators-legacy",
    "classProperties"
  ],
  "plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
  "proseWrap": "always"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions