ignore indent when ternary operator are used
See original GitHub issuewhat rule to use when I want indent to be working but it comes to ternary operators I would like to switch off, or even better use 2 spaces or none. Exmp:
amount !== undefined && rate !== undefined
? rateAmount(num, rate)
: '0';
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"Do nothing" using ternary operator - java - Stack Overflow
The ternary operator is usually used to immediately assign a value. String a = bar() ? foo() : null;. For your usecase, you...
Read more >Ternary operators are the worst..unless you indent them right!
So I ignore both rules for readability and simplicity of code. I don't use ternaries much, but if I want to use them...
Read more >multiline-ternary - ESLint - Pluggable JavaScript Linter
This rule enforces or disallows newlines between operands of a ternary expression. Note: The location of the operators is not enforced by this...
Read more >Java static code analysis: The ternary operator should not be ...
While the ternary operator is pleasingly compact, its use can make code more difficult to read. It should therefore be avoided in favor...
Read more >Making decisions in your code — conditionals - MDN Web Docs
Comparison operators are used to test the conditions inside our conditional statements. We first looked at comparison operators back in our ...
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 FreeTop 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
Top GitHub Comments
That would be an enhancement request.
indent
is a stylistic rule and according to our new policy, no enhancement for stylistic rules are being acceptedWhat I understood from the description is that you want both of the code snipped
to work without any errors right ?
If so, use
{ "ignoredNodes": ["ConditionalExpression"] }
options. in order to ignore all the conditional operators.