New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computed class properties #4500
Conversation
** Depends on babel/babylon#121 ** * `babel-types`: Add `computed` field to `ClassProperty` * `babel-plugin-transform-class-properties`: handle computed property names correctly * `babel-generator`: add tests for class properties (computed/literal, static/instance)
…ue`) See README.md for documentation. This feature is blocked on the following Babel PRs/issues: * babel/babel#4500 * babel/babylon#121 * babel/babel#4337 * babel/babel#4230 (partially)
2: If there is no builder entry in the type it defaults to visitors: https://github.com/babel/babel/blob/master/packages/babel-types/src/definitions/index.js#L135 This is definitely a breaking change, would it be okey to make computes the last argument? |
Current coverage is 88.38% (diff: 100%)@@ master #4500 diff @@
==========================================
Files 194 194
Lines 13628 13635 +7
Methods 1427 1427
Messages 0 0
Branches 3152 3155 +3
==========================================
+ Hits 12041 12051 +10
+ Misses 1587 1584 -3
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really consider writing tests for babel-types especially the logic for validators, but I wouldn't block this PR because of that.
thanks. |
@danez can make an issue for that |
* Support computed class property names (babel#4499) ** Depends on babel/babylon#121 ** * `babel-types`: Add `computed` field to `ClassProperty` * `babel-plugin-transform-class-properties`: handle computed property names correctly * `babel-generator`: add tests for class properties (computed/literal, static/instance) * doc: Update babel-types with ClassProperty.computed * chore(package): update babylon to v6.11.0 * babel-types: move ClassProperty.computed to be last builder arg
…ue`) See README.md for documentation. This feature is blocked on the following Babel PRs/issues: * babel/babel#4500 * babel/babylon#121 * babel/babel#4337 * babel/babel#4230 (partially)
…ue`) See README.md for documentation. This feature is blocked on the following Babel PRs/issues: * babel/babel#4500 * babel/babylon#121 * babel/babel#4337 * babel/babel#4230 (partially)
…ue`) See README.md for documentation. This feature is blocked on the following Babel PRs/issues: * babel/babel#4500 * babel/babylon#121 * babel/babel#4337 * babel/babel#4230 (partially)
(but see note2)babel-types
README only)Comments on the above table
1: As a first-time contributor it's kinda hard for me to classify this change 😄
It tracks a roughly year-old update to a stage 2 proposal (tc39/proposal-class-public-fields), which is otherwise already implemented.
2:
I suppose the addition ofSuperseded by the latest commit per @danez's suggestion.computed
as the third (and not last) builder argument in babel-types/src/definitions/flow.js#L47 may be considered a breaking change to clients of that package (but what was the behavior there in the absence of thebuilder
property, anyway?). I'll happily change it to whatever you people prefer.3: I did not add tests for my changes to
babel-types
, because I could not find any existing tests for this package. (Am I missing something?)4: The full test suite doesn't run to completion on my Windows dev machine, but what did run seems OK.
Notes on the change
Depends on babel/babylon#121 which has been released in Babylon v6.11.0.
Changes to individual modules:
babel-types
: Addcomputed
field toClassProperty
babel-plugin-transform-class-properties
: handle computed property names correctlybabel-generator
: add tests for class properties (computed/literal, static/instance)