Skip to content

Consider enabling strict-boolean-expressions? #71

Open
@justinhelmer

Description

@justinhelmer

I saw your comment and the corresponding discussion thread about this rule.

Well, it seems like it is ready to go! We get tremendous value by enabling it with the following config:

'@typescript-eslint/strict-boolean-expressions': [
    'error',
    {
      allowString: false,
      allowNumber: false,
      allowNullableObject: false,
    },
  ],

I know you have a TODO comment to reconsider enabling it in 2023 - just want to call out that I think we are there!


OK so here is the bad news: the auto-fixing conflicts with other enabled rules (eqeqeq, no-eq-null). I think all three of those rules are super valuable, and I opened a discussion to hopefully bottom out and align on the triple equals / undefined preference. But that might be a good reason not to enable this rule for now - there is no good way to auto-fix.

FWIW we will still be enabling it in our repository, and then be forced to go manually fix all the places that auto-fix themselves to != null to instead be !== undefined (or !== null where appropriate).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions