Unused dependencies should not be injected.
Rule based on Angular 1.x
The following patterns are considered problems;
/*eslint angular/di-unused: 2*/
// invalid
angular.module('myModule').factory('myService', function ($http, $q, $log) {
$http.get('/api/someData').then(function (response) {
$log.log(response.data);
});
}); // error: Unused injected value $q
The following patterns are not considered problems;
/*eslint angular/di-unused: 2*/
// valid
angular.module('myModule').factory('myService', function ($log, anotherService) {
$log.log(anotherService.getSomeData());
});
This rule was introduced in eslint-plugin-angular 0.8.0