From 3d33cde395c424e41f05014e8a7f9c90f830d260 Mon Sep 17 00:00:00 2001 From: Emmanuel DEMEY Date: Sun, 19 Mar 2017 09:23:09 +0100 Subject: [PATCH 1/2] Issue #442 DI validation error for a function without parameters --- rules/di.js | 2 +- test/di.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/di.js b/rules/di.js index b68c86a8..6a7ab580 100644 --- a/rules/di.js +++ b/rules/di.js @@ -107,7 +107,7 @@ module.exports = { return; } } - } else { + } else if (fn.params.length > 0) { report(fn); } } else if (fn.params && fn.params.length !== 0) { diff --git a/test/di.js b/test/di.js index 6bd77cd4..737ebb18 100644 --- a/test/di.js +++ b/test/di.js @@ -38,6 +38,9 @@ angularObjectList.forEach(function(object) { }, { code: 'angular.module("myModule").' + object + '(myFunction);function MyFunction() {}', options: ['function'] + }, { + code: 'angular.module("myModule").' + object + '(myFunction);function myFunction() {}', + options: ['$inject'] }, { code: 'angular.module("myModule").' + object + '(myFunction);myFunction.$inject=[];function myFunction() {}', options: ['$inject'] From 64fabf053b418938bfb7b1c12509779651fe03a5 Mon Sep 17 00:00:00 2001 From: Emmanuel DEMEY Date: Sun, 19 Mar 2017 09:23:22 +0100 Subject: [PATCH 2/2] Update to 1.6.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac882ea1..8c426853 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-angular", - "version": "1.6.3", + "version": "1.6.4", "description": "ESLint rules for AngularJS projects", "main": "index.js", "scripts": {