Improve plugins typings (Part 3)#14642
Merged
JLHwung merged 17 commits intobabel:noImplicitAnyfrom Jun 18, 2022
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52225/ |
JLHwung
commented
Jun 8, 2022
Comment on lines
+476
to
+478
| suiteOpts: SuiteOptions = {}, | ||
| taskOpts: TaskOptions = {}, | ||
| dynamicOpts?: (options: TaskOptions, task: Test) => void, |
Contributor
Author
There was a problem hiding this comment.
These options are not used in our codebase, maybe we can remove them in Babel 8.
| "@babel/traverse": "workspace:^", | ||
| "@types/charcodes": "^0.2.0", | ||
| "babel-plugin-polyfill-es-shims": "^0.6.0", | ||
| "charcodes": "^0.2.0", |
Member
There was a problem hiding this comment.
It's also in dependencies. We can probably only keep it in devDependencies?
the charcodes transform will inline charCodes.* so we can remove it from dependencies
nicolo-ribaudo
approved these changes
Jun 13, 2022
Comment on lines
-49
to
+61
| export function getLowestUnreleased(a: string, b: string, env: string): string { | ||
| const unreleasedLabel = unreleasedLabels[env]; | ||
| const hasUnreleased = [a, b].some(item => item === unreleasedLabel); | ||
| if (hasUnreleased) { | ||
| // @ts-expect-error todo(flow->ts): probably a bug - types of a hasUnreleased to not overlap | ||
| return a === hasUnreleased ? b : a || b; | ||
| export function getLowestUnreleased(a: string, b: string, env: Target): string { | ||
| const unreleasedLabel: | ||
| | typeof unreleasedLabels[keyof typeof unreleasedLabels] | ||
| | undefined = | ||
| // @ts-ignore unreleasedLabel is undefined when env is not safari | ||
| unreleasedLabels[env]; | ||
| if (a === unreleasedLabel) { | ||
| return b; | ||
| } | ||
| if (b === unreleasedLabel) { | ||
| return a; |
Member
There was a problem hiding this comment.
The logic here changes and doesn't always return, I'm not sure if this is expected, just a hint.
Contributor
Author
There was a problem hiding this comment.
🤔 Isn't hasReleased === true equivalent to a === unreleasedLabel || b === unreleasedLabel?
The original logic incorrectly compared a with hasUnreleased. I revised a bit to make it more straightforward.
liuxingbaoyu
approved these changes
Jun 18, 2022
JLHwung
added a commit
that referenced
this pull request
Jun 20, 2022
* external-helpers * bugfix * transform-parameters * object-rest-spread * destructuring-private * transform-destructuring * proposal-decorators * optional-chaining * helper-wrap-function * explode-assignable-expression * helper-compilation-targets * helper-plugin-utils * helpers * helper-validator-option * fix: allow "+" and "-" in MappedType .readonly/.optional * fixture-test-runner * remove charcodes from dependencies the charcodes transform will inline charCodes.* so we can remove it from dependencies
JLHwung
added a commit
that referenced
this pull request
Jun 21, 2022
* external-helpers * bugfix * transform-parameters * object-rest-spread * destructuring-private * transform-destructuring * proposal-decorators * optional-chaining * helper-wrap-function * explode-assignable-expression * helper-compilation-targets * helper-plugin-utils * helpers * helper-validator-option * fix: allow "+" and "-" in MappedType .readonly/.optional * fixture-test-runner * remove charcodes from dependencies the charcodes transform will inline charCodes.* so we can remove it from dependencies
JLHwung
added a commit
that referenced
this pull request
Jun 21, 2022
* external-helpers * bugfix * transform-parameters * object-rest-spread * destructuring-private * transform-destructuring * proposal-decorators * optional-chaining * helper-wrap-function * explode-assignable-expression * helper-compilation-targets * helper-plugin-utils * helpers * helper-validator-option * fix: allow "+" and "-" in MappedType .readonly/.optional * fixture-test-runner * remove charcodes from dependencies the charcodes transform will inline charCodes.* so we can remove it from dependencies
JLHwung
added a commit
that referenced
this pull request
Jun 21, 2022
* enable noImplicitAny * codemod (#14602) * Improve preset/plugin-typescript typings (#14603) * preset-typescript * transform-typescript * Update packages/babel-plugin-transform-typescript/src/enum.ts Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * prettier Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * Improve transform-runtime typings (#14605) * enable noImplicitAny * codemod (#14602) * Improve preset/plugin-typescript typings (#14603) * preset-typescript * transform-typescript * Update packages/babel-plugin-transform-typescript/src/enum.ts Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * prettier Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * improve transform-runtime typings Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * jsx (#14607) * Improve module transform packages typings (#14608) * improve babel-template typings (#14621) * Improve @babel/helper-* typings (#14620) * improve helper-function-name typings * helper hoist variables * helper-member-expression-to-functions * helper-simple-access * remap-async-to-generator * helper-annotate-as-pure * helper-builder-binary-assignment-operator-visitor * helper-check-duplicate-nodes * early return when export declaration is export all * split-export-declaration * helper-define-map * define-map * Update packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.ts Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * review comments Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * improve helper-module-imports typings (#14623) * refactor: simplify ImportInjector._applyDefaults * helper-module-imports * map globals to the one used in Babel 8 * Improve fixture-test-runner typings (#14625) * plugin-test-runner * fixture-test-runner * Update packages/babel-helper-fixtures/src/index.ts Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * Improve preset-env typings (#14606) * refactor: move shipped-proposals to ts * preset-env * address review comments * Improve pipeline-operator typings (#14629) * refactor: simplify buildOptimizedSequenceExpression * proposal-pipeline-operator * address review comments * improve standalone typings (#14630) * babel-standalone * address review comment * Improve plugins typings (Part 1) (#14633) * change AssumptionFunction return type * helper-create-regexp-features-plugin * create-class-features-plugin * transform-for-of * improve unicode-escapes typings * transform-object-super * transform-react-constant-elements * proto-to-assign * function-name * flow-comments TS cannot infer Flow visitor type because we have both Flow type and Flow virtual type. * Improve code-frame/hightlight typings (#14643) * code-frame * map js-tokens to Babel 8 * highlight * Improve `@babel/types` typings (#14645) * bump to-fast-properties to v4 * types * mark node comments as mutable * Improve babel-core typings (#14622) Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * improve transform-classes typings (#14624) * Improve `@babel/generator` typings (#14644) * generator * refactor: merge {start,end}Terminatorless to printTerminatorless * inline buildYieldAwait * inline ExportDeclaration * also export Pos * let getPossibleRaw return string | void * Apply suggestions from code review Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> * address review comments * do not export internal printer method * simplify needsWhitespace Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> * Improve plugins typings (Part 2) (#14639) * exponentiation-operator * duplicate-keys * computed-properties * replace-supers * block-scoping * block-scoped-functions * syntax-typescript * record-and-tuple * private-property-in-object * partial-application * json-strings * function-sent * function-bind * class-static-block * async-generator-functions * Update packages/babel-plugin-transform-block-scoping/src/index.ts * address review comments * helper-replace-supers * Improve plugins typings (Part 3) (#14642) * external-helpers * bugfix * transform-parameters * object-rest-spread * destructuring-private * transform-destructuring * proposal-decorators * optional-chaining * helper-wrap-function * explode-assignable-expression * helper-compilation-targets * helper-plugin-utils * helpers * helper-validator-option * fix: allow "+" and "-" in MappedType .readonly/.optional * fixture-test-runner * remove charcodes from dependencies the charcodes transform will inline charCodes.* so we can remove it from dependencies * Improve traverse typings (#14648) * export removeProperties options * traverse * fix other packages typings * fix gatherNodeParts * downgrade to-fast-properties to v3 * fix typo * babel-core/normalize-file * add ignore comment property used by flow plugin * refine getLastStatement typings * fix babel-standalone rebase typing error * fix assert.rejects polyfill * simplify _param typings * supress Babel 7 AST errors * loosen defineType typings The AST typings are generated from defineType calls, so defineType should accept a string as type. * restore legacy code * Suppress data/core-js-compat importing errors Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com>
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.
See #14601 for more info. This PR can be reviewed by commits: each of them deal with a single plugin. It is the last one handling plugin typings.