Skip to content

Commit 7e4936f

Browse files
dougalgmysticatea
authored andcommitted
Fix: no-async-in-computed-properties with empty returns (#816)
1 parent 04b3c38 commit 7e4936f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/rules/no-async-in-computed-properties.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ module.exports = {
138138

139139
'ReturnStatement' (node) {
140140
if (
141-
node.argument.type === 'ObjectExpression' ||
142-
node.argument.type === 'ArrayExpression'
141+
node.argument &&
142+
(
143+
node.argument.type === 'ObjectExpression' ||
144+
node.argument.type === 'ArrayExpression'
145+
)
143146
) {
144147
allowedScopes.push(node.argument)
145148
}

tests/lib/rules/no-async-in-computed-properties.js

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ const ruleTester = new RuleTester()
2525
ruleTester.run('no-async-in-computed-properties', rule, {
2626

2727
valid: [
28+
{
29+
filename: 'test.vue',
30+
code: `
31+
export default {
32+
computed: {
33+
foo: function () {
34+
return;
35+
},
36+
}
37+
}
38+
`,
39+
parserOptions
40+
},
2841
{
2942
filename: 'test.vue',
3043
code: `

0 commit comments

Comments
 (0)