Skip to content

Removed parentheses and breaks code in bind statement #503

@justingoldentrulioo

Description

@justingoldentrulioo

The code:

<input bind:value={(data[key] as any)[index]}/>

is perfectly valid (and common!) svelte.

Prettier-plugin-svelte removed the opening paren, changes it into:

<input bind:value={data[key] as any)[index]} />

which is invalid code and breaks the entire application.

I noticed this issue years ago and it still seems present in the latest version.

Deps:

"@eslint/compat": "1.4.0",
"@eslint/js": "9.37.0",
"@playwright/test": "1.56.0",
"@sveltejs/adapter-auto": "6.1.1",
"@sveltejs/kit": "2.46.5",
"@sveltejs/vite-plugin-svelte": "6.2.1",
"@tailwindcss/vite": "4.1.14",
"@types/node": "24.7.2",
"@vitest/browser": "3.2.4",
"drizzle-kit": "0.31.5",
"eslint": "9.37.0",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-svelte": "3.12.4",
"globals": "16.4.0",
"playwright": "1.56.0",
"prettier": "3.6.2",
"prettier-plugin-svelte": "3.4.0",
"prettier-plugin-tailwindcss": "0.6.14",
"svelte": "5.39.11",
"svelte-check": "4.3.3",
"tailwindcss": "4.1.14",
"ts-node": "10.9.2",
"typescript": "5.9.3",
"typescript-eslint": "8.46.1",
"vite": "7.1.9",
"vitest": "3.2.4",
"vitest-browser-svelte": "1.1.0"

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions