all files / eslint-plugin-angular/rules/ no-service-method.js

100% Statements 5/5
100% Branches 5/5
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                        23×     27×          
/**
 * use `factory()` instead of `service()`
 *
 * You should prefer the factory() method instead of service()
 *
 * @styleguideReference {johnpapa} `y040` Services - Singletons
 * @version 0.1.0
 * @category conventions
 */
'use strict';
 
var utils = require('./utils/utils');
 
module.exports = function(context) {
    return {
 
        CallExpression: function(node) {
            if (utils.isAngularComponent(node) && node.callee.property && node.callee.property.name === 'service') {
                context.report(node, 'You should prefer the factory() method instead of service()', {});
            }
        }
    };
};