Skip to content

Commit 62dd04c

Browse files
committed
Apply sugestions from code review
1 parent ffffa70 commit 62dd04c

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

lib/rules/require-render-return.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ function create (context) {
2020
utils.executeOnVue(context, obj => {
2121
const node = obj.properties.find(item => item.type === 'Property' &&
2222
utils.getStaticPropertyName(item) === 'render' &&
23-
(item.value.type === 'ArrowFunctionExpression' || item.value.type === 'FunctionExpression') &&
24-
!item.value.expression // render: () => test
23+
(item.value.type === 'ArrowFunctionExpression' || item.value.type === 'FunctionExpression')
2524
)
2625
if (!node) return
2726

2827
forbiddenNodes.forEach(el => {
2928
if (
3029
el.loc.start.line >= node.value.loc.start.line &&
3130
el.loc.end.line <= node.value.loc.end.line &&
32-
node.value === el
31+
el.loc.start.line === node.value.loc.start.line
3332
) {
3433
context.report({
3534
node: node.key,

lib/rules/return-in-computed-property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function create (context) {
2929
cp.value &&
3030
el.loc.start.line >= cp.value.loc.start.line &&
3131
el.loc.end.line <= cp.value.loc.end.line &&
32-
cp.value.parent === el
32+
el.loc.start.line === cp.value.loc.start.line
3333
) {
3434
context.report({
3535
node: el,

lib/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ module.exports = {
553553
funcInfo.hasReturnValue = Boolean(node.argument)
554554
},
555555
'ArrowFunctionExpression:exit' (node) {
556-
if (!isValidReturn()) {
556+
if (!isValidReturn() && !node.expression) {
557557
cb(funcInfo.node)
558558
}
559559
},

0 commit comments

Comments
 (0)