{"_id":"@3-/prettier-plugin-svelte","_rev":"2-31c012f68cce13093efacc7f11547a5f","name":"@3-/prettier-plugin-svelte","dist-tags":{"latest":"3.2.8"},"versions":{"3.2.6":{"name":"@3-/prettier-plugin-svelte","version":"3.2.6","keywords":["prettier","svelte"],"author":{"name":"James Birtles","email":"jameshbirtles@gmail.com"},"license":"MIT","_id":"@3-/prettier-plugin-svelte@3.2.6","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/sveltejs/prettier-plugin-svelte#readme","bugs":{"url":"https://github.com/sveltejs/prettier-plugin-svelte/issues"},"dist":{"shasum":"636d896382b31fb46699a9bc0d14fcd1f1e2255b","tarball":"https://registry.npmjs.org/@3-/prettier-plugin-svelte/-/prettier-plugin-svelte-3.2.6.tgz","fileCount":7,"integrity":"sha512-OeLEOlWuUthQfSk6JIaUJWUbolnrgERnehg5mbZsu82AF4G4WltsU4d8hVUbUAZ/JX/8w2HHuuiroPXkXFcynQ==","signatures":[{"sig":"MEUCIQDV5pjAAwW0kjnARwar4n1P9MlOe7U77wa71bAS76++FwIga5S8I1WGZXHJ6veI7FSI4gAza3JgS8VRtjAHrxxo0rk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1489977},"main":"plugin.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./plugin.js"},"./browser":"./browser.js","./package.json":"./package.json"},"gitHead":"3cbdbf0be4c3b8acee7630765fc3e1316ecff3a6","scripts":{"lint":"prettier --check .","test":"ava","build":"rollup -c","check":"tsc --noEmit","format":"prettier --write .","prepare":"npm run build","check:watch":"tsc --noEmit --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/sveltejs/prettier-plugin-svelte.git","type":"git"},"_npmVersion":"10.9.2","description":"Svelte plugin for prettier","directories":{},"_nodeVersion":"23.6.1","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","tslib":"^2.6.0","rollup":"2.36.0","svelte":"^5.0.0-next.243","ts-node":"^10.1.1","prettier":"^3.0.0","typescript":"5.1.3","@types/node":"^14.0.0","@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"14.0.0","rollup-plugin-typescript":"1.0.1","@rollup/plugin-node-resolve":"11.0.1"},"peerDependencies":{"svelte":"^5.0.0-next.243","prettier":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prettier-plugin-svelte_3.2.6_1737974714969_0.5832927553183487","host":"s3://npm-registry-packages-npm-production"}},"3.2.7":{"name":"@3-/prettier-plugin-svelte","version":"3.2.7","keywords":["prettier","svelte"],"author":{"name":"James Birtles","email":"jameshbirtles@gmail.com"},"license":"MIT","_id":"@3-/prettier-plugin-svelte@3.2.7","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/sveltejs/prettier-plugin-svelte#readme","bugs":{"url":"https://github.com/sveltejs/prettier-plugin-svelte/issues"},"dist":{"shasum":"a8d884d5fbee78bb796cbe4825e2f94e82f158c1","tarball":"https://registry.npmjs.org/@3-/prettier-plugin-svelte/-/prettier-plugin-svelte-3.2.7.tgz","fileCount":7,"integrity":"sha512-ifOP2EGpOjG4/89rKyKkJ7nsUSqIb3HyUs2sc79Ls39fUnWSmcvFvkTkAeqVSwM4rfQ454tZWSJCROGta6HwZw==","signatures":[{"sig":"MEQCID2M52kDfNu0/gSQw1sqIdL3jcJ6QheHHZmvN/JHVi3hAiA5may2bOuWxLg0K+chj3hAVgUyOe8UppodThrG6mQ21Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1490636},"main":"plugin.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./plugin.js"},"./browser":"./browser.js","./package.json":"./package.json"},"gitHead":"f3bed041810555c81b32ff1e798c2e748a36fb7c","scripts":{"lint":"prettier --check .","test":"ava","build":"rollup -c","check":"tsc --noEmit","format":"prettier --write .","prepare":"npm run build","check:watch":"tsc --noEmit --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/sveltejs/prettier-plugin-svelte.git","type":"git"},"_npmVersion":"10.9.2","description":"Svelte plugin for prettier","directories":{},"_nodeVersion":"23.6.1","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","tslib":"^2.6.0","rollup":"2.36.0","svelte":"^5.0.0-next.243","ts-node":"^10.1.1","prettier":"^3.0.0","typescript":"5.1.3","@types/node":"^14.0.0","@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"14.0.0","rollup-plugin-typescript":"1.0.1","@rollup/plugin-node-resolve":"11.0.1"},"peerDependencies":{"svelte":"^5.0.0-next.243","prettier":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/prettier-plugin-svelte_3.2.7_1738738595246_0.323117473278258","host":"s3://npm-registry-packages-npm-production"}},"3.2.8":{"name":"@3-/prettier-plugin-svelte","version":"3.2.8","description":"Svelte plugin for prettier","main":"plugin.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./plugin.js"},"./browser":"./browser.js","./package.json":"./package.json"},"scripts":{"build":"rollup -c","check":"tsc --noEmit","check:watch":"tsc --noEmit --watch","lint":"prettier --check .","format":"prettier --write .","test":"ava","prepare":"npm run build","prepublishOnly":"npm test"},"keywords":["prettier","svelte"],"license":"MIT","homepage":"https://github.com/i18n-fork/prettier-plugin-svelte/tree/tmp","devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"14.0.0","@rollup/plugin-node-resolve":"11.0.1","@types/node":"^14.0.0","ava":"3.15.0","prettier":"^3.0.0","rollup":"2.36.0","rollup-plugin-typescript":"1.0.1","svelte":"^5.0.0-next.243","ts-node":"^10.1.1","tslib":"^2.6.0","typescript":"5.1.3"},"peerDependencies":{"prettier":"^3.0.0","svelte":"^5.0.0-next.243"},"_id":"@3-/prettier-plugin-svelte@3.2.8","gitHead":"54d8f3e65b9875a61895d556dd698d995254f377","_nodeVersion":"23.6.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-urjkILr4Z6lmB4HAwJpJH3ZjZg3Du9uuip8pODc6IVRdf8gOmcJMoVmRYkUIaBwuA9fL0WZwmxCjCVmMeNKdLQ==","shasum":"2bbb7cbcf04c015f03784dc4b161cc546ce9fd63","tarball":"https://registry.npmjs.org/@3-/prettier-plugin-svelte/-/prettier-plugin-svelte-3.2.8.tgz","fileCount":7,"unpackedSize":1490308,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICM+yVHUv7gV0uHFZ85IxjJTYsO5n6zCvPIrKav338q8AiEA8XlpnNBCsiCKPUndNgoaZsb0jE6ZDrwG7KiadIJnTak="}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prettier-plugin-svelte_3.2.8_1738740418653_0.3245136826895092"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-27T10:45:14.863Z","modified":"2025-02-05T07:26:59.120Z","3.2.6":"2025-01-27T10:45:15.208Z","3.2.7":"2025-02-05T06:56:35.501Z","3.2.8":"2025-02-05T07:26:58.910Z"},"license":"MIT","homepage":"https://github.com/i18n-fork/prettier-plugin-svelte/tree/tmp","keywords":["prettier","svelte"],"description":"Svelte plugin for prettier","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"> This documentation is for upcoming `prettier-plugin-svelte` version 4 (not released yet) which only works with Svelte 5. See [this branch](https://github.com/sveltejs/prettier-plugin-svelte/tree/version-3) for documentation of the current stable version.\n\n# Prettier for Svelte components\n\nFormat your Svelte components using Prettier.\n\n## Features\n\n-   Format your HTML, CSS, and JavaScript using prettier\n-   Format Svelte syntax, e.g. each loops, if statements, await blocks, etc.\n-   Format the JavaScript expressions embedded in the Svelte syntax\n    -   e.g. expressions inside of `{}`, event bindings `on:click=\"\"`, and more\n\n## VS Code Extension\n\nThis plugin is bundled in the [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) extension. If you only format through the editor, you therefore don't need to do anything in addition.\n\nThe extension lets you define options through extension-specific configuration. These settings are ignored however if there's any configuration file (`.prettierrc` for example) present.\n\n## Prettier Plugin\n\nInstalling the plugin as a package allows:\n\n-   customizing the formatting behavior\n-   using the command line to format\n-   using a different IDE\n-   using the official VS Code [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension to format Svelte files\n\n### Compatibility\n\n-   `prettier-plugin-svelte@4` only works with `prettier@3`\n-   `prettier-plugin-svelte@3` only works with `prettier@3`\n-   `prettier-plugin-svelte@2` only works with `prettier@2`\n\n### Setup\n\nInstall Prettier and the plugin as a dev dependency:\n\n```bash\nnpm i --save-dev prettier-plugin-svelte prettier\n```\n\nThen create a `.prettierrc` [configuration file](https://prettier.io/docs/en/configuration.html):\n\n```jsonc\n// .prettierrc\n{\n    // ..\n    \"plugins\": [\"prettier-plugin-svelte\"],\n    \"pluginSearchDirs\": [\".\"], // should be removed in v3\n    \"overrides\": [{ \"files\": \"*.svelte\", \"options\": { \"parser\": \"svelte\" } }]\n}\n```\n\nIf you want to customize some formatting behavior, see section [Options](#options).\n\n### CLI Usage\n\nFormat your code using the Prettier CLI.\n\n```bash\nnpx prettier --write .\n```\n\nAs part of your scripts in `package.json`:\n\n```jsonc\n// package.json\n{\n    // ..\n    \"scripts\": {\n        \"format\": \"prettier --write .\"\n    }\n}\n```\n\nIf you want to customize some formatting behavior, see section [Options](#options).\n\n## Options\n\n`Configurations are optional`\n\nMake a `.prettierrc` file in your project directory and add your preferred [options](https://prettier.io/docs/en/options.html) to [configure Prettier](https://prettier.io/docs/en/configuration.html). When using Prettier through the CLI, you can also pass options through CLI flags, but a `.prettierrc` file is recommended.\n\n### Svelte Sort Order\n\nSort order for `svelte:options`, scripts, markup, and styles.\n\nFormat: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in the order you want; or `none` if you don't want Prettier to reorder anything.\n\n| Default                         | CLI Override                   | API Override                |\n| ------------------------------- | ------------------------------ | --------------------------- |\n| `options-scripts-markup-styles` | `--svelte-sort-order <string>` | `svelteSortOrder: <string>` |\n\n> The `options` order option only exists since version 2. If you use version 1 of `prettier-plugin-svelte`, omit that option (so for example only write `scripts-markup-styles`).\n\n### Svelte Allow Shorthand\n\nOption to enable/disable component attribute shorthand if attribute name and expression are same.\n\nExample:\n\n<!-- prettier-ignore -->\n```html\n<!-- allowShorthand: true -->\n<input type=\"text\" {value} />\n\n<!-- allowShorthand: false -->\n<input type=\"text\" value={value} />\n```\n\n| Default | CLI Override                      | API Override                   |\n| ------- | --------------------------------- | ------------------------------ |\n| `true`  | `--svelte-allow-shorthand <bool>` | `svelteAllowShorthand: <bool>` |\n\n### Svelte Bracket New Line\n\n> Deprecated since 2.5.0. Use Prettier 2.4.0 and [bracketSameLine](https://prettier.io/docs/en/options.html#bracket-line) instead.\n\nPut the `>` of a multiline element on a new line. Roughly the Svelte equivalent of the [jsxBracketSameLine](https://prettier.io/docs/en/options.html#jsx-brackets) rule. Setting this to `false` will have no effect for whitespace-sensitive tags (inline elements) when there's no whitespace between the `>` of the start tag and the inner content, or when there's no whitespace after the `>` of the end tag. You can read more about HTML whitespace sensitivity [here](https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting). You can adjust whitespace sensitivity through [this setting](https://prettier.io/docs/en/options.html#html-whitespace-sensitivity).\n\nExample:\n\n<!-- prettier-ignore -->\n```html\n<!-- before formatting -->\n<span><div>foo</div><span>bar</span></span>\n<div pretend break>content</div>\n\n<!-- after formatting, svelteBracketNewLine true -->\n<span\n    ><div>foo</div>\n    <span>bar</span></span\n>\n<div\n     pretend\n     break\n>\n    content\n</div>\n\n<!-- after formatting, svelteBracketNewLine false -->\n<span\n    ><div>foo</div>\n    <span>bar</span></span>\n<div\n     pretend\n     break>\n    content\n</div>\n```\n\n| Default | CLI Override                       | API Override                   |\n| ------- | ---------------------------------- | ------------------------------ |\n| `true`  | `--svelte-bracket-new-line <bool>` | `svelteBracketNewLine: <bool>` |\n\n### Svelte Indent Script And Style\n\nWhether or not to indent the code inside `<script>` and `<style>` tags in Svelte files. This saves an indentation level, but might break code folding in your editor.\n\n| Default | CLI Override                              | API Override                         |\n| ------- | ----------------------------------------- | ------------------------------------ |\n| `true`  | `--svelte-indent-script-and-style <bool>` | `svelteIndentScriptAndStyle: <bool>` |\n\n### `.prettierrc` example\n\n```json\n{\n    \"svelteSortOrder\": \"options-styles-scripts-markup\",\n    \"svelteBracketNewLine\": false,\n    \"svelteAllowShorthand\": false,\n    \"svelteIndentScriptAndStyle\": false\n}\n```\n\n## Usage with Tailwind Prettier Plugin\n\n-   VS Code Extension: Use it as the default formatter for Svelte files\n-   Prettier Plugin: Load the Tailwind plugin in the end - [Tailwind docs](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins)\n\n```jsonc\n// .prettierrc\n{\n    // ..\n    \"plugins\": [\n        \"prettier-plugin-svelte\",\n        \"prettier-plugin-tailwindcss\" // MUST come last\n    ]\n}\n```\n\nSince we are using configuration overrides to handle svelte files, you might also have to configure the [prettier.documentselectors](https://github.com/prettier/prettier-vscode#prettierdocumentselectors) in your VS Code `settings.json`, to tell Prettier extension to handle svelte files, like this:\n\n```jsonc\n// settings.json\n{\n    // ..\n    \"prettier.documentSelectors\": [\"**/*.svelte\"]\n}\n```\n\n## Usage in the browser\n\nUsage in the browser is semi-supported. You can import the plugin from `prettier-plugin-svelte/browser` to get a version that depends on `prettier/standalone` and therefore doesn't use any node APIs. What isn't supported in a good way yet is using this without a build step - you still need a bundler like Vite to build everything together as one self-contained package in advance.\n\n## Migration\n\n> For migration to `prettier-plugin-svelte@3` [see here](https://github.com/sveltejs/prettier-plugin-svelte/tree/version-3?tab=readme-ov-file#migration).\n\nUpgrade to Svelte 5 before upgrading to `prettier-plugin-svelte@4`, as it doesn't support older Svelte versions.\n\n`svelteStrictMode` option has been removed. Attributes are now never quoted, because this will mean \"stringify this attribute value\" in a future Svelte version.\n\n## FAQ\n\n### Why is the closing or opening tag (`>` or `<`) hugging the inner tag or text?\n\nIf you are wondering why this code\n\n<!-- prettier-ignore -->\n```html\n<span><span>assume very long text</span></span>\n```\n\nbecomes this\n\n<!-- prettier-ignore -->\n```html\n<span\n      ><span>assume very long text</span\n    ></span\n>\n```\n\nit's because of whitespace sensitivity. For inline elements (`span`, `a`, etc) it makes a difference when rendered if there's a space (or newline) between them. Since we don't know if your slot inside your Svelte component is surrounded by inline elements, Svelte components are treated as such, too. You can adjust this whitespace sensitivity through [this setting](https://prettier.io/docs/en/options.html#html-whitespace-sensitivity). You can read more about HTML whitespace sensitivity [here](https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting).\n","readmeFilename":"README.md"}