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

New rule: no bitwise operators on non integers #1042

Closed
tom-sherman opened this issue Jan 12, 2018 · 3 comments

Comments

@tom-sherman
Copy link

commented Jan 12, 2018

I came across an error in my code where I typed 'string' | b instead of 'string' || b.

These bitwise operators only make sense on integers and a rule to catch this would have saved me a bit of time!

What are thoughts around a rule that disallows any string or object literal symbols in these scenarios?

@LinusU

This comment has been minimized.

Copy link
Member

commented Jan 12, 2018

Sounds very good!

@stale

This comment has been minimized.

Copy link

commented May 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added stale and removed stale labels May 10, 2018

@feross feross added the enhancement label May 20, 2018

@feross

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

Reposting the comment I wrote on the PR for this issue:

@tom-sherman I appreciate the idea behind this PR, but I don't think we should disallow bitwise operators when used with numbers or in the case that @LinusU mentioned:

fs.access(path.join(TMP, name), fs.R_OK | fs.W_OK, function (err) {

If you can add an exception to ESLint that scopes this rule sufficiently down to the cases we actually want to target, then I'm happy to consider this change! In the meantime, I'm going to close this issue since we can't enable this rule without an upstream change from ESLint. Please post a comment here and I will re-open this issue, once there's an issue or PR filed with ESLint.

@feross feross added the blocked label Aug 12, 2019

@feross feross closed this Aug 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.