1 | /**
|
2 | * use `$window` instead of `window`
|
3 | *
|
4 | * Instead of the default window object, you should prefer the AngularJS wrapper service $window.
|
5 | *
|
6 | * @styleguideReference {johnpapa} `y180` Angular $ Wrapper Services - $document and $window
|
7 | * @version 0.1.0
|
8 | * @category angularWrapper
|
9 | * @sinceAngularVersion 1.x
|
10 | */
|
11 | ;
|
12 |
|
13 | module.exports = {
|
14 | meta: {
|
15 | schema: []
|
16 | },
|
17 | create: function(context) {
|
18 | var restrict = ['document', 'setInterval', 'setTimeout'];
|
19 | return {
|
20 |
|
21 | MemberExpression: function(node) {
|
22 | if (node.object.name === 'window' && restrict.indexOf(node.property.name) < 0) {
|
23 | context.report(node, 'You should use the $window service instead of the default window object', {});
|
24 | }
|
25 | }
|
26 | };
|
27 | }
|
28 | };
|