UNPKG

793 BJavaScriptView Raw
1/**
2 * use the `$log` service instead of the `console` methods
3 *
4 * You should use $log service instead of console for the methods 'log', 'debug', 'error', 'info', 'warn'
5 * @version 0.1.0
6 * @category angularWrapper
7 * @sinceAngularVersion 1.x
8 */
9'use strict';
10
11module.exports = {
12 meta: {
13 schema: []
14 },
15 create: function(context) {
16 var method = ['log', 'debug', 'error', 'info', 'warn'];
17
18 return {
19
20 MemberExpression: function(node) {
21 if (node.object.name === 'console' && method.indexOf(node.property.name) >= 0) {
22 context.report(node, 'You should use the "' + node.property.name + '" method of the AngularJS Service $log instead of the console object');
23 }
24 }
25 };
26 }
27};