49 lines
798 B
Plaintext
49 lines
798 B
Plaintext
This rule checks that all string literals use the same kind of quotes.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
Using the parameter default (forcing single quotes):
|
|
|
|
[source,javascript]
|
|
----
|
|
var firstParameter = "something"; // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,javascript]
|
|
----
|
|
var firstParameter = 'something';
|
|
----
|
|
|
|
|
|
== Exceptions
|
|
|
|
Strings that contain quotes are ignored.
|
|
|
|
[source,javascript]
|
|
----
|
|
let heSaid = "Then he said 'What?'." // ignored
|
|
let sheSaid = '"Whatever!" she replied.' // ignored
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::parameters.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|