diff --git a/lib/utils/index.js b/lib/utils/index.js index 8a35c14b0..957a9d6c8 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -457,7 +457,7 @@ module.exports = { } return { - ObjectExpression (node) { + 'ObjectExpression:exit' (node) { if (!componentComments.some(el => el.loc.end.line === node.loc.start.line - 1) || isDuplicateNode(node)) return cb(node) }, diff --git a/tests/lib/rules/return-in-computed-property.js b/tests/lib/rules/return-in-computed-property.js index e1d290fba..0a32faf75 100644 --- a/tests/lib/rules/return-in-computed-property.js +++ b/tests/lib/rules/return-in-computed-property.js @@ -237,6 +237,25 @@ ruleTester.run('return-in-computed-property', rule, { message: 'Expected to return a value in "foo" computed property.', line: 4 }] + }, + { + filename: 'test.js', + code: ` + // @vue/component + export default { + computed: { + my_FALSE_test() { + let aa = 2; + this.my_id = aa; + } + } + } + `, + parserOptions, + errors: [{ + message: 'Expected to return a value in "my_FALSE_test" computed property.', + line: 5 + }] } ] })