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

fix: check property key instead of value in valid-prop-names-in-kit-pages rule #1126

Merged
merged 1 commit into from
Mar 10, 2025
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/gentle-guests-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-svelte': patch
---

fix: check property key instead of value in `valid-prop-names-in-kit-pages` rule
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ function checkProp(
for (const p of node.id.properties) {
if (
p.type === 'Property' &&
p.value.type === 'Identifier' &&
!expectedPropNames.includes(p.value.name)
p.key.type === 'Identifier' &&
!expectedPropNames.includes(p.key.name)
) {
context.report({
node: p.value,
loc: p.value.loc,
node: p.key,
loc: p.key.loc,
messageId: 'unexpected'
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@
line: 4
column: 20
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 21
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 36
suggestions: null
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@
line: 4
column: 20
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 21
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 36
suggestions: null
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@
line: 4
column: 20
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 21
suggestions: null
- message: disallow props other than data or errors in SvelteKit page components.
line: 5
column: 36
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
let { data: pageData }: { data: PageData } = $props();
</script>

{pageData}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"languageOptions": {
"parserOptions": {
"svelteConfig": {
"kit": {
"files": {
"routes": "tests/fixtures/rules/valid-prop-names-in-kit-pages/invalid/svelte5"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}