eslint-plugin-angular icon indicating copy to clipboard operation
eslint-plugin-angular copied to clipboard

di, di-order and di-unused don't work with modules in variables

Open cleavera opened this issue 9 years ago • 1 comments

The following syntax produces errors as expected:

angular.module('MyModule').controller('MyCtrl', function(Zulu, Alpha, Bravo) {
    Bravo.something();
});

Throws

  • di: use array syntax
  • di-order: injected dependecies should be in alphabetical order
  • di-unused: Zulu and Alpha unused

But the following code passes fine:

(function(ngModule) {
    ngModule.controller('MyCtrl', function(Zulu, Alpha, Bravo) {
        Bravo.something();
    });
})(angular.module('MyModule'));

I would expect both pieces of code to throw the same error.

cleavera avatar May 06 '16 14:05 cleavera

You are right. It should throw errors.

EmmanuelDemey avatar May 07 '16 15:05 EmmanuelDemey