From ff0307fabfa3aca8c8a3e5ac4f52802e7bed8762 Mon Sep 17 00:00:00 2001 From: ktmouk Date: Tue, 30 Jun 2020 14:21:19 +0900 Subject: [PATCH 1/2] Fix scopeStack --- lib/rules/no-side-effects-in-computed-properties.js | 12 +++--------- .../rules/no-side-effects-in-computed-properties.js | 9 ++++++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/rules/no-side-effects-in-computed-properties.js b/lib/rules/no-side-effects-in-computed-properties.js index e6cd548e9..761b1ac61 100644 --- a/lib/rules/no-side-effects-in-computed-properties.js +++ b/lib/rules/no-side-effects-in-computed-properties.js @@ -31,15 +31,9 @@ module.exports = { create(context) { /** @type {Map} */ const computedPropertiesMap = new Map() - /** - * @typedef {object} ScopeStack - * @property {ScopeStack} upper - * @property {BlockStatement | Expression} body - */ - /** - * @type {ScopeStack} - */ - let scopeStack + + /** @type { { upper: any, body: null | BlockStatement | Expression } } */ + let scopeStack = { upper: null, body: null } /** @param {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration} node */ function onFunctionEnter(node) { diff --git a/tests/lib/rules/no-side-effects-in-computed-properties.js b/tests/lib/rules/no-side-effects-in-computed-properties.js index b2f341a18..33c3b8eb6 100644 --- a/tests/lib/rules/no-side-effects-in-computed-properties.js +++ b/tests/lib/rules/no-side-effects-in-computed-properties.js @@ -173,7 +173,14 @@ ruleTester.run('no-side-effects-in-computed-properties', rule, { } })`, parserOptions - } + }, + { + code: `const test = { el: '#app' } + Vue.component('test', { + el: test.el + })`, + parserOptions + }, ], invalid: [ { From 1231818e8fb6dfb5ce599d6ab0b9461374670bc4 Mon Sep 17 00:00:00 2001 From: ktmouk Date: Tue, 30 Jun 2020 15:18:35 +0900 Subject: [PATCH 2/2] Remove comma --- tests/lib/rules/no-side-effects-in-computed-properties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/rules/no-side-effects-in-computed-properties.js b/tests/lib/rules/no-side-effects-in-computed-properties.js index 33c3b8eb6..40caaf0c9 100644 --- a/tests/lib/rules/no-side-effects-in-computed-properties.js +++ b/tests/lib/rules/no-side-effects-in-computed-properties.js @@ -180,7 +180,7 @@ ruleTester.run('no-side-effects-in-computed-properties', rule, { el: test.el })`, parserOptions - }, + } ], invalid: [ {