Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'name' of undefined when using avoid-scope-typos #507

Open
davidmcclelland opened this issue Aug 31, 2017 · 3 comments

Comments

@davidmcclelland
Copy link

Happy to provide any additional info I can to help reproduce, just let me know what you need.

eslint [email protected]
[email protected]

Stacktrace:
Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at check ([snip]\node_modules\eslint-plugin-angular\rules\avoid-scope-typos.js:24:75)
at Linter.Identifier ([snip]\node_modules\eslint-plugin-angular\rules\avoid-scope-typos.js:31:17)
at emitOne (events.js:101:20)
at Linter.emit (events.js:188:7)
at NodeEventGenerator.applySelector ([snip]\node_modules\eslint\lib\util\node-event-generator.js:265:26)
at NodeEventGenerator.applySelectors ([snip]\node_modules\eslint\lib\util\node-event-generator.js:294:22)
at NodeEventGenerator.enterNode ([snip]\node_modules\eslint\lib\util\node-event-generator.js:308:14)
at CodePathAnalyzer.enterNode ([snip]\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:602:23)
at Traverser.enter ([snip]\node_modules\eslint\lib\linter.js:926:36)
at Traverser.__execute ([snip]\node_modules\estraverse\estraverse.js:397:31)
at Traverser.traverse ([snip]\node_modules\estraverse\estraverse.js:501:28)

@EmmanuelDemey
Copy link
Owner

Thanks for the issue. Can you also share the code causing this error ? I will add it to our unit tests.

@davidmcclelland
Copy link
Author

I tried to log the node being entered in linter.js's traverser.traverse, but the output was rather verbose. I can't even figure out which file of mine is causing the exception. According to #508 it happens with the source for jquery 3.1.1 with attachments for it. You may be better off using that to test.

@fungiboletus
Copy link

Got the error with a function broadcast() {} in a factory. Renaming it to broadcast2 or something else fixed the error.

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

No branches or pull requests

3 participants