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

Support TypeScript 5.2 using / await using declaration #15321

Merged
merged 16 commits into from Aug 29, 2023

Conversation

sosukesuzuki
Copy link
Member

@sosukesuzuki sosukesuzuki commented Aug 29, 2023

Description

Fixes #15004

  • Update dependencies
  • Update and fix snapshots

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki
Copy link
Member Author

I'll release new patch after this is merged.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

File name.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

File name. Missing "a"

invalid
   ^

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This should be valid, I think it's from babel too.

Copy link
Sponsor Member

@fisker fisker Aug 29, 2023

Choose a reason for hiding this comment

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

I believe these two from existing tests? They should be still named "valid".

Better put them back, just let typescript parser to throw.

Comment on lines +33 to +35
"valid-for-using-declaration.js",
"valid-await-using-comments.js",
"valid-for-lhs-await-as-identifier.js",
"using-declarations.js",
Copy link
Member Author

Choose a reason for hiding this comment

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

typescript-estree throws for these files (tsc doesn't throw).

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

We can ignore edge cases.

Copy link
Sponsor Member

@fisker fisker left a comment

Choose a reason for hiding this comment

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

Good job.

@fisker
Copy link
Sponsor Member

fisker commented Aug 29, 2023

Size Change: +20.6 kB (0%)

Total Size: 8.5 MB

Filename Size Change
./dist/plugins/typescript.js 1.15 MB +10.3 kB (+1%)
./dist/plugins/typescript.mjs 1.15 MB +10.3 kB (+1%)

If it's possible, you can run

yarn build --file=plugins/typescript.mjs --no-minify

To compare the file with main branch see why the file size grows, and try to remove unnessary code.
But it's not that important.

@sosukesuzuki
Copy link
Member Author

@fisker Sure! I'll merge this PR after CI is passed. And I'll try to do reduce bundle size before release.

@fisker
Copy link
Sponsor Member

fisker commented Aug 29, 2023

If you want do it, in my experience, I suggest you do it before merge, it's easier to switch between branches. Just a quick check is enough, maybe obvious unless code can be found, not necessary to dig deep.

@sosukesuzuki
Copy link
Member Author

I tried a little, but it was difficult, so I gave up once! sorry!

@sosukesuzuki sosukesuzuki merged commit 1ce97d1 into prettier:main Aug 29, 2023
31 checks passed
@fisker
Copy link
Sponsor Member

fisker commented Aug 29, 2023

I compared the files, there is noting we can do, we are good.

medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 15, 2024
…15321)

* Update `@typescript-eslint` packages

* Install `typescript`

* Tweaks snapshot tests

* Tweaks error files

* Add tests for `using` with types

* Add changelog

* Update misc tests

* Update snapshots

* Revert misc tests and remove `typescript`

* Update changelog_unreleased/typescript/15321.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>

* Fix file name typo

* Keep valid file

* Update tests

* Update changelog_unreleased/typescript/15321.md

Co-authored-by: fisker Cheung <lionkay@gmail.com>

* Remove non-existing filenames.

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
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.

Support TypeScript 5.2
2 participants