1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | 'use strict';
|
13 |
|
14 | var utils = require('./utils/utils');
|
15 |
|
16 | module.exports = {
|
17 | meta: {
|
18 | schema: []
|
19 | },
|
20 | create: function(context) {
|
21 | return {
|
22 |
|
23 | VariableDeclaration: function(node) {
|
24 | var variableDeclarator = node.declarations[0];
|
25 | var rightExpression;
|
26 |
|
27 | if (variableDeclarator.init) {
|
28 | rightExpression = variableDeclarator.init;
|
29 |
|
30 | if (rightExpression.arguments && utils.isAngularModuleDeclaration(rightExpression)) {
|
31 | context.report(rightExpression, 'Declare modules without a variable using the setter syntax.');
|
32 | }
|
33 | }
|
34 | },
|
35 | AssignmentExpression: function(node) {
|
36 | if (node.right.arguments && utils.isAngularModuleDeclaration(node.right)) {
|
37 | context.report(node.right, 'Declare modules without a variable using the setter syntax.');
|
38 | }
|
39 | }
|
40 | };
|
41 | }
|
42 | };
|