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

TS migration #2555

Merged
merged 47 commits into from
May 17, 2024
Merged

TS migration #2555

merged 47 commits into from
May 17, 2024

Conversation

emmatown
Copy link
Member

Just wanted a PR open to more easily see the progress of this

Josh Goldberg and others added 18 commits May 23, 2021 16:52
* Removed Flow

* Update packages/jest/src/utils.js

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

* Update packages/react/src/theming.js

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

* Update site/src/utils/markdown-styles.js

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

* Fix markdown-styles.js

* Title.js

* One more formatting, and a FlowFixMe removal

* Updated a few snapshots, and yarn.lock

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
# Conflicts:
#	.prettierrc.yaml
#	flow-typed/npm/jest-glamor-react_vx.x.x.js
#	flow-typed/npm/jest_v25.x.x.js
#	packages/babel-plugin/src/emotion-macro.js
#	packages/babel-plugin/src/index.js
#	packages/css/src/create-instance.js
#	packages/jest/src/create-serializer.js
#	packages/react/src/class-names.js
#	packages/react/src/context.js
#	packages/react/src/global.js
#	packages/react/src/jsx.js
#	packages/serialize/src/index.js
#	packages/server/src/create-instance/construct-style-tags-from-chunks.js
#	packages/server/src/create-instance/extract-critical-to-chunks.js
#	packages/server/src/create-instance/index.js
#	packages/server/src/create-instance/inline.js
#	packages/server/src/create-instance/stream.js
#	packages/styled/src/base.js
#	packages/weak-memoize/src/index.js
#	test/testSetup.js
* Add typescript-eslint and base tsconfig.json

* Create/move tsconfig.json files and extend from root

* Add "site" and "test" to root tsconfig include

* Add @babel/preset-typescript

* Add tsconfig.json for site

* Add "playgrounds" to root tsconfig include

* Add typescript-eslint as eslint plugin

* Remove standard

* Add eslint files override for ts,tsx

* Add eslint import and react plugins

* Remove eslint-plugin-import and related rules

* Add extend for @typescript-extend/eslint-recommended

* Restore **/types/tsconfig.json files

* Remove typescript-eslint resolutions

* Move parserOptions to ts overrides

* Enable skipDefaultLibCheck

* Exclude types tests from root tsconfig

* Add tsconfig content for jsx-pragmatic

* Update eslint prettier parser and add auto-fixes

* Remove per-package tsconfig.json files
* [memoize] Migrate to TypeScript

* Add changeset

* Move tsconfig.json for types tests back

* Fix dtslint setup in @emotion/memoize

* Add TS files to Jest transform setting

* Update .changeset/hip-moons-play.md

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [weak-memoize] Convert to TypeScript

* Add changeset

* tweak a bunch of stuff

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [unitless] Convert to TypeScript

* Add changeset

* tweak some minor things

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [is-prop-valid] Convert to TypeScript

* Add changeset

* tweak some minor things

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [sheet] Convert to TypeScript

* Add changeset

* Make _insertTag private

* tweak some minor things

* add more type tests for constructing StyleSheet

* add changeset

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* feat(ts-utils): Initial migration of utils

* Small tweaks

* More small tweaks

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
…migration

Conflicts:
	packages/cache/__tests__/index.js
	packages/jest/src/matchers.js
	packages/react/src/context.js
	packages/react/src/global.js
	packages/react/src/index.js
	packages/react/src/theming.js
	packages/sheet/__tests__/index.js
	packages/sheet/src/index.ts
	packages/sheet/types/index.d.ts
…migration

Conflicts:
	packages/jest/src/create-enzyme-serializer.js
	packages/jest/src/create-serializer.js
	packages/jest/src/utils.js
	packages/react/src/class-names.js
	packages/react/src/emotion-element.js
	scripts/benchmarks/src/impl.js
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 19, 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.

@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2021

🦋 Changeset detected

Latest commit: 1effaf9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@emotion/unitless Minor
@emotion/css Minor
@emotion/serialize Minor
@emotion/memoize Minor
@emotion/is-prop-valid Minor
@emotion/weak-memoize Minor
@emotion/eslint-plugin Minor
@emotion/primitives-core Minor
@emotion/utils Minor
@emotion/hash Patch
@emotion/sheet Minor
@emotion/babel-plugin-jsx-pragmatic Minor
@emotion/react Minor
@emotion/babel-plugin Minor
@emotion/cache Minor
@emotion/css-prettifier Patch
@emotion/babel-preset-css-prop Minor

Not sure what this means? Click here to learn what changesets are.

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

@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Attention: Patch coverage is 98.25243% with 9 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@73f6881). Click here to learn what that means.

❗ Current head 993557d differs from pull request most recent head 1effaf9. Consider uploading reports for the commit 1effaf9 to get more accurate results

Additional details and impacted files
Files Coverage Δ
babel.config.js 95.45% <ø> (ø)
packages/babel-plugin/src/core-macro.js 98.14% <100.00%> (ø)
packages/babel-plugin/src/emotion-macro.js 71.42% <100.00%> (ø)
packages/babel-plugin/src/index.js 94.49% <100.00%> (ø)
packages/babel-plugin/src/utils/add-import.js 100.00% <ø> (ø)
...kages/babel-plugin/src/utils/get-styled-options.js 90.90% <100.00%> (ø)
...es/babel-plugin/src/utils/get-target-class-name.js 100.00% <100.00%> (ø)
packages/babel-plugin/src/utils/label.js 92.78% <100.00%> (ø)
packages/babel-plugin/src/utils/minify.js 98.80% <100.00%> (ø)
...ackages/babel-plugin/src/utils/object-to-string.js 91.66% <100.00%> (ø)
... and 72 more

@Andarist
Copy link
Member

I see that you have done a little bit more than just checking out the progress 😉 Could we move those changes to a separate PR that would target this? That way we could review this more easily but we could also create a changeset that would point to that other PR (I feel like we should merge this PR at the end, instead of squashing everything into a single commit).

@Andarist
Copy link
Member

We might be currently blocked on the dtslint update, see here. I also mention in that comment that we might have to require at least TS 3.8 after this migration. It doesn't feel ideal but this version has been released 2 years ago - since TS doesn't follow semver I feel like it's OK for us to introduce such a requirement in a minor version too (it's not like we'd change the requirement to 4.4 or smth)

@danilofuchs
Copy link
Contributor

I agree TS 3.8 seems like a safe choice. TS rarely introduces breaking changes, so users of older versions might be able to upgrade easily.

TS does allow emitting multiple type declarations, each for a specific version, but I'm not sure it's viable.

@Andarist
Copy link
Member

TS does allow emitting multiple type declarations, each for a specific version, but I'm not sure it's viable.

I'm not sure if emitting for specific versions is supported. The only thing that I'm aware of is package.json#typesVersion but that is only intended as a hint for the consumer - so they can load typedefs targeting their matching TS version. AFAIK such different typedefs must have to be written, mostly, by hand

G-Rath and others added 22 commits March 18, 2022 22:52
* feat(babel-plugin-jsx-pragmatic): add changeset

* feat(babel-plugin-jsx-pragmatic): convert to typescript

* fix(babel-plugin-jsx-pragmatic): update babel core types

* Update .changeset/wet-boxes-raise.md

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* Migrate `babel-tester` to TypeScript

* update yarn.lock
* feat(eslint-plugin): add standard utils & dependencies for typescript

* feat(eslint-plugin): convert `no-vanilla` to typescript

* feat(eslint-plugin): convert `styled-import` to typescript

* feat(eslint-plugin): convert `import-from-emotion` to typescript

* feat(eslint-plugin): convert `syntax-preference` to typescript

* feat(eslint-plugin): convert `pkg-renaming` to typescript

* feat(eslint-plugin): convert `jsx-import` to typescript

* feat(eslint-plugin): move index to typescript

* feat(eslint-plugin): add changeset

* fix(eslint-plugin): use `require` to get package version

* fix(eslint-plugin): adjust rule description

Co-authored-by: Sam Magura <srmagura@gmail.com>

* fix(eslint-plugin): use `REPO_URL` constant everywhere

* chore(eslint-plugin): add change sets for other bugs

* nit

* Tweak changeset

* Report empty css attribute as invalid in syntax-preference rule

* Tweak changesets

Co-authored-by: Sam Magura <srmagura@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* Point to package root rather than src so that the declarations are used when published, not the src

* Don't use as const for unitless

* Make tsc pass

* Add tsc to CI

* Remove type aware linting

* Remove ESLint from DTSLint CI job

* Newline

* Fix more things

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [serialize]: Convert to Typescript

* fix: Some tests

* chore: Revert unrelated change

* chore: Revert code behaviour changes

* chore: Revert toString method addition

* chore: Changeset

* fix: Add missing return of ComponentSelector

* fix: Export missing interfaces

* small tweaks

* fix stuff

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Merge `main` into `ts-migration`
* Put TS hacks in @emotion/eslint-plugin to make Preconstruct not error

* Fixed the declaration emit for `@emotion/eslint-plugin` without casts

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Merge `main` into `ts-migration`
* Fix dtslint issues

* Update @emotion/server tsconfig comment about DOM types

* Remove redundant declarations

* Fixed dtslint in `@emotion/cache`

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
* [wip] primitives-core TS migration

* Finish converting primitives-core to TS

* Update yarn.lock?

* Implement @Andarist's feedback for primitives-core TS migration

* Fix regression
Merge `main` into `ts-migration` (August 8th)
* Make tsc succeed for site

* Change tsc-all to tsc:all

* Update package.json

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
# Conflicts:
#	docs/docs.yaml
#	packages/babel-plugin/src/index.js
#	packages/cache/src/index.js
#	packages/css/package.json
#	packages/css/src/create-instance.d.ts
#	packages/primitives-core/package.json
#	packages/react/__tests__/warnings.js
#	packages/react/src/global.js
#	packages/react/src/jsx-dev-runtime.js
#	packages/react/src/jsx-runtime.js
#	packages/react/src/jsx.js
#	packages/serialize/types/index.d.ts
#	packages/styled/package.json
#	yarn.lock
@Andarist Andarist marked this pull request as ready for review May 16, 2024 07:34
@emmatown emmatown merged commit fc74bee into main May 17, 2024
19 checks passed
@emmatown emmatown deleted the ts-migration branch May 17, 2024 18:43
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.

None yet

8 participants