Skip to content

Rule proposal: return-yield #1024

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

Closed
ark120202 opened this issue Sep 30, 2019 · 3 comments
Closed

Rule proposal: return-yield #1024

ark120202 opened this issue Sep 30, 2019 · 3 comments
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on

Comments

@ark120202
Copy link

return yield* iterator() is very similar to return await promise - it gives better stack trace in V8 and can be catched. I think it makes sense for it to have the same options as return-await (ref #994).

@ark120202 ark120202 added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Sep 30, 2019
@bradzacher bradzacher added enhancement: new plugin rule New rule request for eslint-plugin and removed triage Waiting for team members to take a look labels Sep 30, 2019
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@Josh-Cena
Copy link
Member

Josh-Cena commented Oct 2, 2023

Promises returned from async functions are automatically unwrapped, so return promise and return await promise are semantically equivalent, which necessitates this consistency argument. OTOH return iterable and return yield* iterable are not semantically equivalent because the former does not iterate iterable at all. @typescript-eslint/triage-team does this still seem fitting as a lint rule? If so, what should it report against and advise for?

@bradzacher
Copy link
Member

you're not wrong, I think.

additionally this has received 0 reactions since its creation also suggests it's something of low value to the community.

seems like good signal that we should not implement this.

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
@bradzacher bradzacher added wontfix This will not be worked on and removed accepting prs Go ahead, send a pull request that resolves this issue labels Oct 5, 2023
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 6, 2023

so return promise and return await promise are semantically equivalent

Nit: return await promise can be caught by try/catch; return promise is flattened and therefore not.

But otherwise yeah the lack of interest here votes to me to close. 👍

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants