Skip to content

Commit

Permalink
Merge pull request #46 from blond/issue-37
Browse files Browse the repository at this point in the history
Added `no-extra-bind` rule
  • Loading branch information
blond committed Apr 22, 2017
2 parents 0b58684 + 1db4060 commit 926a611
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/bad/typos.js
Expand Up @@ -44,11 +44,16 @@ var foo = bar // This entry is equivalent to `var foo = bar(1 || 2).toSt

/*eslint no-unsafe-negation: "error"*/
if (!key in object) {
// operator precedence makes it equivalent to (!key) in object
// and type conversion makes it equivalent to (key ? "false" : "true") in object
// Operator precedence makes it equivalent to (!key) in object
// and type conversion makes it equivalent to (key ? "false" : "true") in object.
}

if (!obj instanceof Ctor) {
// operator precedence makes it equivalent to (!obj) instanceof Ctor
// Operator precedence makes it equivalent to (!obj) instanceof Ctor
// and it equivalent to always false since boolean values are not objects.
}

/*eslint no-extra-bind: "error"*/
var x = function () {
return 'bla';
}.bind(bar); // useless bind, can be safely removed
1 change: 1 addition & 0 deletions lib/common-rules.js
Expand Up @@ -16,6 +16,7 @@ module.exports = {
'no-unexpected-multiline': 'error',
'no-cond-assign': ['error', 'except-parens'],
'no-unsafe-negation': 'error',
'no-extra-bind': 'error',

// Overwrite
'no-ex-assign': 'error',
Expand Down

0 comments on commit 926a611

Please sign in to comment.