-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add migration task when there's a variable named that would conf…
- Loading branch information
1 parent
870745f
commit 438de04
Showing
29 changed files
with
266 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: add migration task when there's a variable named that would conflict with a rune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$bindable-bindable-var-1/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
6 changes: 6 additions & 0 deletions
6
...ges/svelte/tests/migrate/samples/impossible-migrate-$bindable-bindable-var-1/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
let bindable; | ||
export let something; | ||
</script> | ||
|
||
<input bind:value={something} /> |
8 changes: 8 additions & 0 deletions
8
...es/svelte/tests/migrate/samples/impossible-migrate-$bindable-bindable-var-1/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- @migration-task Error while migrating Svelte code: migrating this component would require adding a `$bindable` rune but there's already a variable named bindable. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let bindable; | ||
export let something; | ||
</script> | ||
|
||
<input bind:value={something} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-1/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-1/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script> | ||
let name = 'world'; | ||
let derived; | ||
$: other = name; | ||
</script> | ||
|
||
<input bind:value={name} /> |
11 changes: 11 additions & 0 deletions
11
...ages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-1/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- @migration-task Error while migrating Svelte code: can't migrate `$: other = name;` to `$derived` because there's a variable named derived. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let name = 'world'; | ||
let derived; | ||
$: other = name; | ||
</script> | ||
|
||
<input bind:value={name} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-2/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-2/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
let derived; | ||
</script> | ||
|
||
<svelte:component this={derived} /> |
7 changes: 7 additions & 0 deletions
7
...ages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-2/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- @migration-task Error while migrating Svelte code: migrating this component would require adding a `$derived` rune but there's already a variable named derived. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let derived; | ||
</script> | ||
|
||
<svelte:component this={derived} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
6 changes: 6 additions & 0 deletions
6
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
let derived; | ||
</script> | ||
<Component> | ||
<slot name="derived" slot="derived" /> | ||
</Component> |
7 changes: 7 additions & 0 deletions
7
...ages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable --> | ||
<script> | ||
let derived; | ||
</script> | ||
<Component> | ||
<slot name="derived" slot="derived" /> | ||
</Component> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-4/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-4/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script> | ||
let name = 'world'; | ||
let derived; | ||
let other; | ||
$: other = name; | ||
</script> | ||
|
||
<input bind:value={name} /> |
12 changes: 12 additions & 0 deletions
12
...ages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-4/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- @migration-task Error while migrating Svelte code: can't migrate `let other;` to `$derived` because there's a variable named derived. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let name = 'world'; | ||
let derived; | ||
let other; | ||
$: other = name; | ||
</script> | ||
|
||
<input bind:value={name} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$props-props-var-1/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/svelte/tests/migrate/samples/impossible-migrate-$props-props-var-1/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script> | ||
let props; | ||
export let something; | ||
</script> |
6 changes: 6 additions & 0 deletions
6
packages/svelte/tests/migrate/samples/impossible-migrate-$props-props-var-1/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- @migration-task Error while migrating Svelte code: migrating this component would require adding a `$props` rune but there's already a variable named props. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let props; | ||
export let something; | ||
</script> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-1/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-1/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
let state = 'world'; | ||
let other; | ||
</script> | ||
|
||
<input bind:value={other} /> |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-1/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- @migration-task Error while migrating Svelte code: can't migrate `let other;` to `$state` because there's a variable named state. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let state = 'world'; | ||
let other; | ||
</script> | ||
|
||
<input bind:value={other} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-2/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-2/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
let state = 'world'; | ||
let other = 42; | ||
</script> | ||
|
||
<input bind:value={other} /> |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-2/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- @migration-task Error while migrating Svelte code: can't migrate `let other = 42;` to `$state` because there's a variable named state. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let state = 'world'; | ||
let other = 42; | ||
</script> | ||
|
||
<input bind:value={other} /> |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-3/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
logs: [ | ||
'One or more `@migration-task` comments were added to `output.svelte`, please check them and complete the migration manually.' | ||
], | ||
errors: [] | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-3/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
let state = 'world'; | ||
$: other = 42; | ||
</script> | ||
|
||
<input bind:value={other} /> |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/migrate/samples/impossible-migrate-$state-state-var-3/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- @migration-task Error while migrating Svelte code: can't migrate `$: other = 42;` to `$state` because there's a variable named state. | ||
Rename the variable and try again or migrate by hand. --> | ||
<script> | ||
let state = 'world'; | ||
$: other = 42; | ||
</script> | ||
|
||
<input bind:value={other} /> |