UNPKG

705 BJavaScriptView Raw
1/**
2 * disallow use of controllers (according to the component first pattern)
3 *
4 * According to the Component-First pattern, we should avoid the use of AngularJS controller.
5 *
6 * @version 0.9.0
7 * @category bestPractice
8 * @sinceAngularVersion 1.x
9 */
10'use strict';
11
12var utils = require('./utils/utils');
13
14module.exports = {
15 meta: {
16 schema: []
17 },
18 create: function(context) {
19 return {
20
21 CallExpression: function(node) {
22 if (utils.isAngularControllerDeclaration(node)) {
23 context.report(node, 'Based on the Component-First Pattern, you should avoid the use of controllers', {});
24 }
25 }
26 };
27 }
28};