Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider enabling strict-boolean-expressions? #71

Open
justinhelmer opened this issue Dec 6, 2022 · 1 comment
Open

Consider enabling strict-boolean-expressions? #71

justinhelmer opened this issue Dec 6, 2022 · 1 comment

Comments

@justinhelmer
Copy link

justinhelmer commented Dec 6, 2022

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).

@sindresorhus
Copy link
Member

I think it's a good idea to enable this rule, but the auto-fix thing is kind of a deal breaker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants