Skip to content
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

Misc fixes to @babel/types AST definitions #14730

Merged
merged 7 commits into from Jul 7, 2022

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 6, 2022

Q                       A
Fixed Issues? See below
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
  • Allow BigIntLiteral as property/method key
  • Refine error message when parsing decorator codes without the corresponding plugin: Now Babel will throw "Support for the experimental syntax 'decorators' isn't currently enabled" instead of referring to the legacy decorators plugin.
  • Validate ClassPrivateProperty.static (boolean defaults to false)
    Technically this one may be a breaking change, because now Babel types will throw when the provided static is non-boolean, though I doubt anyone has ever spotted it.
  • Disallow "constructor" as ClassPrivateMethod.kind

@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: types labels Jul 6, 2022
@babel-bot
Copy link
Collaborator

babel-bot commented Jul 6, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52440/

@JLHwung
Copy link
Contributor Author

JLHwung commented Jul 6, 2022

BTW TIL we have "decorators"

decorators: {
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("Decorator")),
),
},

for the PatternLike nodes such as Identifier/ArrayPattern/ObjectPattern. Does @f x has ever been supported in legacy decorators proposal? Currently Babel throws "leading decorators must be attached to a class declaration" anyway. If this property is redundant we can consider remove it from Babel 8.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jul 7, 2022

@JLHwung That's probably for TS parameter decorators:

class A {
  f(@d a, @d { x, y }) {}
}

Changing it goes in the same direction as #9545.

@nicolo-ribaudo nicolo-ribaudo changed the title AST types misc fix Misc fixes to @babel/types AST definitions Jul 7, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 1c79224 into babel:main Jul 7, 2022
35 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the ast-types-misc-fix branch Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: types PR: Spec Compliance 👓 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants