We have a paid subscription with SonarCloud and since we adopted typescript 3.7.2, we get false positives with error being: Non-empty statements should change control flow or have at least one side-effect
The code that’s reported as buggy is this
x?.somefunction("abc") where somefunction property has the following type (aaa: string) => void
So if the function is defined, it should be called, which is exactly what the ?. does.
I guess that you will find something like this in the logs:
WARN: You are using version of TypeScript 3.7.2 which is not officially supported; supported versions >=3.2.1 <3.6.0
The false positive you are facing is a typical consequence of using more recent version, the analysis will probably goes though, but rules may not behave correctly in the presence of new ts features (in this case: optional chaining introduced in ts 3.7).
For the specific case you are reporting, I agree that it looks like a false positive, and in fact it looks like this issue who is already fixed. (typescript-eslint is a dependency used by our plugin).
All in all, this false positive should disappear once we upgrade our dependencies and officially support TS 3.7, it will probably be the case for the next release.
Hi Quentin, I see that there is no movement on the github issues. Is there any way in sonarcloud configuration to turn off this check, for this use case? We basically get failing builds every week for no good reason.