0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00

Skip JS globals for InlineComponent nodes in warn_if_undefined. (#4071)

This commit is contained in:
Benjamin W. Broersma 2019-12-09 15:15:49 +01:00 committed by Conduitry
parent 2c9d864e33
commit 3433418dce
3 changed files with 19 additions and 1 deletions

View File

@ -1283,7 +1283,7 @@ export default class Component {
if (this.var_lookup.has(name) && !this.var_lookup.get(name).global) return;
if (template_scope && template_scope.names.has(name)) return;
if (globals.has(name)) return;
if (globals.has(name) && node.type !== 'InlineComponent') return;
let message = `'${name}' is not defined`;
if (!this.ast.instance)

View File

@ -0,0 +1,3 @@
<div>
<String/>
</div>

View File

@ -0,0 +1,15 @@
[{
"code": "missing-declaration",
"message": "'String' is not defined. Consider adding a <script> block with 'export let String' to declare a prop",
"start": {
"line": 2,
"column": 1,
"character": 7
},
"end": {
"line": 2,
"column": 10,
"character": 16
},
"pos": 7
}]