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

chore: require default case in switch statements #607

Merged
merged 2 commits into from
May 7, 2024

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented May 6, 2024

This enables ESLint's default-case and default-case-last rules to ensure that all switch statements end with a default.

There was one spot where we weren't doing this, which I fixed.

This enables ESLint's [`default-case`][0] and [`default-case-last`][1]
rules to ensure that all `switch` statements end with a `default`.

There was one spot where we weren't doing this, which I fixed.

[0]: https://eslint.org/docs/rules/default-case
[1]: https://eslint.org/docs/rules/default-case-last
@EvanHahn EvanHahn requested a review from achou11 May 7, 2024 13:50
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

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

how does this play with TS? Isn't there a config option that could conflict with this?

@EvanHahn
Copy link
Contributor Author

EvanHahn commented May 7, 2024

I don't think so (not 100% sure). The only thing I could find was the TypeScript noFallthroughCasesInSwitch option, which wouldn't be worsened by this.

@EvanHahn EvanHahn merged commit bcf1de1 into main May 7, 2024
4 checks passed
@EvanHahn EvanHahn deleted the require-default-in-switch branch May 7, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants