Skip to content

feat(lint): implement useExhaustiveSwitchCases - typescript-eslint/switch-exhaustiveness-check #5762

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

siketyan
Copy link
Member

@siketyan siketyan commented Apr 24, 2025

Summary

Initial implementation of a new rule useExhaustiveSwitchCases, which is an equivalent to typescript-eslint/switch-exhaustiveness-check. I left adding options for future improvement.

Test Plan

Added snapshot tests.

@siketyan siketyan self-assigned this Apr 24, 2025
@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis labels Apr 24, 2025
@ematipico
Copy link
Member

I'm thrilled!!!! 🤩

Copy link

codspeed-hq bot commented Apr 24, 2025

CodSpeed Performance Report

Merging #5762 will not alter performance

Comparing siketyan:feat/use-exhaustive-switch-cases (8aae07e) with main (4874007)

Summary

✅ 95 untouched benchmarks

@siketyan siketyan force-pushed the feat/use-exhaustive-switch-cases branch from b22c4e1 to 7a486b1 Compare April 26, 2025 06:57
@siketyan siketyan force-pushed the feat/use-exhaustive-switch-cases branch from 7a486b1 to d16049a Compare April 26, 2025 07:58
@siketyan siketyan requested review from a team April 26, 2025 07:59
@siketyan siketyan marked this pull request as ready for review April 26, 2025 07:59
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Looks good. We need to add the second pillar to the diagnostic messages

@siketyan
Copy link
Member Author

I am going to merge this after #5777, which will change some part that this rule relies on.

@github-actions github-actions bot added the A-CLI Area: CLI label Apr 26, 2025
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

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

Love it, and well done with the solid test cases!

Thanks for waiting for the refactor too 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 Implement useExhaustiveSwitchCases - typescript-eslint/switch-exhaustiveness-check
4 participants