fix warnings for props that are only used as stores (#4021)

pull/4062/head
Conduitry 5 years ago
parent 185ff4ae04
commit e996ef750d

@ -465,7 +465,7 @@ export default class Component {
extract_names(declarator.id).forEach(name => {
const variable = this.var_lookup.get(name);
variable.export_name = name;
if (variable.writable && !(variable.referenced || variable.referenced_from_script)) {
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
this.warn(declarator, {
code: `unused-export-let`,
message: `${this.name.name} has unused export property '${name}'. If it is for external reference only, please consider using \`export const '${name}'\``
@ -488,7 +488,7 @@ export default class Component {
if (variable) {
variable.export_name = specifier.exported.name;
if (variable.writable && !(variable.referenced || variable.referenced_from_script)) {
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
this.warn(specifier, {
code: `unused-export-let`,
message: `${this.name.name} has unused export property '${specifier.exported.name}'. If it is for external reference only, please consider using \`export const '${specifier.exported.name}'\``

@ -18,4 +18,8 @@
function foo() {
return m + n + o;
}
export let p;
export let q;
$p;
</script>
{$q}

Loading…
Cancel
Save