eslint-plugin-angular icon indicating copy to clipboard operation
eslint-plugin-angular copied to clipboard

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

Open davidmcclelland opened this issue 8 years ago • 3 comments

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)

davidmcclelland avatar Aug 31 '17 03:08 davidmcclelland

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

EmmanuelDemey avatar Aug 31 '17 05:08 EmmanuelDemey

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.

davidmcclelland avatar Aug 31 '17 13:08 davidmcclelland

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

fungiboletus avatar Jun 25 '18 09:06 fungiboletus