File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,9 @@ export const preprocess = text => {
172
172
} else if ( node . type === 'Element' || node . type === 'InlineComponent' || node . type === 'SlotTemplate' ) {
173
173
node . attributes . forEach ( node => node . type === 'Let' && find_contextual_names ( compiler , node . expression || node . name ) ) ;
174
174
}
175
+ if ( Array . isArray ( node . children ) ) {
176
+ node . children . forEach ( node => node . type === 'ConstTag' && find_contextual_names ( compiler , node . expression . left . name ) ) ;
177
+ }
175
178
if ( contextual_names . length ) {
176
179
nodes_with_contextual_scope . add ( node ) ;
177
180
block . transformed_code += `{let ${ contextual_names . map ( name => `${ name } =0` ) . join ( ',' ) } ;` ;
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ rules : {
3
+ 'no-undef' : 'error' ,
4
+ } ,
5
+ settings : {
6
+ 'svelte3/ignore-warnings' : ( { code } ) => code === 'missing-declaration' ,
7
+ } ,
8
+ } ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ export let boxes;
3
+ let p;
4
+ </script >
5
+
6
+ {#each boxes as box }
7
+ {@const area = box .width * box .height }
8
+ {box .width } * {box .height } = {area }
9
+ {/each }
10
+
11
+ {area } <!-- undef -->
12
+
13
+ {#await p }
14
+ wait
15
+ {:then }
16
+ {@const box = boxes [0 ]}
17
+ {box .width }
18
+ {/await }
19
+
20
+ {#await p then }
21
+ then
22
+ {:catch }
23
+ {@const box = boxes [0 ]}
24
+ {box .width }
25
+ {/await }
26
+
27
+ <Component >
28
+ {@const box = boxes [0 ]}
29
+ {box .width }
30
+ </Component >
31
+
32
+ <Component >
33
+ <svelte:fragment slot =" foo" >
34
+ {@const box = boxes [0 ]}
35
+ {box .width }
36
+ </svelte:fragment >
37
+ </Component >
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "ruleId" : " no-undef" ,
4
+ "line" : 11 ,
5
+ "column" : 2 ,
6
+ "endLine" : 11 ,
7
+ "endColumn" : 6
8
+ }
9
+ ]
You can’t perform that action at this time.
0 commit comments