Convert @babel/parser to TypeScript#14783
Merged
JLHwung merged 9 commits intobabel:mainfrom Jul 23, 2022
Merged
Conversation
yarn dlx flowts --no-allow-js --interactive-rename -i "./src/**/*.js" "./packages/babel-parser/" && yarn eslint packages/babel-parser '**/*.ts' --fix
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52583/ |
Member
|
Amazing PR and at the same time CI is completely green, I like it very much! |
| ?{ code?: ParseErrorCode, reasonCode?: string } | boolean, | ||
| function toParseErrorCredentials( | ||
| b: string, | ||
| a?: |
Member
There was a problem hiding this comment.
export was added before the comment, which seems to be a problem with the automatic conversion.
update: I tried to pick the code block and it failed, see the code before and after here.
nicolo-ribaudo
approved these changes
Jul 22, 2022
Member
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Thanks, awesome! I pushed a commit undoing some minor format changes.
liuxingbaoyu
approved these changes
Jul 23, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we converts
babel-parserto TypeScript, which marks an end of the transition from Flow (but not the end of improving the codebase typings). I tried to make this PR as small as possible. For those typing errors which can't be fixed at my first glance, I suppress them with@ts-expect-error. Hopefully we will remove most of them when we further improve the parser typings.Significant changes:
Undonetype marker is introduced for those intermediate AST nodes created bystartNodeAccessing the
typeproperty is a typing error so we are sure that we didn't do any type differentiation on unfinished AST nodes, otherwise the other properties are typed as the AST definitions in "babel-parser".this.someParserMethodwhich is not overridden in the plugin, we usesuper.someParserMethodinstead.Further Improvements that be landed in separate PRs:
@babel/parserAST types to@babel/typesAST types@ts-expect-errorcommentsThis PR revives #13370. I should also thank @zxbodya, who maintains the
flowtswhich helps the transition process.