-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add an option to allow retun value of bindActionCreators call #57
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
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. you can add https://npmjs.com/eccheck to CI to verify this, so it doesn't deviate 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. Sorry, link above triggers 404 for me, is it some private package? 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. oops sorry, https://www.npmjs.com/package/eclint :-) specifically, 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. That's quite a nice package, have not been aware of this, thanks! |
||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,3 +93,95 @@ ruleTester.run('mapDispatchToProps-returns-object', rule, { | |
], | ||
}], | ||
}); | ||
|
||
ruleTester.run('mapDispatchToProps-returns-object-allowReturnBindFn', rule, { | ||
valid: [ | ||
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. Thank you so much for this. Would you please add some more negative cases. |
||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `function mapDispatchToProps(dispatch) { | ||
return bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
); | ||
}`, | ||
}, | ||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `const mapDispatchToProps = (dispatch) => { | ||
return bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
); | ||
}`, | ||
}, | ||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `const mapDispatchToProps = (dispatch) => | ||
bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
); | ||
`, | ||
}, | ||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `export default connect( | ||
state => ({ | ||
productsList: state.Products.productsList, | ||
}), | ||
function (dispatch) { | ||
return bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
) | ||
} | ||
)(Products);`, | ||
}, | ||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `export default connect( | ||
state => ({ | ||
productsList: state.Products.productsList, | ||
}), | ||
(dispatch) => { | ||
return bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
) | ||
} | ||
)(Products);`, | ||
}, | ||
{ | ||
options: [{ allowReturnBindFn: true }], | ||
code: `export default connect( | ||
state => ({ | ||
productsList: state.Products.productsList, | ||
}), | ||
(dispatch) => | ||
bindActionCreators( | ||
{ | ||
requestFilteredItems, | ||
showAlert: showAlertAction, | ||
}, | ||
dispatch | ||
) | ||
)(Products);`, | ||
}, | ||
], | ||
invalid: [], | ||
}); |
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.
❤️❤️❤️ Thank you!!!