Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

55 lines
1.1 KiB
Plaintext

== Why is this an issue?
Object literal syntax, which initializes an object's properties inside the object declaration is cleaner and clearer than the alternative: creating an empty object, and then giving it properties one by one.
An issue is raised when the following pattern is met:
* An empty object is created.
* A consecutive single-line statement adds a property to the created object.
=== Noncompliant code example
[source,javascript]
----
let person = {}; // Noncompliant
person.firstName = "John";
person.middleInitial = "Q";
person.lastName = "Public";
----
=== Compliant solution
[source,javascript]
----
let person = {
firstName: "John",
middleInitial: "Q",
lastName: "Public",
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Declare one or more properties of this object inside of the object literal syntax instead of using separate statements.
'''
== Comments And Links
(visible only on this page)
=== on 12 Nov 2015, 18:20:41 Linda Martin wrote:
\[~elena.vilchik] Same here, not sure of the value.
endif::env-github,rspecator-view[]