diff --git a/src/preprocess.js b/src/preprocess.js index 004cc78..bf74cff 100644 --- a/src/preprocess.js +++ b/src/preprocess.js @@ -162,7 +162,7 @@ export const preprocess = text => { find_contextual_names(compiler, parent.value); } else if (node.type === 'CatchBlock') { find_contextual_names(compiler, parent.error); - } else if (node.type === 'Element' || node.type === 'InlineComponent') { + } else if (node.type === 'Element' || node.type === 'InlineComponent' || node.type === 'SlotTemplate') { node.attributes.forEach(node => node.type === 'Let' && find_contextual_names(compiler, node.expression || node.name)); } if (contextual_names.length) { diff --git a/test/samples/scope/Input.svelte b/test/samples/scope/Input.svelte index d377c92..fa3cc06 100644 --- a/test/samples/scope/Input.svelte +++ b/test/samples/scope/Input.svelte @@ -31,6 +31,13 @@ + + + {blah1} + {blah2} + + + {#await foo} xxx {:then blah1} diff --git a/test/samples/scope/expected.json b/test/samples/scope/expected.json index 7565f4f..4607a43 100644 --- a/test/samples/scope/expected.json +++ b/test/samples/scope/expected.json @@ -29,16 +29,23 @@ }, { "ruleId": "no-undef", - "line": 38, + "line": 36, + "column": 4, + "endLine": 36, + "endColumn": 9 + }, + { + "ruleId": "no-undef", + "line": 45, "column": 3, - "endLine": 38, + "endLine": 45, "endColumn": 8 }, { "ruleId": "no-undef", - "line": 40, + "line": 47, "column": 3, - "endLine": 40, + "endLine": 47, "endColumn": 8 } ]