{"library":"prettier-plugin-svelte","title":"prettier-plugin-svelte","description":"Prettier plugin for formatting Svelte components, supporting Svelte 3, 4, and 5. Current stable version is 3.5.1, with active development. Automatically formats HTML, CSS, and JavaScript within Svelte files, including Svelte-specific syntax like each loops, if blocks, and event bindings. Key differentiators: official plugin from the Svelte team, integrates natively with the Svelte VS Code extension, and supports Prettier v3 (v2 works with Prettier v2). Released on npm, ships TypeScript types, and follows Prettier's plugin API. Compared to generic formatters, this plugin understands Svelte's template syntax and provides options like sorting order and strict mode.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prettier-plugin-svelte"],"cli":null},"imports":["Add 'prettier-plugin-svelte' to the plugins array in your Prettier config","Set options in .prettierrc: { \"svelteSortOrder\": \"options-scripts-markup-styles\", \"svelteStrictMode\": true }","No import needed; types are provided automatically when using Prettier's config"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// Install\nnpm i --save-dev prettier prettier-plugin-svelte\n\n// .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-svelte\"],\n  \"overrides\": [{ \"files\": \"*.svelte\", \"options\": { \"parser\": \"svelte\" } }],\n  \"svelteSortOrder\": \"options-scripts-markup-styles\",\n  \"svelteStrictMode\": true\n}\n\n// Format all .svelte files\nnpx prettier --write \"**/*.svelte\"","lang":"javascript","description":"Shows installation, Prettier configuration with plugin and Svelte options, and CLI usage to format all Svelte files.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}