Repository navigation
[Babel 8]: Remove record and tuple syntax support - #17242
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59109 |
|
Fyi, quoting @acutmore (champion of composites, co-champion of R&T):
I think in the migration guide we should direct people to that polyfill, that they are already using anyway because Babel's transpiled code relies on it. |
Thank you, I drafted a migration guide on babel/website#3080, PTAL. |
|
Prettier PR merged. |
| export const tt = { | ||
| // Punctuation token types. | ||
| bracketL: createToken("[", { beforeExpr, startsExpr }), | ||
| // TODO: Remove this in Babel 8 |
There was a problem hiding this comment.
These are all not user-exposed, right?
There was a problem hiding this comment.
Unfortunately it is exposed via the tokens parser option. And Babel eslint parser depends on token labels so that it can transform Babel tokens to espree tokens. Although espree does not support R&T, we do have to convert it to a punctuator token type.
| @@ -1,3 +1,7 @@ | |||
| import runner from "@babel/helper-plugin-test-runner"; | |||
There was a problem hiding this comment.
Can we just remove and deprecate this plugin? I can add it to the babel/babel-archive repo.
There was a problem hiding this comment.
I think it'd better to be removed after we published Babel 8. This plugin can function as a codemod to help people migrate to the factory calls, in babel/website#3080 I provided an example Babel config for such purpose. For this reason, we have to keep it in the monorepo otherwise it might be broken unexpectedly by any internal changes.
There was a problem hiding this comment.
@JLHwung Sorry I don't fully understand what you mean, can't we just remove this plugin and keep the parser tests? This plugin doesn't seem to use private APIs or have relevant code in traverse.
There was a problem hiding this comment.
Most archived libraries are either trivial syntax plugins or helpers deemed no longer used by us. Like I said although this plugin can be archived now, it can be repurposed to a codemod that potentially helps people migrate from the novel syntax to the Record/Tuple factory calls, we should guarantee that this plugin works for every @babel/* 7 versions, as long as the parser supported R&T.
This plugin depends on @babel/helper-module-imports and @babel/helper-validator-option. It is not a very trivial plugin like those archived syntax plugins. Staying in the monorepo gives us the assurance that it won't break when users are migrating from Babel 7 to Babel 8.
In this PR we remove the record&tuple (R&T) syntax support since the ES proposal has been withdrawn on Apr 14, 2025. We removed most Babel 8 only R&T tests: Babel 7 will still support R&T.
but we urge users to migrate to the composites proposal.