-
Notifications
You must be signed in to change notification settings - Fork 337
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
Prepare gestalt for eslint 5 via bump to plugins #273
Changes from 3 commits
da64e18
97ebed4
64ba012
6336e59
b39a9e3
5932f01
47483f5
0f0bf30
0bdccd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,13 @@ export default function Button(props: Props) { | |
accessibilityHaspopup, | ||
accessibilityLabel, | ||
color = 'gray', | ||
disabled = false, | ||
inline = false, | ||
disabled, | ||
inline, | ||
name, | ||
onClick, | ||
size = 'md', | ||
size, | ||
text, | ||
type = 'button', | ||
type, | ||
} = props; | ||
|
||
const textColor = { | ||
|
@@ -54,6 +54,7 @@ export default function Button(props: Props) { | |
[styles.block]: !inline, | ||
}); | ||
|
||
/* eslint-disable react/button-has-type */ | ||
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. @pfarejowicz Any idea why we need to disable this even though we set it below? Is it because
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. @christianvuerings exactly! the rule does not like us using the dynamic value
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. Disabling it here seems fine - thanks for clarifying |
||
return ( | ||
<button | ||
aria-expanded={accessibilityExpanded} | ||
|
@@ -76,8 +77,17 @@ export default function Button(props: Props) { | |
</Text> | ||
</button> | ||
); | ||
/* eslint-enable react/button-has-type */ | ||
} | ||
|
||
Button.defaultProps = { | ||
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'm so torn on this one. None of our tools really introspect 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. Agreed - I started off by playing with the typing and defaulting, hoping to fix the |
||
color: 'gray', | ||
disabled: false, | ||
inline: false, | ||
size: 'md', | ||
type: 'button', | ||
}; | ||
|
||
Button.propTypes = { | ||
accessibilityExpanded: PropTypes.bool, | ||
accessibilityHaspopup: PropTypes.bool, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,11 @@ import Flyout from './Flyout.js'; | |
it('Flyout renders', () => { | ||
const wrapper = shallow( | ||
<Flyout | ||
anchor={<button onClick={() => null}> test </button>} | ||
anchor={ | ||
<button onClick={() => null} type="submit"> | ||
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. @pfarejowicz we should probably change this to 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. Will change |
||
test | ||
</button> | ||
} | ||
idealDirection="down" | ||
onDismiss={jest.fn()} | ||
size="sm" | ||
|
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.
wow huh
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.
@chrislloyd same reaction haha, its this rule https://eslint.org/docs/rules/no-else-return which does not like an
else if
clause after areturn