Skip to content

[strict-boolean-expressions] Add ignore-rhs option #755

@glen-84

Description

@glen-84

Repro

{
  "rules": {
    "@typescript-eslint/strict-boolean-expressions": "error"
  }
}
// OR
function valueOrDefault(a?: string) {
    return a || "the default";
}

// AND
const condition = true;
condition && valueOrDefault();

Expected Result

No error (with an option or options).

Actual Result

Error: Unexpected non-boolean in conditional. (twice)

Additional Info

TSLint has an ignore-rhs option (see documentation).

It might make sense to also consider this issue.

#698 would also be required (at least for the first example).

Other links:

Versions

package version
@typescript-eslint/eslint-plugin 1.13.0
@typescript-eslint/parser 1.13.0
TypeScript 3.4.5
ESLint 6.1.0
node 10.16.0
npm 6.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions