Skip to content

timeout service fail on jasmine.getGlobal().setTimeout #472

@yosiat

Description

@yosiat

Hi,

I have in my code jasmine.getGlobal().setTimeout = .. and I found out that the plugin crashes on this line -

Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
    at EventEmitter.MemberExpression (/Users/yosi/code/bringg-web/node_modules/eslint-plugin-angular/rules/timeout-service.js:38:38)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:191:7)
    at NodeEventGenerator.applySelector (/Users/yosi/code/bringg-web/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/yosi/code/bringg-web/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (/Users/yosi/code/bringg-web/node_modules/eslint/lib/util/node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (/Users/yosi/code/bringg-web/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:602:23)
    at CommentEventGenerator.enterNode (/Users/yosi/code/bringg-web/node_modules/eslint/lib/util/comment-event-generator.js:98:23)
    at Traverser.enter (/Users/yosi/code/bringg-web/node_modules/eslint/lib/eslint.js:929:36)
    at Traverser.__execute (/Users/yosi/code/bringg-web/node_modules/estraverse/estraverse.js:397:31)

I am using version 1.6.3, and the failing line is -
https://github.com/Gillespie59/eslint-plugin-angular/blob/1.6.3/rules/timeout-service.js#L38

I can submit a fix that checks if there is parentNode.object before checking it's type.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions