-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add ESLint rules to mandate braces around if
-else
and switch
-case
#3386
Comments
if
-else
and switch
-case
if
-else
and switch
-case
Hello @dhruvkb ! |
Hey @dhruvkb ! |
@bhavik001 your last PR #3387 was closed by you, do you intend to continue working on this issue and open a new PR? |
Hey @dhruvkb I will gonna create new pull request. |
Hey @dhruvkb ! can you check my pull request. And Let me know if I have to update anything. |
Hey @dhruvkb ! |
Hey @bhavik001 I've reviewed the PR and suggested some changes. It's really great and proceeding in the right direction but it still needs some additional work. Let's continue this discussion regarding the PR there. |
Hey @dhruvkb ! |
Hey |
Problem
Currently it's possible to write one-line
if
-else
statements without braces. It's also possible to writecase
blocks insideswitch
without braces.Description
The lack of braces is easier to read initially but makes it possible to make errors when adding more statements to these constructs or updating code in the future.
Mandating braces with ESLint (with the possibility to autofix can prevent these problems.
Alternatives
Additional context
This scope for improvement to our ESLint config was raised in the review for #3375.
The text was updated successfully, but these errors were encountered: