File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
packages/eslint-config-airbnb/rules Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -817,6 +817,19 @@ Other Style Guides
817817 });
818818 ` ` `
819819
820+ - [8.5](#8.5) <a name='8.5'></a> Avoid confusing arrow function syntax (` => ` ) with comparison operators (` <= ` , ` >= ` ). eslint: [no-confusing-arrow](http://eslint.org/docs/rules/no-confusing-arrow)
821+
822+ ` ` ` js
823+ // bad
824+ const isActive = item => item .height > 256 ? true : false ;
825+
826+ // bad
827+ const isActive = (item ) => item .height > 256 ? true : false ;
828+
829+ // good
830+ const isActive = item => { return item .height > 256 ? true : false ; }
831+ ` ` `
832+
820833**[⬆ back to top](#table-of-contents)**
821834
822835
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ module.exports = {
2828 'generator-star-spacing' : 0 ,
2929 // disallow modifying variables of class declarations
3030 'no-class-assign' : 0 ,
31+ // disallow arrow functions where they could be confused with comparisons
32+ // http://eslint.org/docs/rules/no-confusing-arrow
33+ 'no-confusing-arrow' : 2 ,
3134 // disallow modifying variables that are declared using const
3235 'no-const-assign' : 2 ,
3336 // disallow specific imports
You can’t perform that action at this time.
0 commit comments