weixin_39934869
weixin_39934869
2020-12-04 13:05

TypeError: Cannot read property 'kind' of undefined

I'm getting this error:


projectdir/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js:59
            kind: ancestor.kind,
                          ^

TypeError: Cannot read property 'kind' of undefined
    at NoInnerDeclarationsWalker.nearestBody (projectdir/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js:59:27)
    at NoInnerDeclarationsWalker.validateInnerDeclaration (projectdir/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js:43:25)
    at NoInnerDeclarationsWalker.visitVariableStatement (projectdir/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js:38:18)
    at NoInnerDeclarationsWalker.SyntaxWalker.visitNode (projectdir/node_modules/tslint/lib/language/walker/syntaxWalker.js:426:22)
    at projectdir/node_modules/tslint/lib/language/walker/syntaxWalker.js:441:63
    at visitEachNode (projectdir/node_modules/typescript/lib/typescript.js:7252:30)
    at Object.forEachChild (projectdir/node_modules/typescript/lib/typescript.js:7409:24)
    at NoInnerDeclarationsWalker.SyntaxWalker.walkChildren (projectdir/node_modules/tslint/lib/language/walker/syntaxWalker.js:441:12)
    at NoInnerDeclarationsWalker.SyntaxWalker.visitSourceFile (projectdir/node_modules/tslint/lib/language/walker/syntaxWalker.js:181:14)
    at NoInnerDeclarationsWalker.SyntaxWalker.visitNode (projectdir/node_modules/tslint/lib/language/walker/syntaxWalker.js:396:22)

Maybe related to palantir/tslint#832 but I'm not sure since that's supposed to be fixed. Using tslint 3.7.1, tslint-eslint-rules 1.0.1, typescript 1.8.9.

该提问来源于开源项目:buzinas/tslint-eslint-rules

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39717443 weixin_39717443 5月前

    Can you update tslint-eslint-rules to the last version, please?

    Not sure if it will solve the problem, but if it does, better :)

    点赞 评论 复制链接分享
  • weixin_39717443 weixin_39717443 5月前

    Hm, looking at the logic, it seems to be broken indeed. Can you please show me what's the code that is generating this error, please?

    点赞 评论 复制链接分享
  • weixin_39934869 weixin_39934869 5月前

    I can't tell which code this error is generated on: the error occurs before anything is reported.

    Updating to tslint-eslint-rules 1.2.0 fixes this. :smile:

    点赞 评论 复制链接分享
  • weixin_39717443 weixin_39717443 5月前

    Weird.

    But I'm happy that updating it fixed your issue!

    点赞 评论 复制链接分享

相关推荐