Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
chore: enable no-unreachable-loop#9540
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0d0e90747050cbea884fb74bae9e8bf8fd3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -170,18 +170,15 @@ export default createRule({ | ||
| .getSymbolAtLocation(tsNode)! | ||
| .getDeclarations()!; | ||
| const [{ initializer }] = (declarations[0] as ts.EnumDeclaration) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Love this because this exposes a bug (not sure if it's intentional)! Checking ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Is this truly a bug? Is it possible for a symbol to have multiple declarations, that would be different from each other? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. No; if a symbol returns multiple declarations, that means these sites are merged together and should be treated as one. That's my understanding; I haven't verified it. | ||
| .members; | ||
| return initializer && | ||
| tsutils.isTypeFlagSet( | ||
| typeChecker.getTypeAtLocation(initializer), | ||
| ts.TypeFlags.StringLike, | ||
| ) | ||
| ? AllowedType.String | ||
| : AllowedType.Number; | ||
| } | ||
| // Finally, we default to the type of the first enum member | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -127,6 +127,7 @@ function foo(): Set<number> { | ||
| return [] as any[]; | ||
| } | ||
| `, | ||
| 'const foo: (() => void) | undefined = () => 1;', | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This was brought to light because when I initially refactored the rule to assume that | ||
| ], | ||
| invalid: [ | ||
| { | ||