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

avoid-scope-typos, module-getter, module-setter are buggy #508

Open
ghost opened this issue Aug 31, 2017 · 1 comment
Open

avoid-scope-typos, module-getter, module-setter are buggy #508

ghost opened this issue Aug 31, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 31, 2017

I enabled this (and all other rules) and tested the plugin with jquery3.1.1.
jquery-3.1.1.js.zip

for avoid-scope-typos i get:
Cannot read property 'name' of undefined TypeError: Cannot read property 'name' of undefined at check (XXX\node_modules\eslint-plugin-angular\rules\avoid-scope-typos.js:24:75) at Linter.Identifier (XXX\linter\node_modules\eslint-plugin-angular\rules\avoid-scope-typos.js:31:17) at emitOne (events.js:82:20) at Linter.emit (events.js:169:7) at NodeEventGenerator.applySelector (XXX\node_modules\eslint\lib\util\node-event-generator.js:265:26) at NodeEventGenerator.applySelectors (XXX\node_modules\eslint\lib\util\node-event-generator.js:294:22) at NodeEventGenerator.enterNode (XXX\node_modules\eslint\lib\util\node-event-generator.js:308:14) at CodePathAnalyzer.enterNode (XXX\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:60 2:23) at Traverser.enter (XXX\node_modules\eslint\lib\linter.js:925:36) at Traverser.__execute (XXX\node_modules\eslint\node_modules\estraverse\estraverse.js:397:31) at Traverser.traverse (XXX\node_modules\eslint\node_modules\estraverse\estraverse.js:501:28)

The other both rules i cannot check again at the moment due to the typos-rules-error, but i had similar problems with it.

@atdrago
Copy link

atdrago commented Sep 10, 2017

I get the same error:

Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
    at check (XXX/node_modules/eslint-plugin-angular/rules/avoid-scope-typos.js:24:75)
    at EventEmitter.Identifier (XXX/node_modules/eslint-plugin-angular/rules/avoid-scope-typos.js:31:17)
    at emitOne (events.js:120:20)
    at EventEmitter.emit (events.js:210:7)
    at NodeEventGenerator.applySelector (XXX/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (XXX/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (XXX/node_modules/eslint/lib/util/node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (XXX/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:606:23)
    at Traverser.enter (XXX/node_modules/eslint/lib/linter.js:1035:32)
    at Traverser.__execute (XXX/node_modules/estraverse/estraverse.js:397:31)
    at Traverser.traverse (XXX/node_modules/estraverse/estraverse.js:501:28)

I put a try/catch around the conditional block starting on line 24:

if (bad.indexOf(name) >= 0 && scope.indexOf(node.parent.object.name) >= 0)

And logged node to find the problematic node. I see node.name but no node.parent.object.name

Node {
  type: 'Identifier',
  start: 1096,
  end: 1101,
  loc: 
   SourceLocation {
     start: Position { line: 35, column: 4 },
     end: Position { line: 35, column: 9 } },
  range: [ 1096, 1101 ],
  name: 'watch',
  parent: 
   Node {
     type: 'Property',
     start: 1096,
     end: 1248,
     loc: SourceLocation { start: [Object], end: [Object] },
     range: [ 1096, 1248 ],
     method: false,
     shorthand: false,
     computed: false,
     key: [Circular],
     value: 
      Node {
        type: 'ObjectExpression',
        start: 1103,
        end: 1248,
        loc: [Object],
        range: [Array],
        properties: [Array] },
     kind: 'init',
     parent: 
      Node {
        type: 'ObjectExpression',
        start: 929,
        end: 5616,
        loc: [Object],
        range: [Array],
        properties: [Array],
        parent: [Object] } } }

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

2 participants