Installations
npm install @dylanvann/prettier-plugin-svelte
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.2.0
NPM Version
6.14.5
Score
70.2
Supply Chain
98.1
Quality
75.2
Maintenance
50
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (64.61%)
HTML (34.44%)
JavaScript (0.95%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
sveltejs
Download Statistics
Total Downloads
488
Last Day
1
Last Week
2
Last Month
9
Last Year
85
GitHub Statistics
MIT License
757 Stars
348 Commits
98 Forks
14 Watchers
5 Branches
44 Contributors
Updated on Feb 16, 2025
Bundle Size
12.06 kB
Minified
4.50 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.1
Package Id
@dylanvann/prettier-plugin-svelte@1.1.1
Unpacked Size
110.47 kB
Size
26.29 kB
File Count
6
NPM Version
6.14.5
Node Version
14.2.0
Total Downloads
Cumulative downloads
Total Downloads
488
Last Day
0%
1
Compared to previous day
Last Week
100%
2
Compared to previous week
Last Month
28.6%
9
Compared to previous month
Last Year
-23.4%
85
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Prettier for Svelte 3 components
Format your svelte components using prettier.
Features
- Format your html, css, and javascript using prettier
- Format Svelte syntax, e.g. each loops, if statements, await blocks, etc.
- Format the javascript expressions embedded in the svelte syntax
- e.g. expressions inside of
{}
, event bindingson:click=""
, and more
- e.g. expressions inside of
How to use in VS Code and Atom
This plugin comes with Svelte for VS Code and Svelte for Atom so just install extension for your favorite editor and enjoy.
Configure for VS Code and Atom
Configurations are optional
Make .prettierrc
file in your project directory (Read more about prettier config files here)
and add your preferred configuration options:
-
svelteSortOrder
- Default:
scripts-styles-markup
- Sort order for scripts, styles, and markup.
- Default:
-
svelteStrictMode
- Default:
false
- More strict HTML syntax: self-closed tags, quotes in attributes.
- Default:
-
svelteAllowShorthand
- Default:
true
- Option to enable/disable component attribute shorthand if attribute name and expression are same.
- Default:
-
svelteBracketNewLine
- Default:
false
- Put the
>
of a multiline element on a new line (svelte equivalent of jsxBracketSameLine rule)
For example:
1<script> 2 export let value; 3</script> 4 5<!-- allowShorthand: true --> 6<input type="text" {value}> 7 8<!-- allowShorthand: false --> 9<input type="text" value={value}> 10
- Default:
.prettierrc
example
1{ 2 "svelteSortOrder" : "styles-scripts-markup", 3 "svelteStrictMode": true, 4 "svelteBracketNewLine": true, 5 "svelteAllowShorthand": false 6}
How to install manually
1npm i --save-dev prettier-plugin-svelte prettier
How to use (CLI)
Install prettier-plugin-svelte as a dev dependency in your project.
Then format your code using prettier cli. You may need to add --plugin-search-dir=.
prettier --write --plugin-search-dir=. ./**/*.html
Options (CLI)
svelte-sort-order
Sort order for scripts, styles, and markup. Defaults to scripts-styles-markup
.
prettier --write --svelte-sort-order scripts-markup-styles ./**/*.svelte
svelte-strict-mode
Enable more strict syntax for HTML. Defaults to false
.
Main difference in strict mode:
- Not all tags are self closing
- Expressions in attributes are wrapped by double quotes

No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
4 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
Reason
1 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/sveltejs/prettier-plugin-svelte/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/sveltejs/prettier-plugin-svelte/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/sveltejs/prettier-plugin-svelte/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/sveltejs/prettier-plugin-svelte/ci.yml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
Found 7/29 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Score
3.9
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More