Skip to content

Incorrect formatting for auto-accessors with comments #14036

@weareoutman

Description

@weareoutman

Prettier 2.8.1
Playground link

# Options (if any):

Input:

class A {
  @dec()
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  accessor b;
}

Output:

class A {
  @dec()
  accessor // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  b;
}

Expected behavior:
The comments should not be placed between the keyword accessor and the identifier b, which causes the accessor to be treated as a class field instead of a keyword. Expected:

class A {
  @dec()
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  accessor b;
}

Metadata

Metadata

Assignees

Labels

lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions