mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
Pretter svelte-mode (#178)
Adds support for `svelte-mode` using prettier. Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This commit is contained in:
parent
782db66457
commit
43ffed7890
5 changed files with 34 additions and 0 deletions
|
@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog].
|
The format is based on [Keep a Changelog].
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
### Enhancements
|
||||||
|
* Prettier is now enabled in `svelte-mode`.
|
||||||
### Bugs fixed
|
### Bugs fixed
|
||||||
* `ktlint` would emit log messages into its stdout when formatting,
|
* `ktlint` would emit log messages into its stdout when formatting,
|
||||||
and these would get spliced into the source file. This has been fixed
|
and these would get spliced into the source file. This has been fixed
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
. (npx "prettier" "--stdin-filepath" filepath "--parser=ruby"))
|
. (npx "prettier" "--stdin-filepath" filepath "--parser=ruby"))
|
||||||
(prettier-scss
|
(prettier-scss
|
||||||
. (npx "prettier" "--stdin-filepath" filepath "--parser=scss"))
|
. (npx "prettier" "--stdin-filepath" filepath "--parser=scss"))
|
||||||
|
(prettier-svelte
|
||||||
|
. (npx "prettier" "--stdin-filepath" filepath "--parser=svelte"))
|
||||||
(prettier-typescript
|
(prettier-typescript
|
||||||
. (npx "prettier" "--stdin-filepath" filepath "--parser=typescript"))
|
. (npx "prettier" "--stdin-filepath" filepath "--parser=typescript"))
|
||||||
(prettier-yaml
|
(prettier-yaml
|
||||||
|
@ -178,6 +180,7 @@ rather than using this system."
|
||||||
(rust-mode . rustfmt)
|
(rust-mode . rustfmt)
|
||||||
(rust-ts-mode . rustfmt)
|
(rust-ts-mode . rustfmt)
|
||||||
(scss-mode . prettier-scss)
|
(scss-mode . prettier-scss)
|
||||||
|
(svelte-mode . prettier-svelte)
|
||||||
(terraform-mode . terraform)
|
(terraform-mode . terraform)
|
||||||
(TeX-latex-mode . latexindent)
|
(TeX-latex-mode . latexindent)
|
||||||
(TeX-mode . latexindent)
|
(TeX-mode . latexindent)
|
||||||
|
|
1
test/formatters/installers/prettier-svelte.bash
Normal file
1
test/formatters/installers/prettier-svelte.bash
Normal file
|
@ -0,0 +1 @@
|
||||||
|
npm install -g prettier-plugin-svelte prettier
|
9
test/formatters/samplecode/prettier-svelte/in.svelte
Normal file
9
test/formatters/samplecode/prettier-svelte/in.svelte
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<script> let attrName = "myattr"; let title = "title"; const myFunc = () => {title = "updated title";}; </script>
|
||||||
|
<div class="foo">
|
||||||
|
<ul class={myattr}>
|
||||||
|
<li><a href="/">Home</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<style>
|
||||||
|
.foo { background: #ababab; }
|
||||||
|
</style>
|
19
test/formatters/samplecode/prettier-svelte/out.svelte
Normal file
19
test/formatters/samplecode/prettier-svelte/out.svelte
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<script>
|
||||||
|
let attrName = "myattr";
|
||||||
|
let title = "title";
|
||||||
|
const myFunc = () => {
|
||||||
|
title = "updated title";
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="foo">
|
||||||
|
<ul class={myattr}>
|
||||||
|
<li><a href="/">Home</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.foo {
|
||||||
|
background: #ababab;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Add table
Reference in a new issue