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

fix(eslint-plugin): [no-unsafe-return] allow returning anything if explicitly returning any #7708

Merged

Conversation

Josh-Cena
Copy link
Member

@Josh-Cena Josh-Cena commented Oct 1, 2023

PR Checklist

Overview

I'm not sure if we should handle the following case: const x: () => any = () => [] as any[];

Overall the docs does not make it clear which cases are exempted, so I guess we have some room for interpretation.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Josh-Cena!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@Josh-Cena Josh-Cena changed the title fix(eslint-plugin): [no-unsafe-return] allow returning anything if ex… fix(eslint-plugin): [no-unsafe-return] allow returning anything if explicitly returning any Oct 1, 2023
@netlify
Copy link

netlify bot commented Oct 1, 2023

Deploy Preview for typescript-eslint failed.

Name Link
🔨 Latest commit e677bb7
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65202deaf368190008ee5522

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changes Oct 6, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

👍 very reasonable!

function foo(): any {
return [] as any[];
}
`,
Copy link
Member

Choose a reason for hiding this comment

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

[Testing] Could you add a test for unknown too?

some room for interpretation.

Yeah I think this is fine as-is for now. If folks really give solid use-cases for the more complex ones we can always look into adding more complexity.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Oct 6, 2023
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

🚀

@JoshuaKGoldberg JoshuaKGoldberg merged commit c6124b2 into typescript-eslint:main Oct 19, 2023
42 of 47 checks passed
@Josh-Cena Josh-Cena deleted the no-unsafe-return-explicit-any branch October 19, 2023 07:13
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-unsafe-return] does not allow return any[] when function is typed as any
2 participants