Modify rule S107: Do not count TypeScript parameter properties (#2898)
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
This commit is contained in:
parent
9ce1a8de8e
commit
289a124d78
@ -4,17 +4,17 @@ include::../rule.adoc[]
|
|||||||
|
|
||||||
=== Exceptions
|
=== Exceptions
|
||||||
|
|
||||||
The rule ignores constructors where parameters are *all* parameter properties:
|
The rule ignores TypeScript parameter properties when counting parameters:
|
||||||
|
|
||||||
[source,javascript]
|
[source,javascript]
|
||||||
----
|
----
|
||||||
class C {
|
class C {
|
||||||
constructor(
|
constructor(
|
||||||
private param1: number,
|
private param1: number, // ignored
|
||||||
private param2: boolean,
|
param2: boolean, // counted
|
||||||
private param3: string,
|
public param3: string, // ignored
|
||||||
private param4: string[],
|
readonly param4: string[], // ignored
|
||||||
private param5: number | string
|
param5: number | string // counted
|
||||||
) {} // Compliant by exception
|
) {} // Compliant by exception
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
Loading…
x
Reference in New Issue
Block a user