Skip to content

vue/require-valid-default-prop fails to report error on type mismatch #1044

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

Closed
jantajov opened this issue Feb 3, 2020 · 1 comment · Fixed by #1160
Closed

vue/require-valid-default-prop fails to report error on type mismatch #1044

jantajov opened this issue Feb 3, 2020 · 1 comment · Fixed by #1160

Comments

@jantajov
Copy link

jantajov commented Feb 3, 2020

Given following single file Vue.js component:

<template>
  <div>Hello</div>
</template>

<script>
  export default {
    name: 'AppHello',
    props: {
      textProp: {type: String, default: () => 1233}
    }
  }
</script>

I would expect to get vue/require-valid-default-prop error as the prop does not have valid default value. Types does not match.

Howsoever, no such error is thrown during linting.

I am not sure if this is intended. But if it is, at least the docs should be updated.

Versions:

vue/cli-plugin-eslint is ^3.11.0"
eslint is ^5.16.0
node is ^10.16.0
@ota-meshi
Copy link
Member

Thank you for this issue.

Now, the vue/require-valid-default-prop rule does not check what the function returns.
#119 (comment)

I think we need to add a check to vue/require-valid-default-prop rule.

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

Successfully merging a pull request may close this issue.

2 participants