Skip to content

Commit 8e5ee9f

Browse files
committed
Issue #137 False positives when using .run() method
1 parent 4d5cd8d commit 8e5ee9f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-angular",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "ESLint rules for AngularJS projects",
55
"main": "index.js",
66
"repository": {

rules/utils/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
},
104104

105105
isAngularRunSection: function(node){
106-
return this.isMemberExpression(node.callee) && node.callee.property.type === 'Identifier' && node.callee.property.name === 'run';
106+
return this.isMemberExpression(node.callee) && node.callee.property.type === 'Identifier' && node.callee.property.name === 'run' && (node.callee.object.type === 'Identifier' && node.callee.object.name !== 'mocha');
107107
},
108108

109109
isAngularConfigSection: function(node){

test/ng_di.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ valid.push({
8686
}, {
8787
code: 'vm.navRoutes = states.filter(x).sort(y);',
8888
args: [1, 'array']
89+
}, {
90+
code: 'mocha.run();',
91+
args: [1, 'array']
8992
})
9093
//------------------------------------------------------------------------------
9194
// Tests

test/ng_module_getter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ eslintTester.addRuleTest('rules/ng_module_getter', {
3333
'angular.module("mwl.calendar").controller("MwlElementDimensionsCtrl", function($element, $scope, $parse, $attrs) {}).directive("mwlElementDimensions", function() {});',
3434
'describe("suite test", function(){})',
3535
'it("test", function(){})',
36-
'$provide.value("accountsService", accountsService)'
36+
'$provide.value("accountsService", accountsService)',
37+
'mocha.run();',
3738
],
3839
invalid: [{
3940
code: 'var app = angular.module("test", []);app.controller("TestCtrl", [function () {}]);',

0 commit comments

Comments
 (0)