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

no-unused-components crashes on dynamic components #789

Closed
armano2 opened this issue Jan 30, 2019 · 1 comment
Closed

no-unused-components crashes on dynamic components #789

armano2 opened this issue Jan 30, 2019 · 1 comment
Labels

Comments

@armano2
Copy link
Collaborator

armano2 commented Jan 30, 2019

Tell us about your environment

  • ESLint version: 5.9.0
  • eslint-plugin-vue version: ^5.0.0
  • Node version: 8.12.0

What did you do?

<template>
<component :is=""></component>
</template>

What did you expect to happen?
eslint should not crash

What actually happened?

TypeError: Cannot read property 'type' of null
    at EventEmitter.VAttribute[directive=true][key.name='bind'][key.argument='is']

node.value.expression may be null/undefined

@armano2 armano2 added the bug label Jan 30, 2019
@armano2
Copy link
Collaborator Author

armano2 commented Jan 31, 2019

solution:

https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-unused-components.js#L59

- if (node.value.type !== 'VExpressionContainer') return
+ if (node.value.type !== 'VExpressionContainer' || !node.value.expression) return

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

No branches or pull requests

1 participant