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

docs: fix no-unnecessary-boolean-literal-compare example #8981

Merged
merged 2 commits into from Apr 29, 2024

Conversation

heitorlisboa
Copy link
Contributor

@heitorlisboa heitorlisboa commented Apr 23, 2024

PR Checklist

Overview

Add missing !( ... ) around comparison cases in example for the allowComparingNullableBooleansToFalse option of the no-unnecessary-boolean-literal-compare docs.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @heitorlisboa!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit f9055c9
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/662c18880feede0008068cb1
😎 Deploy Preview https://deploy-preview-8981--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 5 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@kirkwaiblinger
Copy link
Member

@heitorlisboa

Good eyes! Thanks for sending this.

On the CI failure: There's a gap in our docs right now about how to update the snapshots of the code samples (filed #8997); long story short, would you mind running yarn test -- -u in order to update the snapshots? Thanks!

@@ -101,11 +101,11 @@ Examples of code for this rule with `{ allowComparingNullableBooleansToFalse: fa

```ts option='{ "allowComparingNullableBooleansToFalse": false }'
declare const someUndefinedCondition: boolean | undefined;
if (someUndefinedCondition === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(optional)

Question - is there any reason for these to negate the "Incorrect" code rather than the "Correct" code here? It feels weird to me to have !inputExpression => !outputExpression when inputExpression => outputExpression would be much simpler. (This isn't a loaded question; I just genuinely can't think of a reason. I note that the chart below does it that way, too, which you've probably followed for consistency, but... should we just change it there too?)

Either way, though, your change fixes it from incorrect to correct, following the existing pattern, so it's totally optional if you even want to think about this comment or not! 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I only did it this way for consistency, but I agree that negating the "Incorrect" code makes it harder to understand.

I'm down to update the example and the fixer chart to use simpler expressions. Should I go ahead with it? If you're cool with it, I'll update the snapshots (as you mentioned in your previous comment) once I've made the changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, go for it! 🚀🚀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! 😄

@kirkwaiblinger kirkwaiblinger added the awaiting response Issues waiting for a reply from the OP or another party label Apr 26, 2024
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Thanks for doing this, and congrats on your first time contributing to typescript-eslint! ❤️

Marking as 1 approval, and I expect it will get merged in as soon as another team member is able to look at it!

cute dog

@kirkwaiblinger kirkwaiblinger added 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready and removed awaiting response Issues waiting for a reply from the OP or another party labels Apr 27, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 +1, thanks!

@JoshuaKGoldberg JoshuaKGoldberg merged commit 6e1241b into typescript-eslint:main Apr 29, 2024
61 of 62 checks passed
@heitorlisboa heitorlisboa deleted the patch-1 branch April 30, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: wrong example in no-unnecessary-boolean-literal-compare
3 participants