Files
test-repo/tests/format/flow
Oskari Noppa 6a5efe7fa8 Print semi before Flow variance sigil w/ no-semi (#11398)
* Print semi before Flow variance sigil w/ no-semi

Fixes #11397. Omitting semicolon before class property with a Flow
variance sigil `+` or `-` may lead to output that is syntatically
incorrect or has incorrect runtime behaviour.

* Add changelog for PR 11398

* Put semi to the end of previous line

Put the semicolon for Flow class property variance sigil to the end of
the previous line, not at the beginning of the the line where the
variance sigil is.

This approach was suggested in the comments of #11398.

* Add babel-flow to parser to Flow no-semi specs

As per discussion in PR #11398, babel-flow parser should also be tested.

* Print semi before private fields w/ variance

* Add private fields to changelog

* Use existing isClassProperty helper

Use existing helper function `isClassProperty` to simplify the conditional
a bit.
Note that this also adds new case, `type === "PropertyDefinition"`, that
would be a match. However, nextNode.type can't be "PropertyDefinition"
in practice, as it's part of estree parser output which doesn't support
Flow. There's no real downside in checking that extra case, though, and
this does simplify the code a bit.

* Add new property tests to the snapshot spec

* Change one of the variance sigils to `-` (contravariant)
* Add one computed property
* Make one of the property values be a function

These cases also require semi in the previous line.

* Add new testcases from previous patch to changelog

* Add variance sigil to computed property in spec
2021-08-30 21:19:05 +09:00
..
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00
2021-04-25 20:01:56 +08:00