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

fix(eslint-plugin): [no-unsafe-enum-comparison] exempt bit shift operators #7074

Conversation

Melandra
Copy link
Contributor

@Melandra Melandra commented May 29, 2023

PR Checklist

Overview

Exempts the bit shift operators << and >> from the no-unsafe-enum-comparison rule.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Melandra!

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.

@netlify
Copy link

netlify bot commented May 29, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 1d286cb
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/64b589a54d48fa00085ae7e0
😎 Deploy Preview https://deploy-preview-7074--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@Melandra Melandra changed the title fix(eslint-plugin): Exempt bit shift operators from no-unsafe-enum-comparison fix(eslint-plugin): exempt bit shift operators from no-unsafe-enum-comparison May 29, 2023
@nx-cloud
Copy link

nx-cloud bot commented May 29, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1d286cb. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 35 targets

Sent with 💌 from NxCloud.

@Melandra Melandra marked this pull request as ready for review May 29, 2023 21:35
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.

LGTM, thanks for sending! ✨

Just a couple of non-blocking suggestions - what do you think?

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label May 31, 2023
@@ -66,6 +66,19 @@ export default util.createRule({
'BinaryExpression[operator=/=|<|>/]'(
Copy link
Member

@Josh-Cena Josh-Cena May 31, 2023

Choose a reason for hiding this comment

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

Suggested change
'BinaryExpression[operator=/=|<|>/]'(
'BinaryExpression[operator=/^(<>!)?={0,2}$/]'(

...Much simpler? Otherwise you will also need to remember to deal with >>>.

Copy link
Contributor Author

@Melandra Melandra May 31, 2023

Choose a reason for hiding this comment

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

Thanks for the suggestion, please see 68938c5, I've replaced the regex with ^[<>!=]?={0,2}$ instead to also match ===

@JoshuaKGoldberg
Copy link
Member

@Melandra just checking in, did you mean to re-request our review on this one?

@bradzacher bradzacher added the bug Something isn't working label Jul 17, 2023
@Melandra
Copy link
Contributor Author

@Melandra just checking in, did you mean to re-request our review on this one?

Yes, I didn't know you were expecting me to re-request the review, sorry 😬

@JoshuaKGoldberg JoshuaKGoldberg removed the awaiting response Issues waiting for a reply from the OP or another party label Jul 17, 2023
@JoshuaKGoldberg
Copy link
Member

Ah we've since added guidance in https://typescript-eslint.io/contributing/pull-requests#addressing-feedback-and-beyond - which I think didn't exist when you first sent this. Thanks!

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(eslint-plugin): exempt bit shift operators from no-unsafe-enum-comparison fix(eslint-plugin): [no-unsafe-enum-comparison] exempt bit shift operators Jul 17, 2023
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.

🔥 great, thanks!

Pam from The Office happily saying 'nice'

@JoshuaKGoldberg JoshuaKGoldberg merged commit b3e0e75 into typescript-eslint:main Jul 17, 2023
47 of 48 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: no-unsafe-enum-comparison - False positives with bit shifts
4 participants