Skip to content

fix: keep trailing comment for switch case associated with the switch case - #901

Merged
dsherret merged 2 commits into
dprint:mainfrom
thristhart:fix/switch-case-trailing-comment-order
Nov 6, 2026
Merged

dsherret merged 2 commits into
dprint:mainfrom
thristhart:fix/switch-case-trailing-comment-order

Conversation

@thristhart

Copy link
Copy Markdown
Contributor

prior to this,

    case 1:
        b(); // trailing
    // eslint-disable-next-line no-fallthrough
    default:

became

    case 1:
        b();
    // eslint-disable-next-line no-fallthrough
     // trailing
    default:

thristhart and others added 2 commits November 6, 2026 07:39
… case

prior to this,
```ts
    case 1:
        b(); // trailing
    // eslint-disable-next-line no-fallthrough
    default:
```
became
```ts
    case 1:
        b();
    // eslint-disable-next-line no-fallthrough
     // trailing
    default:
```
… in a switch case

Also reuse gen_trailing_comments for the comments on the case's last line.

@dsherret dsherret left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dsherret
dsherret merged commit 93130eb into dprint:main Nov 6, 2026
1 check passed
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.

2 participants