6a5efe7fa8810395e944601ac2103361ca7c9df2
* 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
Opinionated Code Formatter
JavaScript
· TypeScript
· Flow
· JSX
· JSON
CSS
· SCSS
· Less
HTML
· Vue
· Angular
GraphQL
· Markdown
· YAML
Your favorite language?
Intro
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
Input
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
Output
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);
Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
Badge
Show the world you're using Prettier →
[](https://github.com/prettier/prettier)
Contributing
See CONTRIBUTING.md.
Languages
JavaScript
98.6%
CSS
0.9%
Vue
0.2%
HTML
0.2%
MDX
0.1%
