Configuring the di rule to array made eslint crash on me. The file is fine (and runs without problems), the error message looks like whatever it assumes to be an injection array is actually undefined. Setup:
angular.module('myapp')
.provider('loadingInterceptor', [
'$httpProvider',
loadingInterceptorProvider
])
function loadingInterceptorProvider($httpProvider) {
var self = this
$httpProvider.interceptors.push('loadingInterceptor')
self.$get = [
'Loading',
$get
]
function $get(Loading) {
function startLoading(config) {
Loading.startLoading()
return config
}
function stopLoading(response) {
Loading.stopLoading()
return response
}
return {
request: startLoading,
requestError: stopLoading,
response: stopLoading,
responseError: stopLoading
}
}
}
error:
$ ./node_modules/.bin/eslint -c ./.eslintrc.json ./scripts/components/loading/loading.interceptor.js
The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at checkDi (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint-plugin-angular/rules/di.js:63:68)
at Object.angular?provider (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint-plugin-angular/rules/di.js:131:17)
at /Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint-plugin-angular/rules/utils/angular-rule.js:234:16
at Array.forEach (native)
at callAngularRules (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint-plugin-angular/rules/utils/angular-rule.js:228:27)
at EventEmitter.callBoth (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint-plugin-angular/rules/utils/angular-rule.js:86:13)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.applySelector (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint/lib/util/node-event-generator.js:265:26)
at NodeEventGenerator.applySelectors (/Users/LionC/Projects/acomodeo/onboarding-webapp/node_modules/eslint/lib/util/node-event-generator.js:294:22)
Configuring the di rule to
array
made eslint crash on me. The file is fine (and runs without problems), the error message looks like whatever it assumes to be an injection array is actuallyundefined
. Setup:Versions:
.eslintrc.json:
the angular file:
error: