1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';
|
10 |
|
11 | module.exports = {
|
12 | meta: {
|
13 | docs: {
|
14 | url: 'https://github.com/Gillespie59/eslint-plugin-angular/blob/master/docs/rules/log.md'
|
15 | },
|
16 | schema: []
|
17 | },
|
18 | create: function(context) {
|
19 | var method = ['log', 'debug', 'error', 'info', 'warn'];
|
20 |
|
21 | return {
|
22 |
|
23 | MemberExpression: function(node) {
|
24 | if (node.object.name === 'console' && method.indexOf(node.property.name) >= 0) {
|
25 | context.report(node, 'You should use the "' + node.property.name + '" method of the AngularJS Service $log instead of the console object');
|
26 | }
|
27 | }
|
28 | };
|
29 | }
|
30 | };
|