Skip to content

The semicolons: "remove" formatting option doesn't remove extraneous semicolons #59779

Closed
@ChiriVulpes

Description

@ChiriVulpes

🔎 Search Terms

semicolon remove

🕗 Version & Regression Information

  • This is the behavior in every version I tried (used every-ts back to where the formatting option was first introduced), and I reviewed the FAQ for entries about semicolons

⏯ Playground Link

No response

💻 Code

declare const opt: number | undefined;

const a = 1;
const b = 2;
;[1, 2, 3]

const c = opt ? 1 : 2;
const d = opt ? 1 : 2;
;[1, 2, 3]

const e = opt ?? 1;
const f = opt ?? 1;
;[1, 2, 3]

type a = 1;
type b = 2;
;[1, 2, 3]

type c = typeof opt extends 1 ? 1 : 2;
type d = typeof opt extends 1 ? 1 : 2;
;[1, 2, 3]

🙁 Actual behavior

declare const opt: number | undefined

const a = 1
const b = 2;
;[1, 2, 3]

const c = opt ? 1 : 2
const d = opt ? 1 : 2;
;[1, 2, 3]

const e = opt ?? 1
const f = opt ?? 1;
;[1, 2, 3]

type a = 1
type b = 2;
;[1, 2, 3]

type c = typeof opt extends 1 ? 1 : 2
type d = typeof opt extends 1 ? 1 : 2;
;[1, 2, 3]

🙂 Expected behavior

declare const opt: number | undefined

const a = 1
const b = 2
;[1, 2, 3]

const c = opt ? 1 : 2
const d = opt ? 1 : 2
;[1, 2, 3]

const e = opt ?? 1
const f = opt ?? 1
;[1, 2, 3]

type a = 1
type b = 2
;[1, 2, 3]

type c = typeof opt extends 1 ? 1 : 2
type d = typeof opt extends 1 ? 1 : 2
;[1, 2, 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions