Skip to content

Commit ca9f350

Browse files
committed
Issue #124 error with karma controller calls
1 parent fb80618 commit ca9f350

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

rules/ng_controller_name.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ module.exports = function(context) {
1919

2020
var callee = node.callee;
2121
if(callee.type === 'MemberExpression' && callee.property.name === 'controller') {
22+
/**
23+
* Issue #124 for controller() calls inside karma tests
24+
*/
25+
if(node.arguments.length === 0){
26+
return;
27+
}
28+
2229
var name = node.arguments[0].value;
2330

2431
if(name !== undefined && !convertedPrefix.test(name)){

test/ng_controller_name.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ eslintTester.addRuleTest('rules/ng_controller_name', {
2626
}, {
2727
code: 'app.controller("EslintController", function(){});',
2828
args: [1, '/[A-Z].*Controller$/']
29+
}, {
30+
code: 'controller = el.controller();',
31+
args: [1, '/[A-Z].*Controller$/']
2932
}],
3033
invalid: [
3134
{

0 commit comments

Comments
 (0)