False positive S1172 for constructor parameter

Typescript since v3 has a feature to skip assigning constructor parameter to a same named property.
SonarLint (and SonarCloud) treats this like an unused parameter of constructor function.

Code example:

class Test {
  constructor(
    public readonly x: number,
  ) {
    // No body necessary
  }
}

const a = new Test(1);
console.log(a.x); // 1

Will cause “Remove the unused function parameter “x” or rename it to “_x” to make intention explicit.sonarlint(typescript:S1172)”

Hey there.

Please be sure to read this post before raising a thread here:

Edited the post to provide all details according to “How to …”

Any updates on this?

Hi @igoralekseev

I cannot reproduce the issue. What version of SonarLint and which IDE are you using?

Cheers

Hi!
I am using Visual Studio Code 1.68.1 with and SonarLint v3.5.4