53 lines
1009 B
Plaintext
Raw Normal View History

== Why is this an issue?
:noncompliant: javascript/noncompliant.adoc
2020-06-30 12:48:39 +02:00
:compliant: javascript/compliant.adoc
2020-06-30 12:48:39 +02:00
include::../description.adoc[]
2020-06-30 12:48:39 +02:00
=== Exceptions
This rule does not apply in JSX expressions to support conditional rendering and conditional attributes.
[source,javascript]
----
return (
<>
{isLoading ? (
<Loader active />
) : (
<Panel label={isEditing ? 'Open' : 'Not open'}>
<a>{isEditing ? 'Close now' : 'Start now'}</a>
<Checkbox onClick={!saving ? setSaving(saving => !saving) : null} />
</Panel>
)}
</>
);
----
== Resources
=== Articles & blog posts
* Sonar - https://www.sonarsource.com/blog/stop-nesting-ternaries-javascript/[Stop nesting ternaries in JavaScript]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]