60 Commits

Author SHA1 Message Date
Yosuke Kurami
1f97b91655 fix: don't write ': ' token when name is null (#7769) 2018-04-21 11:34:24 -04:00
Brian Ng
3299086955
Add support for flow implements (#7741) 2018-04-18 08:54:30 -05:00
Boris Cherny
c3654d83c8 Generate TypeScript typings, and improve generated Flow typings (#7101)
* generate typescript types

* improve type generator output

* move generator scripts to scripts/generators

* use new stringifier for generating flow types too

* export summary types

* add support for oneOfNodeOrValueTypes to improve type generation

* export typescript types from top level, and remove module declaration

* generate typescript/flow types and copy typescript types to babel-types/lib as part of make build

* copy flow types to babel-types/lib as part of make build (fix #6839)

* improve typing: Identifier->name should be a string, not any

* avoid destructuring, to support node 4

* update doc generator to share more code, regenerate babel-types readme, pipe all generator output to stdout

* regenerate babel-types readme as part of make build

* improve typing: ClassProperty->key should be Identifier | StringLiteral | NumericLiteral | Expression, not any

* improve typing: optional node properties are nullable, not undefinedable

* improve docs: FlowClassImplements should be ClassImplements

* make ts usage more friendly: when using babel-types api, make optional params | undefined, and when reading nodes keep optional params | null

* rm lib/types.d.ts and lib/types.js in favor of packages/babel-types/lib

* add missing variance node type, address review comments

* add tests for flow variance

* Comment should be a disjoint union of tagged types

* update .flowconfig
2018-01-17 10:31:46 -05:00
Bogdan Chadkin
d25918aa5d Fix generation flow unnamed computed property (#7095) 2017-12-22 12:55:40 -06:00
Brian Ng
f5ef928586
Add method property to ObjectTypeProperty (#7005) 2017-12-11 09:32:16 -06:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
314bd31b85 update generator/babel-types printing, babylon (#6306)
* update generator printing, babylon [skip ci]

* Update babel-types for TS node types
2017-09-26 10:01:55 -04:00
jbrown215
4e9a25e34a Flow opaque type aliases (#5990) 2017-08-02 16:30:19 -05:00
Andy
c1d07fd6db babel-generator: Add TypeScript support (#5896)
* babel-generator: Add TypeScript support

* Remove type declarations; not published from babylon

* Remove TODOs

* Consistently use `this.word` for tokens that are words
2017-07-28 16:07:05 -04:00
Brian Ng
9a1b8ea443 Add support for flow predicates in babel-generator (#5984) 2017-07-25 11:38:17 -04:00
Brian Ng
55aea26f13 Add support for export type star in babel-generator (#5985)
* Add support for export type star in babel-generator

* Bump babylon
2017-07-25 11:37:27 -04:00
Daniel Tschinder
b3372a572d Remove whitespace generation (#5833)
* Remove whitespace generation and rely on default printing

Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines

* Fix a few more fixtures
2017-06-27 21:57:02 -05:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Daniel Tschinder
36ab72f095 Support declare export statements (#5589)
* Add definition of declare export statements

* Add more codecoverage
2017-06-08 23:15:54 +02:00
Conrad Buck
8434f89bc0 Add support for object type spread (#5525)
* Add support for object type spread

* Type spread: remove variance and add stripping test
2017-04-20 11:59:45 -04:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Daniel Tschinder
ca78da6501 Fix variance (#5320) 2017-02-15 22:37:19 +01:00
Toru Kobayashi
9188be9ed5 [7.0] Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#5199) 2017-02-15 14:58:07 -05:00
Charles Pick
bc8f476d33 [7.0] Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#5229) 2017-02-15 14:54:27 -05:00
Henry Zhu
9083bd6283 Merge branch 'master' into 7.0 2017-02-09 18:36:02 -05:00
Logan Smyth
b845f2b69d Re-enable the max-len ESLint rule. (#5265) 2017-02-04 11:07:15 -05:00
Chau Nguyen
d710e6dd5b [7.0] Drop flowUsesCommas option from babel-generator (#5123) 2017-01-19 22:24:13 -05:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Brian Ng
3a27f49c57 Fix identation with empty leading ObjectTypeProperty (#4862) 2016-11-19 10:47:41 -05:00
Sam Pepose
db85bdc3fc Added flowCommaSeparator option for object types (#3547) 2016-11-15 14:43:42 -05:00
Sam Goldman
7bb430aeea Add variance node type and generate property variance annotations (#4697)
* Add variance node type and generate property variance annotations

babel/babylon#161 adds parsing support for property variance
annotations. This PR adds the necessary node type for the new Variance
node and generate support for all the positions where variance can now
appear.

* Variance is no longer a separate node type

This diff also adds tests to class properties and to the
flow-strip-types transform.

* Add test + fix for edge case with variance and class proeprties
2016-10-21 16:05:36 -04:00
Sam Goldman
15183078e6 Add EmptyTypeAnnotation (#4724)
Added to Flow in facebook/flow#c603505583993aa953904005f91c350f4b65d6bd
Parser support added in babel/babylon#171.
2016-10-14 15:16:02 -04:00
sugargreenbean
c57e0e88a5 changed bool to boolean as well as updated tests (#4646) 2016-10-03 19:31:56 -04:00
Basil Hosmer
cb4b2b0744 flow plugin: generate exact object type annotations (#3702) 2016-09-20 11:10:55 +02:00
Paul O’Shannessy
55f37a1b1e Use arrow syntax for ObjectTypeProperty FunctionTypeAnnotations (#3663)
This fixes an issue where optional properties would get transformed to
an invalid syntax. The easiest solution was to make all FunctionTypes
get transformed to the arrow syntax (previously everything went the
other way).
2016-08-20 10:37:56 -04:00
Daniel Tschinder
308de41992 Add support for the new declare module.exports of flow. (#3570) 2016-08-16 16:54:00 +02:00
Logan Smyth
5de7433147 Avoid calls to isUserWhitespacable by explicitly marking statement lists. 2016-07-17 21:51:00 -07:00
Sam Pepose
199a612131 Fixed incorrect printing of array of nullable flow type 2016-06-22 20:33:43 -07:00
Logan Smyth
df2c3f3d25 Use the common space helper everywhere to ensure we get the smallest output possible. 2016-06-16 22:00:24 -07:00
Logan Smyth
4286cb4f2a Explicitly label standalone tokens and words. 2016-06-16 22:00:23 -07:00
Logan Smyth
e702e67233 Split all of the pushes into individual tokens. 2016-06-16 22:00:23 -07:00
Logan Smyth
8336aa52e8 Split all of the separators into functions. 2016-06-16 20:31:19 -07:00
Logan Smyth
3e1a661eb6 Use the general list handlers and the default separator. 2016-06-16 20:31:19 -07:00
Logan Smyth
528128f62d Avoid looking for raw values for all nodes. 2016-06-16 20:31:19 -07:00
Henry Zhu
b567c02413 generator tests 2016-06-10 18:05:54 -04:00
Henry Zhu
ad0e1ba6de Support changes in flow parsing 2016-06-08 13:07:58 -04:00
Amjad Masad
2fbe28cc88 Remove remaining @flow annotations 2016-03-03 15:10:59 -08:00
Amjad Masad
12ee11a0a4 Revert "Remove Flow annotations and pragmas"
This reverts commit 4252244d06b225ab26a02d52c04f9940a3e4d6a2.
2016-03-03 15:03:55 -08:00
Sam Goldman
4252244d06 Remove Flow annotations and pragmas 2016-02-28 13:18:57 -10:00
Sebastian McKenzie
5b89849f43 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Sam Goldman
26c97c4069 Add support for "declare interface" Flow syntax
This has been a feature in Flow for a long time (couldn't easily find a
specific commit adding this). Interfaces are basically undocumented, though, so
it's easy to see how this was missed.
2016-01-04 11:50:12 -08:00
Sam Goldman
e764346d5f Add support for "declare type" Flow syntax
See facebook/flow#1105
2016-01-04 11:42:43 -08:00
Sebastian McKenzie
5ca1cf0506 Merge pull request #3203 from samwgoldman/flow-mixins-6.x
Add support for mixins to Babel 6.x
2015-12-27 21:04:40 +00:00
Sam Goldman
e9c23ba7a1 Don't generate class mixins if prop doesn't exist 2015-12-23 16:37:14 -05:00
Sam Goldman
bb874a4e46 Add babel-generator support for mixins to Babel 6.x 2015-12-23 16:26:29 -05:00