Skip to content

Commit 38b3319

Browse files
committed
AC-391: Static test to cover "deprecated" jQuery methods
- Fixed trim jquery check
1 parent 53d688e commit 38b3319

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

eslint/rules/jquery-no-trim.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module.exports = {
2222
create: function (context) {
2323
'use strict';
2424

25+
var utils = require('./utils.js');
26+
2527
return {
2628
/**
2729
* Checks if trim method is used and reports it.
@@ -31,14 +33,14 @@ module.exports = {
3133
CallExpression: function (node) {
3234
if (node.callee.type !== 'MemberExpression') {return;}
3335

34-
if (node.callee.object.name !== '$') {return;}
35-
3636
if (node.callee.property.name !== 'trim') {return;}
3737

38-
context.report({
39-
node: node,
40-
messageId: 'trim'
41-
});
38+
if (utils.isjQuery(node)) {
39+
context.report({
40+
node: node,
41+
messageId: 'trim'
42+
});
43+
}
4244
}
4345
};
4446
}

0 commit comments

Comments
 (0)