eslint: relax no-return-assign to 'except-parens'
a common pattern to set a ref for a react element is: <div ref={e => this.refName = e} /> But if you are using our eslint rules (currently set to "no-return-assign": ["error", "always”]) it will force you to do: <div ref={e => {this.refName = e}} /> And now, if you are using prettier, it will format that as: <div ref={e => { this.refName = e }} /> That seems needlessly verbose. With this change you can now do: <div ref={e => (this.refName = e)} /> And both eslint and prettier will be ok with that Test plan: * verify functions that return an assignment do what you want in eslint Change-Id: I56abfdb21a7bf3f5b3eae8088f27749f41f2371c Reviewed-on: https://gerrit.instructure.com/131788 Tested-by: Jenkins Reviewed-by: Felix Milea-Ciobanu <fmileaciobanu@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
8069dbba16
commit
2122e6b9bd
|
@ -37,6 +37,7 @@ module.exports = {
|
|||
"no-continue": [0],
|
||||
"no-else-return": [0],
|
||||
"no-plusplus": [0],
|
||||
"no-return-assign": ['error', 'except-parens'],
|
||||
"no-underscore-dangle": [0],
|
||||
"no-unused-vars": [2, { "argsIgnorePattern": "^_"}],
|
||||
"object-curly-spacing": [0],
|
||||
|
|
Loading…
Reference in New Issue