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

Removed Flow #2385

Merged
merged 9 commits into from
May 23, 2021
Merged

Removed Flow #2385

merged 9 commits into from
May 23, 2021

Conversation

JoshuaKGoldberg
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg commented May 21, 2021

What:

Removes all Flow tooling from source code.

  • Comments out most type annotations to prepare them for the next step, TypeScript! 🚀 (Add TypeScript tooling and configs #2360).
  • Type annotations that don't add anything, like * and <empty>, are removed altogether.
  • $FlowFixMes are removed ; only one of their comments is kept for not being related to the Flow type checker

Why:

Following the strategy mentioned by @Andarist in #2358 (comment).

How:

I did a find-all for strings such as : and Component<, then continuously ran yarn lint, yarn build, and yarn test until there were no more errors. Also yarn test -u to clean up the auto-generated snapshots.

Checklist:

  • Documentation
  • Tests
  • Code complete
  • Changeset

Question: This also removes the Flow docs page, because Flow types are no longer generated. Is that right for this stage? My guess is that they could be generated from TypeScript types later?

@changeset-bot
Copy link

changeset-bot bot commented May 21, 2021

⚠️ No Changeset found

Latest commit: 2fd71a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 21, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2fd71a9:

Sandbox Source
Emotion Configuration

@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from main to ts-migration May 21, 2021 03:53
@JoshuaKGoldberg JoshuaKGoldberg mentioned this pull request May 21, 2021
22 tasks
@Andarist
Copy link
Member

This also removes the Flow docs page, because Flow types are no longer generated. Is that right for this stage? My guess is that they could be generated from TypeScript types later?

That's a good question - I think we can remove them since atm we target the ts-migration branch anyway. Something should be decided about this later though.

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #2385 (2fd71a9) into ts-migration (3a8eaac) will increase coverage by 0.01%.
The diff coverage is 99.28%.

Impacted Files Coverage Δ
packages/babel-plugin/src/utils/add-import.js 100.00% <ø> (ø)
...ckages/babel-plugin/src/utils/transformer-macro.js 100.00% <ø> (ø)
packages/css/src/index.js 100.00% <ø> (ø)
packages/css/test/instance/emotion-instance.js 100.00% <ø> (ø)
packages/eslint-plugin/src/index.js 100.00% <ø> (ø)
packages/is-prop-valid/src/index.js 83.33% <ø> (ø)
packages/jest/src/enzyme-serializer.js 100.00% <ø> (ø)
packages/primitives/src/index.js 100.00% <ø> (ø)
packages/react/src/index.js 44.44% <ø> (ø)
packages/react/src/utils.js 100.00% <ø> (ø)
... and 62 more

"import/no-duplicates": 0,
"prettier/prettier": [
"error",
{
"parser": "flow"
"parser": "typescript-eslint"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - I would have assumed that javascript/typescript/babel-ts parsers would work here. I understand the difference between them but I don't immediately see why there is a need for Prettier's typescript-eslint to exist in the first place. Is this just about making sure what both use the same baseline of features? So if something can be parsed using typescrip-teslint then it can also be parsed using Prettier? I suspect that otherwise we could end up in a situation with a single file being parseable by one without being parseable by the other one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they're pretty equivalent. For now it's all vanilla JavaScript, which TypeScript supports. I'd think long-term it'd be easier to just have one parser for all of them.

Copy link
Member

@Andarist Andarist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have mentioned that:

$FlowFixMes are removed; only one of their comments is kept for not being related to the Flow type checker

I believe that you are referring to the comment in packages/react/__tests__/theme-provider.js - I can't find a reason why this would be kept. I'm not sure why it's there but after this PR lands, it will be completely obsolete anyway.


Excellent work 🚀 I love how you have left the flow types as comments for now. As soon as this PR gets ✅ we'll be able to merge.

JoshuaKGoldberg and others added 3 commits May 21, 2021 17:59
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Andarist pushed a commit that referenced this pull request May 22, 2021
* Add codecademy.com to "in the wild" list

We use Emotion! And I would like to run builds for #2385 😄

* Update README.md
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review May 23, 2021 10:45
@Andarist Andarist merged commit 1d6cde5 into emotion-js:ts-migration May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants