forked from EmmanuelDemey/eslint-plugin-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.js
More file actions
26 lines (22 loc) · 779 Bytes
/
Copy pathlog.js
File metadata and controls
26 lines (22 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* use the `$log` service instead of the `console` methods
*
* You should use $log service instead of console for the methods 'log', 'debug', 'error', 'info', 'warn'
* @version 0.1.0
* @category angularWrapper
* @sinceAngularVersion 1.x
*/
'use strict';
module.exports = function(context) {
var method = ['log', 'debug', 'error', 'info', 'warn'];
return {
MemberExpression: function(node) {
if (node.object.name === 'console' && method.indexOf(node.property.name) >= 0) {
context.report(node, 'You should use the "' + node.property.name + '" method of the AngularJS Service $log instead of the console object');
}
}
};
};
module.exports.schema = [
// JSON Schema for rule options goes here
];