Skip to content

Commit

Permalink
Merge pull request #81 from nlfurniss/fix-jquery-false-positive
Browse files Browse the repository at this point in the history
Remove Ember from isJQueryCaller check
  • Loading branch information
trentmwillis authored Aug 31, 2017
2 parents e677c94 + 0acc6da commit aa40fad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ Burnashov Evgeny <[email protected]>
Chad Hietala <[email protected]>
Chris Thoburn <[email protected]>
David J. Hamilton <[email protected]>
Edilberto Ruvalcaba <[email protected]>
Edilberto Ruvalcaba <[email protected]>
Ilya Radchenko <[email protected]>
Justin Lan <[email protected]>
Katie Gengler <[email protected]>
Kyle Turney <[email protected]>
Marc Lynch <[email protected]>
Marc Lynch <[email protected]>
Mikael Riska <[email protected]>
Nathaniel Furniss <[email protected]>
Quinn C. Hoyer <[email protected]>
Robert Jackson <[email protected]>
Ryunosuke Sato <[email protected]>
Expand Down
3 changes: 1 addition & 2 deletions lib/rules/no-jquery-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ function getMessage(blackListName) {
}

function isJQueryCaller(node, name = null) {
let oName = get(node, 'object.callee.object.name') === 'Ember';
let pName = get(node, 'object.callee.property.name') === '$';
let cName = get(node, 'object.callee.name') === '$';
let lName = get(node, 'object.name') === name;

return oName || pName || cName || lName;
return pName || cName || lName;
}

function getLocalImportName(node, sourceName) {
Expand Down
18 changes: 18 additions & 0 deletions tests/lib/rules/no-jquery-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ ruleTester.run('no-jquery-methods', rule, {
}
});`,
options: [BLACKLISTMETHOD]
},
{
code: `
export default Ember.Component({
init() {
Ember.get().add();
}
});`,
options: [BLACKLISTMETHOD]
},
{
code: `
export default Ember.Component({
init() {
this.$().add();
}
});`,
options: []
}
],
invalid: [
Expand Down

0 comments on commit aa40fad

Please sign in to comment.