Skip to content

Semicolon is added when organize import in specific case #50817

Closed as not planned
@orblazer

Description

@orblazer

Bug Report

🔎 Search Terms

  • Semicolon organize import
  • Semicolon vscode

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about semicolon organize import

💻 Code

import { resolve } from "path"

type test = { var1: number; var2: string }

console.log(resolve(__dirname))

Vscode config (settings.json) :

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.organizeImports": true
    // "source.sortImports": true // This also append when this is enabled
  },
  "typescript.tsdk": "./node_modules/typescript/lib"
}

Prettier config (.prettierrc)

{
  "semi": false
}

🙁 Actual behavior

When i save file, this add semicolon on all import.

🙂 Expected behavior

No add semicolon on import.

Additional information

That issue ONLY append when i have an type write like that { var1: number; var2: string }, so i think the organize/sort (maybe from here #31801) think the semicolon is used because is present in code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions