no-unnecessary-parameter-property-assignment
Configuration
rslint.config.ts
Rule Details
Disallow unnecessary assignment of constructor property parameter.
TypeScript's parameter property syntax (constructor(public foo: string)) both declares a class member and assigns the constructor argument to it. Writing an explicit this.foo = foo inside the constructor body therefore performs the exact same assignment a second time and adds nothing. This rule reports this.X = X — and the ||=, &&=, ??= variants that have the same effect on a freshly-bound member — when the constructor's parameter list declares a parameter property named X.
Examples of incorrect code for this rule:
Examples of correct code for this rule: