
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
``++readonly++`` properties can only be assigned in a class constructor or at the point of declaration. If a class has a property that's not marked ``++readonly++`` but is only set in the constructor, it could cause confusion about the property's intended use. To avoid confusion, such properties should be marked ``++readonly++`` to make their intended use explicit, and to prevent future maintainers from inadvertently changing their use.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
class Person {
|
|
private _birthYear: number; // Noncompliant
|
|
constructor(birthYear: number) {
|
|
this._birthYear = birthYear;
|
|
}
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
class Person {
|
|
private readonly _birthYear: number;
|
|
constructor(birthYear: number) {
|
|
this._birthYear = birthYear;
|
|
}
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|