From f6ba6f234f6671cc7aa9db966a0ff30fc4f2e5dd Mon Sep 17 00:00:00 2001 From: David A Kondrad Date: Tue, 10 Dec 2019 13:09:59 -0500 Subject: [PATCH] compiler: tag auto-subscribe stores in vars as referenced Fixes unused variable warnings thrown by ESLint when using auto-subscribe stores in templates. --- src/compiler/compile/Component.ts | 6 +++++- test/vars/samples/store-referenced/_config.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 4402a4a947..aee214602d 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -203,7 +203,11 @@ export default class Component { const subscribable_name = name.slice(1); const variable = this.var_lookup.get(subscribable_name); - if (variable) variable.subscribable = true; + if (variable) + { + variable.referenced = true; + variable.subscribable = true; + } } else { this.used_names.add(name); } diff --git a/test/vars/samples/store-referenced/_config.js b/test/vars/samples/store-referenced/_config.js index cb92b67ea4..bac35d1dba 100644 --- a/test/vars/samples/store-referenced/_config.js +++ b/test/vars/samples/store-referenced/_config.js @@ -8,7 +8,7 @@ export default { module: false, mutated: false, reassigned: false, - referenced: false, + referenced: true, referenced_from_script: false, writable: true },