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

TypeError: Cannot read property 'name' of undefined in rxjsFinnishRule #45

Closed
zbream opened this issue May 29, 2018 · 0 comments · Fixed by #46
Closed

TypeError: Cannot read property 'name' of undefined in rxjsFinnishRule #45

zbream opened this issue May 29, 2018 · 0 comments · Fixed by #46

Comments

@zbream
Copy link
Contributor

zbream commented May 29, 2018

Hey, I'm liking the package!


However, I've tried out the rules in a couple of projects, and I've consistently run into the following error during linting:

The 'rxjs-finnish' rule threw an error in 'M:/Git/_public/rxjs-finnish-rule-issue/file.ts':
TypeError: Cannot read property 'name' of undefined
    at Walker.validateNode (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\rxjs-tslint-rules\dist\rules\rxjsFinnishRule.js:169:49)
    at Walker.visitPropertyDeclaration (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\rxjs-tslint-rules\dist\rules\rxjsFinnishRule.js:130:18)
    at Walker.SyntaxWalker.visitNode (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:467:22)
    at M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:535:63
    at visitNodes (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\typescript\lib\typescript.js:14006:30)
    at Object.forEachChild (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\typescript\lib\typescript.js:14293:21)
    at Walker.SyntaxWalker.walkChildren (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:535:12)
    at Walker.SyntaxWalker.visitClassDeclaration (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:63:14)
    at Walker.SyntaxWalker.visitNode (M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:314:22)
    at M:\Git\_public\rxjs-finnish-rule-issue\node_modules\tslint\lib\language\walker\syntaxWalker.js:535:63

I've narrowed it down to being caused by the declaration of an optional property (which I use extensively with strictNullChecks enabled):

myOptionalProperty?: Subject<number> = new Subject<number>();


I've set up a minimal test repo for evaluation:

https://github.com/zbream/rxjs-finnish-rule-issue

typescript@2.8.3
tslint@5.10.0
rxjs-tslint-rules@4.3.0

You'll notice that if you comment out myOptionalProperty, everything works as expected. Also, no no-unused-variable in this project.

zbream pushed a commit to zbream/rxjs-tslint-rules that referenced this issue May 30, 2018
zbream added a commit to zbream/rxjs-tslint-rules that referenced this issue May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant