Skip to content

When formatting with paste semicolons appear in imports #226

@rokartur

Description

@rokartur

Your Environment

  • Prettier version: 3.6.2
  • node version: 24.4.1
  • package manager: [email protected]
  • IDE: VSCode 1.102.1

Describe the bug

While prettier is configured not to insert semicolons and the “editor.formatOnPaste” option is set to true, when you paste anything, semicolons are added only at the end of the imports.

The problem disappears when I remove the plugin from the plugin list.

To Reproduce

Paste anything into the file so that prettier formats it.

Expected behavior

The extension should respect prettier config and not add semicolons to the end of imports during formatOnPaste

Screenshots, code sample, etc

Format on paste

Capture.screen.Thursday.17.July.2025.at.5.32.41.9tTDtOtm.mp4

Manual format and format on save

Capture.screen.Thursday.17.July.2025.at.5.35.48.InQLNF67.mp4

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

.prettierrc

{
  "$schema": "https://json.schemastore.org/prettierrc",
  "arrowParens": "avoid",
  "bracketSameLine": false,
  "bracketSpacing": true,
  "semi": false,
  "singleQuote": true,
  "jsxSingleQuote": true,
  "quoteProps": "as-needed",
  "trailingComma": "all",
  "singleAttributePerLine": false,
  "htmlWhitespaceSensitivity": "strict",
  "vueIndentScriptAndStyle": true,
  "proseWrap": "never",
  "insertPragma": false,
  "printWidth": 120,
  "requirePragma": false,
  "tabWidth": 2,
  "useTabs": true,
  "embeddedLanguageFormatting": "off",
  "endOfLine": "auto",
  "importOrder": [
    "<BUILTIN_MODULES>",
    "^@/assets/(.*)$",
    "^(react/(.*)$)|^(react$)",
    "<THIRD_PARTY_MODULES>",
    "^@/(.*)$",
    "^@/components/(.*)$",
    "^@/hooks/(.*)$",
    "^@/lib/(.*)$",
    "^@/utils/(.*)$",
    "^@/icons/(.*)$",
    "^@/routes/(.*)$",
    "^./(.*)$"
  ],
  "plugins": [
    "@ianvs/prettier-plugin-sort-imports",
    "prettier-plugin-tailwindcss"
  ],
  "tailwindStylesheet": "/src/assets/index.css",
  "tailwindFunctions": [
    "clsx",
    "cn",
    "twMerge"
  ],
  "tailwindPreserveWhitespace": false,
  "tailwindPreserveDuplicates": false
}

.vscode/settings.json

{
	"prettier.configPath": ".prettierrc",
	"prettier.ignorePath": ".prettierignore",
	"editor.formatOnType": false,
	"editor.formatOnPaste": true,
	"editor.formatOnSave": true,
	"editor.formatOnSaveMode": "file",
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	"files.associations": {
		"*.css": "tailwindcss"
	},
	"githubIssues.useBranchForIssues": "prompt"
}

Error log

Output gives no errors

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

  • I'm willing to fix this bug 🥇

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions