Skip to content

Commit aa40fad

Browse files
authored
Merge pull request #81 from nlfurniss/fix-jquery-false-positive
Remove Ember from isJQueryCaller check
2 parents e677c94 + 0acc6da commit aa40fad

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

AUTHORS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ Burnashov Evgeny <[email protected]>
22
Chad Hietala <[email protected]>
33
Chris Thoburn <[email protected]>
44
David J. Hamilton <[email protected]>
5+
Edilberto Ruvalcaba <[email protected]>
56
Edilberto Ruvalcaba <[email protected]>
67
Ilya Radchenko <[email protected]>
78
Justin Lan <[email protected]>
89
Katie Gengler <[email protected]>
910
Kyle Turney <[email protected]>
1011
Marc Lynch <[email protected]>
12+
Marc Lynch <[email protected]>
1113
Mikael Riska <[email protected]>
14+
Nathaniel Furniss <[email protected]>
1215
Quinn C. Hoyer <[email protected]>
1316
Robert Jackson <[email protected]>
1417
Ryunosuke Sato <[email protected]>

lib/rules/no-jquery-methods.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ function getMessage(blackListName) {
1010
}
1111

1212
function isJQueryCaller(node, name = null) {
13-
let oName = get(node, 'object.callee.object.name') === 'Ember';
1413
let pName = get(node, 'object.callee.property.name') === '$';
1514
let cName = get(node, 'object.callee.name') === '$';
1615
let lName = get(node, 'object.name') === name;
1716

18-
return oName || pName || cName || lName;
17+
return pName || cName || lName;
1918
}
2019

2120
function getLocalImportName(node, sourceName) {

tests/lib/rules/no-jquery-methods.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ ruleTester.run('no-jquery-methods', rule, {
5656
}
5757
});`,
5858
options: [BLACKLISTMETHOD]
59+
},
60+
{
61+
code: `
62+
export default Ember.Component({
63+
init() {
64+
Ember.get().add();
65+
}
66+
});`,
67+
options: [BLACKLISTMETHOD]
68+
},
69+
{
70+
code: `
71+
export default Ember.Component({
72+
init() {
73+
this.$().add();
74+
}
75+
});`,
76+
options: []
5977
}
6078
],
6179
invalid: [

0 commit comments

Comments
 (0)