question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: `curly` rule should optionally ignore unnecessary braces

See original GitHub issue

What version of ESLint are you using? v2.9.0

What parser (default, Babel-ESLint, etc.) are you using? default

I think the curly rule should have an option to relax complaints about unnecessary braces. Many style guides have rules to enforcing the use of curly braces, but few of them enforce the removal of braces. It’s often desirable to allow the programmer to add additional braces at his/her discretion.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:26 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
nzakascommented, May 15, 2016

Here’s what I understand this proposal to be:

  1. The rule should warn when curlies are required but are missing.
  2. The rule should not warn when curlies are present but are not required.

Assuming that’s the correct description of the proposal, please indicate your support by adding a 👍 to this comment.

0reactions
dcleaocommented, Jan 10, 2017

@kaicataldo That’s a great management practice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

curly - ESLint - Pluggable JavaScript Linter
JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be best...
Read more >
When can I omit curly braces in C? - Stack Overflow
The only places you can omit brackets are for the bodies of if-else , for , while , or do-while statements if the...
Read more >
Optional Braces - Scala 3 - EPFL
Generally, the rule is that adding a pair of optional braces will not change the meaning of a well-indented program. These changes can...
Read more >
Control structures should use curly braces - SonarSource Rules
Java static code analysis. Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your JAVA code. All rules 649 ·...
Read more >
coding style - Should curly braces appear on their own line?
@12431234123412341234123: I think he means because some people print the code out for code-review. And each not absolutely necessary newline is paper wasted,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found