Skip to content

require-prop-types raises an error when a validator is present #713

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
danielsamuels opened this issue Dec 6, 2018 · 2 comments
Closed

Comments

@danielsamuels
Copy link

Tell us about your environment

  • ESLint version: 4.19.1
  • eslint-plugin-vue version: 4.4.0
  • Node version: node v8.9.4, yarn 1.4.1

Please show your full configuration:

{
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module"
  },
  "env": {
    "browser": true,
    "commonjs": true,
    "jquery": true
  },
  "extends": [
    "plugin:vue/recommended",
    "eslint:recommended"
  ]
}

What did you do?

<script>
export default {
    props: {
        deviceId: {
            validator: value => value === null || typeof value === Number,
            required: true,
        }
    },
};
</script>

What did you expect to happen?
According to the documentation it should be possible to define a validator in place of a type and have the rule pass. This is not the case.

What actually happened?

[ESLint: test.vue]

     Error       4,9: Prop "deviceId" should define at least its type. (vue/require-prop-types)

✗ 1 error, 0 warnings

Double-click on lines to jump to location, [F4] for next, [shift-F4] for previous.

[Finished in 1.0s]
@danielsamuels
Copy link
Author

Strangely enough the project does seem to have a test for this case, which must be passing incorrectly?

@danielsamuels
Copy link
Author

Looks like this issue is resolved in later versions as of #476.

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

No branches or pull requests

1 participant