
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.
80 lines
1.5 KiB
Plaintext
80 lines
1.5 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Grouping all the shorthand declarations together in an object makes the declaration as a whole more readable. This rule accepts shorthand declarations grouped at either the beginning or end of an object.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
let obj1 = {
|
|
foo,
|
|
a: 1,
|
|
color, // Noncompliant
|
|
b: 2,
|
|
judyGarland // Noncompliant
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
let obj1 = {
|
|
foo,
|
|
color,
|
|
judyGarland,
|
|
a: 1,
|
|
b: 2
|
|
}
|
|
----
|
|
or
|
|
|
|
[source,javascript]
|
|
----
|
|
let obj1 = {
|
|
a: 1,
|
|
b: 2,
|
|
foo,
|
|
color,
|
|
judyGarland
|
|
}
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Group all shorthand properties at the [beginning|end] of this object declaration
|
|
* Group all shorthand properties at either the beginning or end of this object declaration. (When no pattern/preference is evident)
|
|
|
|
|
|
=== Highlighting
|
|
|
|
* primary: First line of declaration
|
|
* Secondary: mis-placed property
|
|
** message:
|
|
*** Move to the beginning.
|
|
*** Move to the end.
|
|
*** Group at beginning or end.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 19 Jan 2016, 18:16:54 Elena Vilchik wrote:
|
|
\[~ann.campbell.2] I think we should have one issue per object literal (we might use secondary locations for wrongly-located properties). Message could be "Group shorthand properties at the beginning or end of this object declaration".
|
|
|
|
=== on 20 Jan 2016, 10:43:31 Ann Campbell wrote:
|
|
okay [~elena.vilchik]
|
|
|
|
endif::env-github,rspecator-view[]
|