Skip to content

Commit acb6be2

Browse files
return early
1 parent 2bc5596 commit acb6be2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/rules/v-if-else-key.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ const casing = require('../utils/casing')
3535
* @returns {boolean} True if there are sibling nodes of the same type and conditionally rendered, false otherwise.
3636
*/
3737
const hasConditionalRenderedSiblings = (node, componentName) => {
38-
if (node.parent && node.parent.type === 'VElement') {
39-
return node.parent.children.some(
40-
(sibling) =>
41-
sibling !== node &&
42-
sibling.type === 'VElement' &&
43-
sibling.rawName === componentName &&
44-
hasConditionalDirective(sibling)
45-
)
38+
if (!node.parent || node.parent.type !== 'VElement') {
39+
return false
4640
}
47-
48-
return false
41+
return node.parent.children.some(
42+
(sibling) =>
43+
sibling !== node &&
44+
sibling.type === 'VElement' &&
45+
sibling.rawName === componentName &&
46+
hasConditionalDirective(sibling)
47+
)
4948
}
5049

5150
/**

0 commit comments

Comments
 (0)