diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 004ecb32ca..62c2931f62 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -169,15 +169,6 @@ export default class Component { const variable = this.var_lookup.get(subscribable_name); variable.subscribable = true; - } else if (!this.ast.instance) { - this.add_var({ - name, - export_name: name, - implicit: true, - mutated: false, - referenced: true, - writable: true - }); } else { this.usedNames.add(name); } @@ -1140,7 +1131,7 @@ export default class Component { return `ctx.${name}`; } - warn_if_undefined(node, template_scope: TemplateScope, allow_implicit?: boolean) { + warn_if_undefined(node, template_scope: TemplateScope) { let { name } = node; if (name[0] === '$') { @@ -1148,14 +1139,16 @@ export default class Component { this.has_reactive_assignments = true; } - if (allow_implicit && !this.ast.instance && !this.ast.module) return; if (this.var_lookup.has(name)) return; if (template_scope && template_scope.names.has(name)) return; if (globalWhitelist.has(name)) return; + let message = `'${name}' is not defined`; + if (!this.ast.instance) message += `. Consider adding a + text diff --git a/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/input.svelte b/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/input.svelte index dda0d98c7c..e66777cd08 100644 --- a/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/input.svelte +++ b/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/input.svelte @@ -1,3 +1,7 @@ + +

this is styled

this is unstyled

diff --git a/test/css/samples/spread/input.svelte b/test/css/samples/spread/input.svelte index ab5f2e937e..aa43e4ae11 100644 --- a/test/css/samples/spread/input.svelte +++ b/test/css/samples/spread/input.svelte @@ -1,3 +1,7 @@ + +
Big red Comic Sans
diff --git a/test/css/samples/unused-selector-ternary/_config.js b/test/css/samples/unused-selector-ternary/_config.js index 68254477d9..4ff2713108 100644 --- a/test/css/samples/unused-selector-ternary/_config.js +++ b/test/css/samples/unused-selector-ternary/_config.js @@ -8,22 +8,22 @@ export default { code: `css-unused-selector`, message: "Unused CSS selector", start: { - line: 12, + line: 16, column: 1, - character: 123 + character: 163 }, end: { - line: 12, + line: 16, column: 13, - character: 135 + character: 175 }, - pos: 123, + pos: 163, frame: ` - 10: } - 11: - 12: .maybeactive { + 14: } + 15: + 16: .maybeactive { ^ - 13: color: green; - 14: }` + 17: color: green; + 18: }` }] }; \ No newline at end of file diff --git a/test/css/samples/unused-selector-ternary/input.svelte b/test/css/samples/unused-selector-ternary/input.svelte index 728dfa766a..f72592834f 100644 --- a/test/css/samples/unused-selector-ternary/input.svelte +++ b/test/css/samples/unused-selector-ternary/input.svelte @@ -1,3 +1,7 @@ + +