UNPKG

797 BJavaScriptView Raw
1/**
2 * use `angular.forEach` instead of native `Array.prototype.forEach`
3 *
4 * You should use the angular.forEach method instead of the default JavaScript implementation [].forEach.
5 *
6 * @version 0.1.0
7 * @category angularWrapper
8 * @sinceAngularVersion 1.x
9 */
10'use strict';
11
12module.exports = {
13 meta: {
14 docs: {
15 url: 'https://github.com/Gillespie59/eslint-plugin-angular/blob/master/docs/rules/foreach.md'
16 },
17 schema: []
18 },
19 create: function(context) {
20 return {
21 MemberExpression: function(node) {
22 if (node.object.name !== 'angular' && node.property.name === 'forEach') {
23 context.report(node, 'You should use the angular.forEach method', {});
24 }
25 }
26 };
27 }
28};