diff --git a/.changeset/icy-pianos-film.md b/.changeset/icy-pianos-film.md
new file mode 100644
index 00000000..90fbe471
--- /dev/null
+++ b/.changeset/icy-pianos-film.md
@@ -0,0 +1,5 @@
+---
+"svelte-eslint-parser": patch
+---
+
+fix: resolved issue of `$props` incorrectly detected as store when using variables named after runes like `$props` and `props`
diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts
index 01fc9ab4..2182f0b0 100644
--- a/src/parser/analyze-scope.ts
+++ b/src/parser/analyze-scope.ts
@@ -16,6 +16,7 @@ import {
import { addElementToSortedArray } from "../utils/index.js";
import type { NormalizedParserOptions } from "./parser-options.js";
import type { SvelteParseContext } from "./svelte-parse-context.js";
+import { getGlobalsForSvelte } from "./globals.js";
/**
* Analyze scope
*/
@@ -105,7 +106,10 @@ export function analyzeReactiveScope(scopeManager: ScopeManager): void {
/**
* Analyze store scope. e.g. $count
*/
-export function analyzeStoreScope(scopeManager: ScopeManager): void {
+export function analyzeStoreScope(
+ scopeManager: ScopeManager,
+ svelteParseContext: SvelteParseContext,
+): void {
const moduleScope = scopeManager.scopes.find(
(scope) => scope.type === "module",
);
@@ -114,8 +118,13 @@ export function analyzeStoreScope(scopeManager: ScopeManager): void {
}
const toBeMarkAsUsedReferences: Reference[] = [];
+ const globals = getGlobalsForSvelte(svelteParseContext);
+
for (const reference of [...scopeManager.globalScope.through]) {
- if (reference.identifier.name.startsWith("$")) {
+ if (
+ reference.identifier.name.startsWith("$") &&
+ !globals.includes(reference.identifier.name as never)
+ ) {
const realName = reference.identifier.name.slice(1);
const variable = moduleScope.set.get(realName);
if (variable) {
diff --git a/src/parser/index.ts b/src/parser/index.ts
index 641468cf..601e2914 100644
--- a/src/parser/index.ts
+++ b/src/parser/index.ts
@@ -170,9 +170,9 @@ function parseAsSvelte(
sortNodes(ctx.comments);
sortNodes(ctx.tokens);
extractTokens(ctx);
- analyzeStoreScope(resultScript.scopeManager!);
+ analyzeStoreScope(resultScript.scopeManager!, svelteParseContext);
analyzeReactiveScope(resultScript.scopeManager!);
- analyzeStoreScope(resultScript.scopeManager!); // for reactive vars
+ analyzeStoreScope(resultScript.scopeManager!, svelteParseContext); // for reactive vars
analyzeSnippetsScope(ctx.snippets, resultScript.scopeManager!);
// Add $$xxx variable
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json
new file mode 100644
index 00000000..623877c3
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-config.json
@@ -0,0 +1,7 @@
+{
+ "svelteConfig": {
+ "compilerOptions": {
+ "runes": true
+ }
+ }
+}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte
new file mode 100644
index 00000000..ee5502fb
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-input.svelte
@@ -0,0 +1,6 @@
+
+
+{props}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json
new file mode 100644
index 00000000..7d51d648
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-output.json
@@ -0,0 +1,785 @@
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "SvelteScriptElement",
+ "name": {
+ "type": "SvelteName",
+ "name": "script",
+ "range": [
+ 1,
+ 7
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 1
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 0,
+ 8
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ }
+ },
+ "body": [
+ {
+ "type": "VariableDeclaration",
+ "kind": "const",
+ "declarations": [
+ {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 68,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 60,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ ],
+ "range": [
+ 54,
+ 77
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 78,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 87,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "html",
+ "name": {
+ "type": "SvelteName",
+ "name": "span",
+ "range": [
+ 90,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 89,
+ 95
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ "children": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "range": [
+ 95,
+ 102
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 102,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 89,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "sourceType": "module",
+ "comments": [
+ {
+ "type": "Line",
+ "value": " It should not be recognized as a store.",
+ "range": [
+ 10,
+ 52
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 1
+ },
+ "end": {
+ "line": 2,
+ "column": 43
+ }
+ }
+ }
+ ],
+ "tokens": [
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 0,
+ 1
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 1,
+ 7
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 1
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 7,
+ 8
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 7
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Keyword",
+ "value": "const",
+ "range": [
+ 54,
+ 59
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 66,
+ 67
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 74,
+ 75
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 21
+ },
+ "end": {
+ "line": 3,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 75,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 76,
+ 77
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 78,
+ 79
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 79,
+ 80
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 1
+ },
+ "end": {
+ "line": 4,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 80,
+ 86
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 2
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 86,
+ 87
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 87,
+ 89
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 89,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 90,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 94,
+ 95
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 95,
+ 96
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 101,
+ 102
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 102,
+ 103
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 103,
+ 104
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 104,
+ 108
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 108,
+ 109
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 19
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 110
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json
new file mode 100644
index 00000000..0c95113b
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-runes-scope-output.json
@@ -0,0 +1,429 @@
+{
+ "type": "global",
+ "variables": [
+ {
+ "name": "$$slots",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$props",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$restProps",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$state",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$derived",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$effect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$props",
+ "identifiers": [],
+ "defs": [],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ },
+ {
+ "name": "$bindable",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$inspect",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$host",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "props",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "Variable",
+ "name": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "node": {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 68,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 60,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 96,
+ 101
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 60,
+ 65
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [],
+ "through": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 68,
+ 74
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": null
+ }
+ ]
+ }
+ ],
+ "through": []
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json
new file mode 100644
index 00000000..f5145143
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-config.json
@@ -0,0 +1,7 @@
+{
+ "svelteConfig": {
+ "compilerOptions": {
+ "runes": false
+ }
+ }
+}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte
new file mode 100644
index 00000000..0ef437b2
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-input.svelte
@@ -0,0 +1,6 @@
+
+
+{props}
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json
new file mode 100644
index 00000000..ef78b834
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-output.json
@@ -0,0 +1,785 @@
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "SvelteScriptElement",
+ "name": {
+ "type": "SvelteName",
+ "name": "script",
+ "range": [
+ 1,
+ 7
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 1
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 0,
+ 8
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ }
+ },
+ "body": [
+ {
+ "type": "VariableDeclaration",
+ "kind": "const",
+ "declarations": [
+ {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 64,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 56,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ ],
+ "range": [
+ 50,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 74,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ "range": [
+ 0,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "SvelteText",
+ "value": "\n\n",
+ "range": [
+ 83,
+ 85
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "SvelteElement",
+ "kind": "html",
+ "name": {
+ "type": "SvelteName",
+ "name": "span",
+ "range": [
+ 86,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ "startTag": {
+ "type": "SvelteStartTag",
+ "attributes": [],
+ "selfClosing": false,
+ "range": [
+ 85,
+ 91
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ "children": [
+ {
+ "type": "SvelteMustacheTag",
+ "kind": "text",
+ "expression": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "range": [
+ 91,
+ 98
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ }
+ ],
+ "endTag": {
+ "type": "SvelteEndTag",
+ "range": [
+ 98,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 85,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "sourceType": "module",
+ "comments": [
+ {
+ "type": "Line",
+ "value": " It should be recognized as a store.",
+ "range": [
+ 10,
+ 48
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 1
+ },
+ "end": {
+ "line": 2,
+ "column": 39
+ }
+ }
+ }
+ ],
+ "tokens": [
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 0,
+ 1
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 1,
+ 7
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 1
+ },
+ "end": {
+ "line": 1,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 7,
+ 8
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 7
+ },
+ "end": {
+ "line": 1,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Keyword",
+ "value": "const",
+ "range": [
+ 50,
+ 55
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 1
+ },
+ "end": {
+ "line": 3,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 62,
+ 63
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 13
+ },
+ "end": {
+ "line": 3,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "(",
+ "range": [
+ 70,
+ 71
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 21
+ },
+ "end": {
+ "line": 3,
+ "column": 22
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ")",
+ "range": [
+ 71,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 22
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 72,
+ 73
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 23
+ },
+ "end": {
+ "line": 3,
+ "column": 24
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 74,
+ 75
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 0
+ },
+ "end": {
+ "line": 4,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 75,
+ 76
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 1
+ },
+ "end": {
+ "line": 4,
+ "column": 2
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "script",
+ "range": [
+ 76,
+ 82
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 2
+ },
+ "end": {
+ "line": 4,
+ "column": 8
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 82,
+ 83
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 8
+ },
+ "end": {
+ "line": 4,
+ "column": 9
+ }
+ }
+ },
+ {
+ "type": "HTMLText",
+ "value": "\n\n",
+ "range": [
+ 83,
+ 85
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 9
+ },
+ "end": {
+ "line": 6,
+ "column": 0
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 85,
+ 86
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 1
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 86,
+ 90
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 90,
+ 91
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "{",
+ "range": [
+ 91,
+ 92
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "}",
+ "range": [
+ 97,
+ 98
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "<",
+ "range": [
+ 98,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 13
+ },
+ "end": {
+ "line": 6,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "/",
+ "range": [
+ 99,
+ 100
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ }
+ },
+ {
+ "type": "HTMLIdentifier",
+ "value": "span",
+ "range": [
+ 100,
+ 104
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 6,
+ "column": 19
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ">",
+ "range": [
+ 104,
+ 105
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 19
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ }
+ }
+ ],
+ "range": [
+ 0,
+ 106
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json
new file mode 100644
index 00000000..dffec93b
--- /dev/null
+++ b/tests/fixtures/parser/ast/svelte5/$props-without-destructuring-without-runes-scope-output.json
@@ -0,0 +1,396 @@
+{
+ "type": "global",
+ "variables": [
+ {
+ "name": "$$slots",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$props",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ },
+ {
+ "name": "$$restProps",
+ "identifiers": [],
+ "defs": [],
+ "references": []
+ }
+ ],
+ "references": [],
+ "childScopes": [
+ {
+ "type": "module",
+ "variables": [
+ {
+ "name": "props",
+ "identifiers": [
+ {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ ],
+ "defs": [
+ {
+ "type": "Variable",
+ "name": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "node": {
+ "type": "VariableDeclarator",
+ "id": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "init": {
+ "type": "CallExpression",
+ "arguments": [],
+ "callee": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "optional": false,
+ "range": [
+ 64,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ },
+ "range": [
+ 56,
+ 72
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 23
+ }
+ }
+ }
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "references": [
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": true,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "$props",
+ "range": [
+ 64,
+ 70
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 15
+ },
+ "end": {
+ "line": 3,
+ "column": 21
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ },
+ {
+ "identifier": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 92,
+ 97
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ }
+ },
+ "from": "module",
+ "init": null,
+ "resolved": {
+ "type": "Identifier",
+ "name": "props",
+ "range": [
+ 56,
+ 61
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 7
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ }
+ }
+ }
+ ],
+ "childScopes": [],
+ "through": []
+ }
+ ],
+ "through": []
+}
\ No newline at end of file