This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 885
fix no-duplicate-super validates with ternary operator #3544
Merged
ajafff
merged 4 commits into
palantir:master
from
mateuszwitkowski:no-duplicate-super-ternary-operator
Dec 5, 2017
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fc47092
fix no-duplicate-super validates with ternary operator
mateuszwitkowski 92a16d3
removes undefined check for whenFalse
mateuszwitkowski 32e30ce
fix 'no-duplicate-super' rule checks nested ternary operators
mateuszwitkowski 8d69134
fix added class names in test cases for 'no-duplicate-super' rule
mateuszwitkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,5 +259,14 @@ declare const n: number; | |
} | ||
} | ||
|
||
// With ternary operator | ||
{ | ||
class { | ||
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. btw. this is not a valid class declaration. Class declarations need a name. 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. I thought about it but that's how it's done in all the other test cases for that rule. I've figured out there's some reason for it and followed it. I'll fix it in all test cases with updated PR. |
||
constructor(props?: any) { | ||
props ? super(props) : super(); | ||
} | ||
} | ||
} | ||
|
||
[0]: Multiple calls to 'super()' found. It must be called only once. | ||
[1]: 'super()' called in a loop. It must be called only once. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whenFalse
can't be undefinedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right of course. I'll fix it. There's another issue though. If someone would use nested ternary operators super() will be called twice:
Do you think such a case should be covered? If so can you give me a tip how to handle it?