Skip to content

Optionally ignore vue/no-unregistered-components warnings against recursive components #1304

Closed
@arrudaje

Description

@arrudaje

What rule do you want to change?
vue/no-unregistered-components

Does this change cause the rule to produce more or fewer warnings?
fewer warnings

How will the change be implemented? (New option, new default behavior, etc.)?
My idea was to add the argument ignoreRecursive to the rule. If true, it would check the component's name against the name of the component it's inserted into (for this, the parent component needs to have its name property set), and, if they're the same, do not warn.

Please provide some example code that this change will affect:

<template>
    <span>{{ note.text }}</span>
    <Note
        v-for="reply in note.replies"
        :note="reply"
    />
</template>

<script>
    export default {
        name: 'Note',
        props: {
            note: {
                type: Object,
                required: true,
            },
        },
    };
</script>

What does the rule currently do for this code?
It marks the recursive Note component inserted in the template with a warning.

What will the rule do after it's changed?
The warning would not appear in recursive components, as the reference is in the name property, so it is self-registered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions