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

Enhancement: Forbid catch clause with initializer #8182

Closed
4 tasks done
fisker opened this issue Jan 4, 2024 · 0 comments · Fixed by #8183
Closed
4 tasks done

Enhancement: Forbid catch clause with initializer #8182

fisker opened this issue Jan 4, 2024 · 0 comments · Fixed by #8183
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@fisker
Copy link
Contributor

fisker commented Jan 4, 2024

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

typescript-estree

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Expect errors when parsing

try {
}
catch (e = 1) {
}

https://github.com/microsoft/TypeScript/blame/0ea57f6ca19c23e0bc690bd2706f6b6e11a97e02/tests/cases/compiler/catchClauseWithInitializer1.ts#L1

Additional Info

This crashes unicorn/prefer-optional-catch-binding rule. CI log

Prettier should throw instead of ignoring it. Prettier playground

TS playground

@fisker fisker added enhancement New feature or request triage Waiting for maintainers to take a look labels Jan 4, 2024
@bradzacher bradzacher added package: typescript-estree Issues related to @typescript-eslint/typescript-estree accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Jan 4, 2024
@fisker fisker changed the title Enhancement: Forbid catch cause with initializer Enhancement: Forbid catch clause with initializer Jan 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
2 participants