EmmanuelDemey / EmmanuelDemey/eslint-plugin-angular

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

Open
#517 0 comments 0 reactions 0 assignees View on GitHub
Bug Hacktoberfest
Dominant language
JavaScript
Stars
620
Forks
127
PR merge metrics
No merged PRs in 30d

Description

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 ()
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 ()
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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.