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

Update typescript-eslint v8 #16557

Merged
merged 6 commits into from
Jun 19, 2024

Conversation

liuxingbaoyu
Copy link
Member

Q                       A
Fixed Issues? Closes #15547
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented Jun 5, 2024

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57171

@liuxingbaoyu
Copy link
Member Author

I can't reproduce this error locally, which is weird.

@nicolo-ribaudo
Copy link
Member

I also cannot reproduce the failure locally 🤔

@JoshuaKGoldberg I couldn't find the typescript-eslint v8 changelog -- Should @typescript-eslint/prefer-promise-reject-errors error or not when passing an any value to Promise.reject?

@@ -10,7 +10,7 @@ import type { FileResult, InputOptions } from "@babel/core";
export function chmod(src: string, dest: string): void {
try {
fs.chmodSync(dest, fs.statSync(src).mode);
} catch (err) {
} catch (_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Question] Is there a reason not to:

Suggested change
} catch (_) {
} catch {

...since you're transpiling from TypeScript anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

We only enabled the typescript plugin to avoid accidental auto-transformations increasing the output size. :)

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Jun 6, 2024

I couldn't find the typescript-eslint v8 changelog

Ah, we haven't set one up yet. For now the typescript-eslint 8.0.0 milestone is roughly that.

Though, note that @typescript-eslint/prefer-promise-reject-errors isn't specific to v8. It was added in typescript-eslint@6.19.0.

Should @typescript-eslint/prefer-promise-reject-errors error or not when passing an any value to Promise.reject?

That's a good question. I haven't found any discussion on what to do with anys on the typescript-eslint issue tracker (prefer-promise-reject-errors in:title search). The rule is only a half year old (typescript-eslint/typescript-eslint#7687 -> typescript-eslint/typescript-eslint#8011 so it's not too surprising that this edge case isn't something that's been discussed yet.

If you think the rule shouldn't report on anys (by default, and/or with an option), that would be an interesting issue to file on us. We'd have to think about it. 🤔

@liuxingbaoyu
Copy link
Member Author

Maybe we can try it again after merging #16536.

@nicolo-ribaudo
Copy link
Member

@liuxingbaoyu TS 5.5 PR merged, can you try rebasing? :)

@liuxingbaoyu
Copy link
Member Author

Of course!
Luckily I was able to reproduce it locally!

This reverts commit b1a1c89.
@@ -96,7 +96,7 @@ function AsyncFromSyncIterator<T, TReturn = any, TNext = undefined>(s: any) {
},
throw: function (maybeError?: any) {
var thr = this.s.return;
if (thr === undefined) return Promise.reject(maybeError);
if (thr === undefined) return Promise.reject(maybeError as Error);
Copy link
Member

Choose a reason for hiding this comment

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

Given that maybeError here could be also something that is not an error, I would prefer to use an eslint-disable-next-line comment rather than a "wrong" cast.

@nicolo-ribaudo nicolo-ribaudo merged commit c36fa6a into babel:main Jun 19, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants