1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 | var utils = require('./utils/utils');
|
13 |
|
14 | module.exports = {
|
15 | meta: {
|
16 | schema: []
|
17 | },
|
18 | create: function(context) {
|
19 | return {
|
20 |
|
21 | MemberExpression: function(node) {
|
22 | if (node.object.type === 'Identifier' && utils.isAngularServiceImport(node.object.name, '$q')) {
|
23 | if (node.property.type === 'Identifier' && node.property.name === 'defer') {
|
24 | context.report(node, 'You should not create a new promise with this syntax. Use the $q(function(resolve, reject) {}) syntax.', {});
|
25 | }
|
26 | }
|
27 | }
|
28 | };
|
29 | }
|
30 | };
|