Skip to content

Commit e6b5ccd

Browse files
authored
fix: tweak invalid dollar prefix rules around function args (#9792)
1 parent 62c9292 commit e6b5ccd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/neat-dingos-clap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: tweak invalid dollar prefix rules around function args

packages/svelte/src/compiler/phases/scope.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ export class Scope {
7373
error(node, 'invalid-dollar-binding');
7474
}
7575

76-
if (node.name.startsWith('$') && declaration_kind !== 'synthetic' && this.function_depth <= 1) {
76+
if (
77+
node.name.startsWith('$') &&
78+
declaration_kind !== 'synthetic' &&
79+
declaration_kind !== 'param' &&
80+
declaration_kind !== 'rest_param' &&
81+
this.function_depth <= 1
82+
) {
7783
error(node, 'invalid-dollar-prefix');
7884
}
7985

0 commit comments

Comments
 (0)