-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Repro Code
enum Foo {
Bar,
}
const myBitShift = 1 << Foo.Bar
This gives the following error:
The two values in this comparison do not have a shared enum type.
The error message says that we are doing a "comparison", but this is false. We are not doing a comparison at all, we are doing a bit shift.
Thus, I propose that the <<
operator and the >>
operator are exempt from being examined by this rule, and I assume that this was just an oversight when the rule was originally implemented. (Well, I was actually the person to originally implement it, but I guess this behavior got lost in translation somewhere.)
Playground
ESLint Config
I am using the recommend configs, i.e.:
extends: [
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts
"plugin:@typescript-eslint/recommended",
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts
"plugin:@typescript-eslint/strict",
],
tylerlaprade
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin