
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.
58 lines
1.3 KiB
Plaintext
58 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
When using the Backbone.js framework, the names of model attributes should not contain spaces. This is because the Events object accepts space-delimited lists of events, so an attributes with spaces in the names could be misinterpreted.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
Person = Backbone.Model.extend({
|
|
defaults: {
|
|
'first name': 'Bob', // Noncompliant
|
|
'birth date': new Date() // Noncompliant
|
|
},
|
|
});
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
Person = Backbone.Model.extend({
|
|
defaults: {
|
|
firstName: 'Bob',
|
|
birthDate: new Date()
|
|
},
|
|
});
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Rename this property to remove the spaces.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 2 Feb 2015, 18:00:46 Ann Campbell wrote:
|
|
\[~linda.martin] & [~stas.vilchik], I'm assigning this rule to Stas to make sure I correctly interpreted his request & didn't muff the code samples. After that, it goes to you Linda.
|
|
|
|
=== on 4 Feb 2015, 09:39:40 Stas Vilchik wrote:
|
|
Checked.
|
|
|
|
=== on 1 Nov 2019, 16:29:36 Elena Vilchik wrote:
|
|
See \https://github.com/SonarSource/SonarJS/issues/1698
|
|
|
|
endif::env-github,rspecator-view[]
|