forked from EmmanuelDemey/eslint-plugin-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeach.js
More file actions
24 lines (22 loc) · 691 Bytes
/
Copy pathforeach.js
File metadata and controls
24 lines (22 loc) · 691 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
/**
* use `angular.forEach` instead of native `Array.prototype.forEach`
*
* You should use the angular.forEach method instead of the default JavaScript implementation [].forEach.
*
* @version 0.1.0
* @category angularWrapper
* @sinceAngularVersion 1.x
*/
'use strict';
module.exports = function(context) {
return {
MemberExpression: function(node) {
if (node.object.type === 'Identifier' && node.object.name !== 'angular' && node.property.name === 'forEach') {
context.report(node, 'You should use the angular.forEach method', {});
}
}
};
};
module.exports.schema = [
// JSON Schema for rule options goes here
];