EmmanuelDemey/eslint-plugin-angular

[directive-restrict] Finding ancestor functions assumes that all functions have names

joelchoo opened this issue · 0 comments

Crashes when finding ancestor functions if ancestor function does not have a name.

Can reproduce by linting the following file:

export default function () {
  return {
    restrict: 'E',
  }
}

Error message and stack trace are:

Cannot read property 'name' of null
TypeError: Cannot read property 'name' of null
    at ./node_modules/eslint-plugin-angular/rules/directive-restrict.js:62:50
    at Array.some (<anonymous>)
    at checkLiteralNode (./node_modules/eslint-plugin-angular/rules/directive-restrict.js:59:40)
    at Property (./node_modules/eslint-plugin-angular/rules/directive-restrict.js:143:17)
    at listeners.(anonymous function).forEach.listener (./node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (./node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (./node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (./node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (./node_modules/eslint/lib/util/node-event-generator.js:299:14)