UNPKG

742 BJavaScriptView Raw
1/**
2 * use `factory()` instead of `service()`
3 *
4 * You should prefer the factory() method instead of service()
5 *
6 * @styleguideReference {johnpapa} `y040` Services - Singletons
7 * @version 0.1.0
8 * @category conventions
9 * @sinceAngularVersion 1.x
10 */
11'use strict';
12
13var utils = require('./utils/utils');
14
15module.exports = {
16 meta: {
17 schema: []
18 },
19 create: function(context) {
20 return {
21
22 CallExpression: function(node) {
23 if (utils.isAngularComponent(node) && node.callee.property && node.callee.property.name === 'service') {
24 context.report(node, 'You should prefer the factory() method instead of service()', {});
25 }
26 }
27 };
28 }
29};