question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vue/require-component-is] and <component v-bind="{is}">.

See original GitHub issue

Tell us about your environment

  • “babel-eslint”: “^8.2.1”,
  • “eslint”: "^4.15.
  • “eslint-config-prettier”: "^2.9.
  • “eslint-friendly-formatter”: "^3.0.
  • “eslint-loader”: "^1.7.
  • “eslint-plugin-vue”: “^4.0.0”,

Please show your full configuration:

extends: ['plugin:vue/strongly-recommended'],
plugins: ['vue'],
rules: {
    'vue/html-indent': ['error', 4],
    'vue/max-attributes-per-line': 'off',
},

What did you do? Please include the actual source code causing the issue.

<template>
    <component v-bind="{props}">
        <slot/>
    </component>
</template>

<script>
export default {
    props: {
        to: {
            type: String,
            required: true,
        },
    },
    computed: {
        props() {
            if (this.to.match(/^(http(s)?|ftp):\/\//)) {
                return {
                    is: 'a',
                    href: this.to,
                    target: '_blank',
                    rel: 'noopener',
                };
            }
            return {
                is: 'router-link',
                to: this.to,
            };
        },
    },
};
</script>




What did you expect to happen? No error, the code is correct, and works.

What actually happened? Please include the actual, raw output from ESLint. 2:5 error Expected '<component>' elements to have 'v-bind:is' attribute vue/require-component-is

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
michalsnikcommented, Apr 19, 2018

This is not a very common scenario. I’d say you should just disable the rule in this one file:

<template>
    <!-- eslint-disable-next-line vue/require-component-is -->
    <component v-bind="{props}">
        <slot/>
    </component>
</template>
3reactions
mathieutucommented, Apr 19, 2018

Yeah, it’s really not important, I’ve opened an issue just to be conscientious, let you know and for history. 😛

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue/require-component-is
Rule Details # ... This rule reports the <component> elements which do not have v-bind:is attributes. ... You can use the same mount...
Read more >
Elements in iteration expect to have 'v-bind:key' directives ...
Tried changing to v-bind:key="suggestion.id" after changing, eslint error is not showing but issue is Autocomplete is not displaying(completely ...
Read more >
An Overview of Vue Dynamic Components - LearnVue
This is the attribute that actually allows dynamic components to work. Essentially, it tells the component element what it is. The v-bind:is or ......
Read more >
Rendering a list of Vue components - Learn web development
Before we do that, there's one other piece of syntax to know about that is used with v-for , the key attribute. To...
Read more >
Composing with Components | Vue GWT - GitHub Pages
In Vue.js, it is possible for a component to specify requirements for the props it is receiving. If a requirement is not met,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found