Open waynzh opened 2 weeks ago
- since this will result in fewer errors, should we still consider adding an option to control this?
I think it would make sense to add a new checkMultiRootNodes
option (false
by default).
- multi root could also be a group of
v-if
/v-else
/v-else
nodes. Should we consider treating it as a "single" root?
How does Vue itself behave here?
add a new
checkMultiRootNodes
option (false
by default).
When checkMultiRootNodes
is set to true
, this rule will ignore the multi root nodes error. Perhaps we could consider renaming it to something like ignoreMultiRootNodes
?
How does Vue itself behave here?
Vue treats a group of v-if / v-else-if/v-else as a single node. I've added an isConditionalGroup
function to do that.
When
checkMultiRootNodes
is set totrue
, this rule will ignore the multi root nodes error. Perhaps we could consider renaming it to something likeignoreMultiRootNodes
?
Sorry, my suggestion was not clear enough. I'd say the rule should stop reporting errors for components with multiple root nodes by default. But the old behavior should still be available (for users who want to explicitly define the behavior for multi-root components) via an option. Is checkMultiRootNodes
a good name for that? Do you have a better suggestion?
the rule should stop reporting errors for components with multiple root nodes by default
Then the name and setting the default to false
make sense to me. I've updated the test cases and docs.
resolve #2596.
v-if
/v-else
/v-else
nodes. Should we consider treating it as a "single" root?