Tslint: strict-boolean-expressions ignore-rhs not working

Created on 19 Mar 2019  路  4Comments  路  Source: palantir/tslint

Feature request

Is your feature request related to a problem? Please describe.
My code

private _log(message: string, data?: object): void {
        ...
    const dataToLog = data || {};
        ...
}

// tslint.json:
...
"strict-boolean-expressions": [ true, "allow-undefined-union", "allow-null-union", "allow-boolean-or-undefined", "ignore-rhs"  ],
...

Expected
No error

Actual

This type is not allowed in the operand for the '||' operator because it is always truthy. Allowed types are boolean, null-union, undefined-union, or boolean-or-undefined.

Describe the solution you'd like
No error

Additional context

  • Using tslint 5.10, tslint.msbuild 1.3, microsoft.typescript.msbuild 3
  • strict set to true in tsconfig.json
Question

Most helpful comment

Hi @madelson! :wave:

You need to update the library to use the ignore-rhs option since it was released in the version 5.13.0.

All 4 comments

Hi @madelson! :wave:

You need to update the library to use the ignore-rhs option since it was released in the version 5.13.0.

@arthurdenner I am using the NuGet package version 5.10 which appears to be the latest available. Is there a plan to release 5.13 on NuGet?

I don't know this NuGet project, but you can open an issue about update the dependency or maybe send a PR to them.

@arthurdenner my bad! Didn't realize that the NuGet release was completely disconnected!

Was this page helpful?
0 / 5 - 0 ratings