Skip to content

Print leading comment for readonly modifier of TS Mapped Types#11190

Closed
sosukesuzuki wants to merge 8 commits intoprettier:mainfrom
sosukesuzuki:fix-11098
Closed

Print leading comment for readonly modifier of TS Mapped Types#11190
sosukesuzuki wants to merge 8 commits intoprettier:mainfrom
sosukesuzuki:fix-11098

Conversation

@sosukesuzuki
Copy link
Copy Markdown
Contributor

@sosukesuzuki sosukesuzuki commented Jul 11, 2021

Description

Fixes #11098

Since TSMappedType contains { and }, it could not be implemented as a simple leading comments.

Checklist

  • I’ve added tests to confirm my change works.
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki sosukesuzuki requested review from fisker and thorn0 July 11, 2021 06:04
@fisker
Copy link
Copy Markdown
Member

fisker commented Aug 30, 2021

I'm not sure if we want to do this, the current output seems more preferred for me.

Prettier pr-11190
Playground link

--parser babel

Input:

class A {
  static // comment
  foo() {}
  
  get // comment
  foo() {}
  
   // comment
  static
  foo() {}
  
  // comment
  get 
  foo() {}
  
}

Output:

class A {
  static // comment
  foo() {}

  get // comment
  foo() {}

  // comment
  static foo() {}

  // comment
  get foo() {}
}

@thorn0
Copy link
Copy Markdown
Member

thorn0 commented Sep 7, 2022

superseded by #13427

@thorn0 thorn0 closed this Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comment gets wrongly placed after readonly keyword in mapped type

3 participants