1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';
|
10 |
|
11 | module.exports = {
|
12 | meta: {
|
13 | schema: []
|
14 | },
|
15 | create: function(context) {
|
16 | return {
|
17 |
|
18 | MemberExpression: function(node) {
|
19 | if (node.object.name === 'angular' && node.property.name === 'element') {
|
20 | if (node.parent !== undefined && node.parent.parent !== undefined &&
|
21 | node.parent.parent.type === 'CallExpression' &&
|
22 | node.parent.parent.callee.type === 'Identifier' &&
|
23 | (node.parent.parent.callee.name === 'jQuery' || node.parent.parent.callee.name === '$')) {
|
24 | context.report(node, 'angular.element returns already a jQLite element. No need to wrap with the jQuery object', {});
|
25 | }
|
26 | }
|
27 | }
|
28 | };
|
29 | }
|
30 | };
|