Skip to content

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

Description

@joelchoo

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions