Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update type of $props rune #510

Merged
merged 4 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smooth-elephants-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": patch
---

feat: update type of $props rune
7 changes: 5 additions & 2 deletions explorer-v2/src/lib/MonacoEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,13 @@

{#await loading}
{#if started}
<div class="eslint-editor-monaco-root eslint-editor-monaco-root--wait" in:loadingTypewriter />
<div
class="eslint-editor-monaco-root eslint-editor-monaco-root--wait"
in:loadingTypewriter
></div>
Comment on lines +241 to +244
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed ESLint error which came from sveltejs/svelte#11114.

{/if}
{:then}
<div bind:this={rootElement} class="eslint-editor-monaco-root" />
<div bind:this={rootElement} class="eslint-editor-monaco-root"></div>
{/await}

<style>
Expand Down
2 changes: 1 addition & 1 deletion explorer-v2/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
position: relative;
height: calc(100vh - 64px);
}
.main > * {
.main > :global(*) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just I fixed an unused CSS error.

position: relative;
width: 100%;
height: 100%;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version"
},
"peerDependencies": {
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.94"
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.112"
},
"peerDependenciesMeta": {
"svelte": {
Expand Down Expand Up @@ -105,7 +105,7 @@
"prettier-plugin-svelte": "^3.2.2",
"rimraf": "^5.0.5",
"semver": "^7.6.0",
"svelte": "^5.0.0-next.94",
"svelte": "^5.0.0-next.112",
"svelte2tsx": "^0.7.6",
"typescript": "~5.4.4",
"typescript-eslint-parser-for-extra-files": "^0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion src/parser/converts/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export function* convertChildren(
continue;
}

throw new Error(`Unknown type:${(child as any).type}`);
throw new Error(`Unknown type:${child.type}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser/typescript/analyze/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function analyzeRuneVariables(
}
// See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2655
case "$props": {
appendDeclareFunctionVirtualScripts(globalName, ["<T>(): T"]);
appendDeclareFunctionVirtualScripts(globalName, ["(): any"]);
break;
}
// See https://github.com/sveltejs/svelte/blob/dfc55c18f010f620b966e13eb0ad1f9791b5798f/packages/svelte/types/index.d.ts#L2666
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts">
type MyProps = {}
let { a, b, c, ...everythingElse } = $props<MyProps>();
type MyProps = {};
let { a, b, c, ...everythingElse }: MyProps = $props();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"ruleId": "no-unused-vars",
"code": "a",
"line": 3,
"column": 11
"column": 9
},
{
"ruleId": "no-unused-vars",
"code": "b",
"line": 3,
"column": 14
"column": 12
},
{
"ruleId": "no-unused-vars",
"code": "c",
"line": 3,
"column": 17
"column": 15
},
{
"ruleId": "no-unused-vars",
"code": "everythingElse",
"line": 3,
"column": 23
"column": 21
}
]
Loading
Loading