Skip to content

Commit 2e75ba6

Browse files
authored
Fixed no-side-effects-in-computed-properties when el is object (#1226)
* Fix scopeStack * Remove comma
1 parent eb20820 commit 2e75ba6

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lib/rules/no-side-effects-in-computed-properties.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,9 @@ module.exports = {
3131
create(context) {
3232
/** @type {Map<ObjectExpression, ComponentComputedProperty[]>} */
3333
const computedPropertiesMap = new Map()
34-
/**
35-
* @typedef {object} ScopeStack
36-
* @property {ScopeStack} upper
37-
* @property {BlockStatement | Expression} body
38-
*/
39-
/**
40-
* @type {ScopeStack}
41-
*/
42-
let scopeStack
34+
35+
/** @type { { upper: any, body: null | BlockStatement | Expression } } */
36+
let scopeStack = { upper: null, body: null }
4337

4438
/** @param {FunctionExpression | ArrowFunctionExpression | FunctionDeclaration} node */
4539
function onFunctionEnter(node) {

tests/lib/rules/no-side-effects-in-computed-properties.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ ruleTester.run('no-side-effects-in-computed-properties', rule, {
173173
}
174174
})`,
175175
parserOptions
176+
},
177+
{
178+
code: `const test = { el: '#app' }
179+
Vue.component('test', {
180+
el: test.el
181+
})`,
182+
parserOptions
176183
}
177184
],
178185
invalid: [

0 commit comments

Comments
 (0)