Skip to content

When default exporting a Flow Enum, do not append semicolon#8768

Merged
sosukesuzuki merged 2 commits intoprettier:masterfrom
gkz:flow-enums-export-default
Jul 16, 2020
Merged

When default exporting a Flow Enum, do not append semicolon#8768
sosukesuzuki merged 2 commits intoprettier:masterfrom
gkz:flow-enums-export-default

Conversation

@gkz
Copy link
Copy Markdown
Collaborator

@gkz gkz commented Jul 16, 2020

This is a bug fix (missed this during initial support). Like function declarations and class declarations, Flow Enum declarations should not be trailed by a semicolon.

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

Try the playground for this PR

@sosukesuzuki sosukesuzuki merged commit bd8992d into prettier:master Jul 16, 2020
@fisker
Copy link
Copy Markdown
Member

fisker commented Jul 22, 2020

@gkz Do you know will this format into invalid code?

Prettier pr-8768
Playground link

--parser flow
--no-semi

Input:

export default enum B {}

[].forEach(() => 0)

Output:

export default enum B {}

;[].forEach(() => 0)

@gkz
Copy link
Copy Markdown
Collaborator Author

gkz commented Jul 22, 2020

That behavior is fine, the semicolon does not create invalid code, it was just not necessary.

@fisker
Copy link
Copy Markdown
Member

fisker commented Jul 22, 2020

Okay, thanks.

@thorn0
Copy link
Copy Markdown
Member

thorn0 commented Jul 23, 2020

@fisker That's a documented behavior: https://prettier.io/docs/en/rationale.html#semicolons

@fisker
Copy link
Copy Markdown
Member

fisker commented Jul 23, 2020

I know that, I was afraid that ; break things.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants