Rule to enforce consistent spacing after if statement parens when no braces are present
See original GitHub issuePlease describe what the rule should do: Enforce consistent spacing after if statement parens when no braces are present.
What category of rule is this? [ ] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [X] Enforces code style (layout) [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
if (something)doStuff(); // "warns"
if (something) doStuff(); // "correct usage"
Why should this rule be included in ESLint (instead of a plugin)? Because it’s not specific to a framework/runtime, it’s a general JS styling preference.
Are you willing to submit a pull request to implement this rule? I haven’t contributed in ESLint before, and quite unfamiliar with the codebase. I don’t mind trying, though.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (8 by maintainers)
Top Results From Across the Web
object-curly-spacing - ESLint - Pluggable JavaScript Linter
Rule Details This rule enforces consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.
Read more >Is it a bad practice to use an if-statement without curly braces?
If there's an else clause, or if the code I want to execute on true is of significant length, braces all the way:...
Read more >space between parens () and brakets []? · Issue #1303 - GitHub
Basically adding spaces between parens and brackets. Function arguments: So: function foo( one, two, ...
Read more >coding style - Single statement if block - braces or no?
The first is better because the second is error-prone. For example, let's say you are temporarily commenting out code to debug something:
Read more >Optional Braces - Scala 3 - EPFL
In a brace-delimited region, no statement is allowed to start to the left of the first statement after the opening brace that starts...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would be in favor of updating
space-before-blocks
rather than creating a separate rule.@anikethsaha this rule change isn’t accepted yet, let’s see if it will reach the consensus first.