├── .prettierignore ├── src ├── modules.d.ts ├── lib │ ├── getText.ts │ ├── elements.ts │ ├── extractAttributes.ts │ └── snipTagContent.ts ├── base64-string.ts ├── print │ ├── helpers.ts │ ├── doc-helpers.ts │ └── nodes.ts ├── index.ts └── options.ts ├── test ├── printer │ ├── samples │ │ ├── debug-tag.html │ │ ├── doctype.html │ │ ├── comment.html │ │ ├── if-inline.html │ │ ├── action.html │ │ ├── attribute.html │ │ ├── debug-tag-with-var.html │ │ ├── element.html │ │ ├── spread.html │ │ ├── unicode-element.html │ │ ├── attribute-shorthand.html │ │ ├── binding-shorthand.html │ │ ├── binding.html │ │ ├── class-shorthand.html │ │ ├── debug-tag-with-vars.html │ │ ├── pre-element.html │ │ ├── unicode-mustache.html │ │ ├── class.html │ │ ├── component.html │ │ ├── element-with-text.html │ │ ├── if-inline-else.html │ │ ├── transition-in.html │ │ ├── attribute-multiple.html │ │ ├── element-with-mustache.html │ │ ├── event-handler.html │ │ ├── if-block.html │ │ ├── transition-out.html │ │ ├── attribute-bracket-new-line.html │ │ ├── attribute-bracket-no-new-line.html │ │ ├── attribute-bracket-same-line.html │ │ ├── each-inline.html │ │ ├── element-with-mustache-no-space.html │ │ ├── if-inline-elseif.html │ │ ├── require-pragma-missing.html │ │ ├── self-closing-tags-lenient.html │ │ ├── text-html-entities.html │ │ ├── transition-in-local.html │ │ ├── transition.html │ │ ├── action-with-expression.html │ │ ├── attribute-static-boolean.html │ │ ├── element-siblings.html │ │ ├── element-with-multi-mustache.html │ │ ├── s-after-style-tag.html │ │ ├── script-inside-comment.html │ │ ├── single-quote.options.json │ │ ├── svelte-body-element.html │ │ ├── svelte-options-element.html │ │ ├── svelte-window-element.html │ │ ├── transition-out-local.html │ │ ├── attribute-dynamic.html │ │ ├── each-inline-keyed.html │ │ ├── element-with-multi-mustache-no-space.html │ │ ├── style-inside-comment.html │ │ ├── svelte-document-element.html │ │ ├── transition-local.html │ │ ├── each-inline-indexed.html │ │ ├── element-with-children-bracket-new-line.html │ │ ├── event-with-modifier.html │ │ ├── insert-pragma-present.html │ │ ├── insert-pragma-present.options.json │ │ ├── raw-mustaches.html │ │ ├── require-pragma-missing.options.json │ │ ├── script-only.html │ │ ├── sort-order-none.options.json │ │ ├── sort-order-none2.options.json │ │ ├── svelte-component-element.html │ │ ├── allow-shorthand-true.options.json │ │ ├── each-block.html │ │ ├── element-with-children-bracket-no-new-line.html │ │ ├── element-with-element.html │ │ ├── if-inline-elseif-else.html │ │ ├── svelte-element-static-tag.html │ │ ├── template-empty-with-url.html │ │ ├── allow-shorthand-false.options.json │ │ ├── attribute-bracket-same-line.options.json │ │ ├── each-inline-else.html │ │ ├── element-siblings-spaced.html │ │ ├── event-with-modifiers.html │ │ ├── attribute-bracket-no-new-line.options.json │ │ ├── each-block-keyed.html │ │ ├── element-with-attributes-and-mustache.html │ │ ├── element-with-element-mustache.html │ │ ├── empty-elements-no-newline.options.json │ │ ├── indent-script-and-style.options.json │ │ ├── single-attribute-per-line.options.json │ │ ├── await-block-with-only-pending.html │ │ ├── await-inline-without-catch.html │ │ ├── each-block-indexed.html │ │ ├── element-with-class-and-comment-inside.html │ │ ├── event-handler-with-expression.html │ │ ├── if-block-else.html │ │ ├── let-shorthand.html │ │ ├── let.html │ │ ├── svelte-self-element.html │ │ ├── animation.html │ │ ├── attribute-several-bracket-no-new-line.options.json │ │ ├── await-catch-without-pending.html │ │ ├── await-inline-without-pending.html │ │ ├── s-after-style-tag.options.json │ │ ├── script.html │ │ ├── unicode-script.html │ │ ├── allow-shorthand-true.html │ │ ├── element-many-attributes-bracket-no-new-line.options.json │ │ ├── element-with-children-bracket-no-new-line.options.json │ │ ├── script-inside-element.html │ │ ├── style-unclosed-inside-script.html │ │ ├── style.html │ │ ├── typescript-call-generic-function.html │ │ ├── await-inline-no-args.html │ │ ├── element-with-element-text-mustache.html │ │ ├── script-style-script-snipping.options.json │ │ ├── style-scripts-snipping-spans.options.json │ │ ├── comment-at-end.html │ │ ├── comments-above-html-block.html │ │ ├── style-inside-script.html │ │ ├── transition-with-expression.html │ │ ├── await-block-without-pending.html │ │ ├── await-inline-with-catch-without-pending.html │ │ ├── each-block-else.html │ │ ├── sort-order-markup-options-scripts-styles.options.json │ │ ├── sort-order-markup-options-styles-scripts.options.json │ │ ├── sort-order-markup-scripts-options-styles.options.json │ │ ├── sort-order-markup-scripts-styles-options.options.json │ │ ├── sort-order-markup-styles-options-scripts.options.json │ │ ├── sort-order-markup-styles-scripts-options.options.json │ │ ├── sort-order-options-markup-scripts-styles.options.json │ │ ├── sort-order-options-markup-styles-scripts.options.json │ │ ├── sort-order-options-scripts-styles-markup.options.json │ │ ├── sort-order-options-styles-markup-scripts.options.json │ │ ├── sort-order-options-styles-scripts-markup.options.json │ │ ├── sort-order-scripts-options-styles-markup.options.json │ │ ├── sort-order-scripts-styles-markup-options.options.json │ │ ├── sort-order-scripts-styles-options-markup.options.json │ │ ├── sort-order-styles-markup-options-scripts.options.json │ │ ├── sort-order-styles-markup-scripts-options.options.json │ │ ├── sort-order-styles-options-markup-scripts.options.json │ │ ├── sort-order-styles-options-scripts-markup.options.json │ │ ├── sort-order-styles-scripts-markup-options.options.json │ │ ├── sort-order-styles-scripts-options-markup.options.json │ │ ├── svelte-head-element.html │ │ ├── unicode-style.html │ │ ├── prettier-ignore-script.html │ │ ├── if-block-elseif.html │ │ ├── style-with-attributes.html │ │ ├── script-type-typescript.html │ │ ├── single-attribute-per-line-bracket-no-new-line.options.json │ │ ├── style-inside-element.html │ │ ├── transition-with-expression-local.html │ │ ├── animation-with-expression.html │ │ ├── if-block-without-whitespace.html │ │ ├── script-lang-typescript.html │ │ ├── jsdoc-parens-in-script.html │ │ ├── prettier-ignore-nested.html │ │ ├── toplevel-blocks.html │ │ ├── toplevel-blocks2.html │ │ ├── await-block-without-catch.html │ │ ├── each-block-else-with-nested-if-inline.html │ │ ├── element-with-several-attributes-and-mustache.html │ │ ├── event-handler-comments.html │ │ ├── await-inline.html │ │ ├── style-lang-less.html │ │ ├── style-lang-scss.html │ │ ├── const.html │ │ ├── style-type-less.html │ │ ├── style-type-scss.html │ │ ├── each-block-destructured.html │ │ ├── prettier-ignore-style.html │ │ ├── await-block-with-catch-without-pending.html │ │ ├── each-block-destructured-default-value.html │ │ ├── each-block-else-with-nested-if-inline-else.html │ │ ├── indent-script-and-style.html │ │ ├── await-block-no-args.html │ │ ├── each-block-else-with-nested-if-block.html │ │ ├── if-block-elseif-else.html │ │ ├── script-with-html-comment-and-style.html │ │ ├── key-block.html │ │ ├── await-block.html │ │ ├── each-block-else-with-nested-if-inline-elseif.html │ │ ├── script-and-style.html │ │ ├── inline-element-single-text.html │ │ ├── script-and-module.html │ │ ├── pre-element-inside-other-element.html │ │ ├── pre-element-with-code-element.html │ │ ├── attribute-several.html │ │ ├── attributes-nested-quotes.html │ │ ├── component-style-script-tagname.html │ │ ├── svelte-fragment-element.html │ │ ├── comments-multiple-above-blocks.html │ │ ├── svelte-head-script-content.html │ │ ├── script-tag-generics.html │ │ ├── attribute-several-bracket-new-line.html │ │ ├── attribute-several-bracket-no-new-line.html │ │ ├── hug-content-edge-cases.html │ │ ├── script-style-inside-element-comment.html │ │ ├── unsupported-language.html │ │ ├── each-block-else-with-nested-if-inline-elseif-else.html │ │ ├── nested-destructuring.html │ │ ├── typescript-template.html.skip │ │ ├── await-then-destruct-array.html │ │ ├── each-block-else-with-nested-if-block-else.html │ │ ├── sort-order-markup-options-scripts-styles.html │ │ ├── sort-order-markup-options-styles-scripts.html │ │ ├── sort-order-markup-scripts-options-styles.html │ │ ├── sort-order-markup-scripts-styles-options.html │ │ ├── sort-order-markup-styles-options-scripts.html │ │ ├── sort-order-markup-styles-scripts-options.html │ │ ├── sort-order-options-markup-scripts-styles.html │ │ ├── sort-order-options-markup-styles-scripts.html │ │ ├── sort-order-options-scripts-styles-markup.html │ │ ├── sort-order-options-styles-markup-scripts.html │ │ ├── sort-order-options-styles-scripts-markup.html │ │ ├── sort-order-scripts-options-styles-markup.html │ │ ├── sort-order-scripts-styles-markup-options.html │ │ ├── sort-order-scripts-styles-options-markup.html │ │ ├── sort-order-styles-markup-options-scripts.html │ │ ├── sort-order-styles-markup-scripts-options.html │ │ ├── sort-order-styles-options-markup-scripts.html │ │ ├── sort-order-styles-options-scripts-markup.html │ │ ├── sort-order-styles-scripts-markup-options.html │ │ ├── sort-order-styles-scripts-options-markup.html │ │ ├── element-with-text-and-inline-element.html │ │ ├── each-block-else-with-nested-if-block-elseif.html │ │ ├── allow-shorthand-false.html │ │ ├── style-script-commented-out.html │ │ ├── each-block-else-with-nested-if-block-elseif-else.html │ │ ├── inline-blocks-nested.html │ │ ├── snippet-ts.html.skip │ │ ├── template-pug.html │ │ ├── await-then-destruct-object.html │ │ ├── prettier-ignore-range.html │ │ ├── await-then-destruct-object-reassignment.html │ │ ├── script-style-script-snipping.html │ │ ├── script-attributes-multiline.html │ │ ├── svelte-element.html │ │ ├── sort-order-none.html │ │ ├── style-scripts-snipping-spans.html │ │ ├── sort-order-none2.html │ │ ├── single-quote.html │ │ ├── attributes-long-text-with-mustache.html │ │ ├── self-closing-tags.html │ │ ├── element-many-attributes-bracket-no-new-line.html │ │ ├── no-tag-snippings.html │ │ ├── typescript.html │ │ ├── element-many-attributes-bracket-new-line.html │ │ ├── typescript-without-lang-attr.html │ │ ├── empty-elements.html │ │ ├── empty-elements-no-newline.html │ │ ├── long-control-blocks-dont-break.html │ │ ├── snippet.html.skip │ │ ├── style-directive.html │ │ ├── await-then-destruct-default.html │ │ ├── markdown.md │ │ ├── await-then-destruct-rest.html │ │ ├── single-attribute-per-line-bracket-no-new-line.html │ │ └── single-attribute-per-line.html │ └── index.ts └── formatting │ ├── samples │ ├── empty-element │ │ ├── input.html │ │ └── output.html │ ├── empty-element-whitespace │ │ ├── input.html │ │ └── output.html │ ├── trim-leading-whitespace │ │ ├── output.html │ │ └── input.html │ ├── trim-line-breaks-text │ │ ├── output.html │ │ └── input.html │ ├── trim-tailing-whitespace │ │ ├── output.html │ │ └── input.html │ ├── collapse-attribute-shortand │ │ ├── input.html │ │ └── output.html │ ├── collapse-bind-shorthand │ │ ├── output.html │ │ └── input.html │ ├── collapse-class-shorthand │ │ ├── output.html │ │ └── input.html │ ├── insert-pragma │ │ ├── input.html │ │ ├── options.json │ │ └── output.html │ ├── child-text-leading-whitespace │ │ ├── output.html │ │ └── input.html │ ├── child-text-tailing-whitespace │ │ ├── output.html │ │ └── input.html │ ├── collapse-intra-text-whitespace │ │ ├── output.html │ │ └── input.html │ ├── syntax-error │ │ ├── options.json │ │ ├── output.html │ │ └── input.html │ ├── attribute-add-quotes │ │ ├── input.html │ │ └── output.html │ ├── collapse-intra-mustache-whitespace │ │ ├── input.html │ │ └── output.html │ ├── require-pragma-present │ │ ├── options.json │ │ ├── output.html │ │ └── input.html │ ├── allow-shorthand-false │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── attributes-no-newline │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── attributes-bracket-same-line │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── block-element-with-children-no-ws │ │ ├── input.html │ │ └── output.html │ ├── inline-element-with-children-no-ws │ │ ├── input.html │ │ └── output.html │ ├── single-attribute-per-line │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── attribute-convert-single-quotes │ │ ├── input.html │ │ └── output.html │ ├── collapse-let-shorthand │ │ ├── output.html │ │ └── input.html │ ├── no-html-whitespace-outside-inline-element │ │ ├── input.html │ │ └── output.html │ ├── component-ignore-whitespace │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── inline-element-break-long-nonewline │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── script-only-extra-whitespace │ │ ├── output.html │ │ └── input.html │ ├── trim-line-breaks-elements │ │ ├── output.html │ │ └── input.html │ ├── all-elements-ignore-whitespace │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── all-elements-strict-whitespace │ │ ├── options.json │ │ ├── input.html │ │ └── output.html │ ├── trim-whitespace-after-script │ │ ├── output.html │ │ └── input.html │ ├── trim-whitespace-after-style │ │ ├── options.json │ │ ├── output.html │ │ └── input.html │ ├── block-element-break-subblocks │ │ ├── input.html │ │ └── output.html │ ├── inlineblock-element-break-subblocks │ │ ├── input.html │ │ └── output.html │ ├── scripts-styles-empty-handling │ │ ├── input.html │ │ └── output.html │ ├── wrap-element-attributes-and-children │ │ ├── input.html │ │ └── output.html │ ├── inline-element-with-hardline │ │ ├── output.html │ │ └── input.html │ ├── no-html-whitespace-inside-inline-element │ │ ├── input.html │ │ └── output.html │ ├── attribute-wrap-several │ │ ├── input.html │ │ └── output.html │ ├── block-element-break-long │ │ ├── input.html │ │ └── output.html │ ├── move-options-to-top │ │ ├── input.html │ │ └── output.html │ ├── block-element-with-children-ws │ │ ├── output.html │ │ └── input.html │ ├── block-element-break-long-whitespace │ │ ├── input.html │ │ └── output.html │ ├── style-directive │ │ ├── output.html │ │ └── input.html │ ├── whitespace-between-tags-and-text │ │ ├── output.html │ │ └── input.html │ ├── block-element-break-children │ │ ├── input.html │ │ └── output.html │ ├── inline-element-break-children │ │ ├── input.html │ │ └── output.html │ ├── inline-element-break-long-whitespace │ │ ├── input.html │ │ └── output.html │ ├── const │ │ ├── input.html │ │ └── output.html │ ├── top-level-comments │ │ ├── input.html │ │ └── output.html │ ├── attributes-without-quotes │ │ ├── input.html │ │ └── output.html │ ├── prettier-ignore-range-wrong │ │ ├── output.html │ │ └── input.html │ ├── inline-element-with-children-ws │ │ ├── input.html │ │ └── output.html │ ├── each-await-block-destructuring │ │ ├── input.html │ │ └── output.html │ ├── component-treated-as-inline-element │ │ ├── input.html │ │ └── output.html │ ├── prettier-ignore-range-2 │ │ ├── output.html │ │ └── input.html │ ├── prettier-ignore │ │ ├── input.html │ │ └── output.html │ ├── do-not-add-whitespace-between-inline-elements │ │ ├── input.html │ │ └── output.html │ ├── prettier-ignore-range-1 │ │ ├── output.html │ │ └── input.html │ ├── attribute-shorthand │ │ ├── output.html │ │ └── input.html │ ├── attribute-with-linebreaks │ │ ├── input.html │ │ └── output.html │ ├── svelte-if-block-break │ │ ├── input.html │ │ └── output.html │ ├── svelte-each-block-break │ │ ├── input.html │ │ └── output.html │ ├── pre-mustache │ │ ├── input.html │ │ └── output.html │ ├── svelte-key-block-break │ │ ├── input.html │ │ └── output.html │ ├── attributes-newline │ │ ├── input.html │ │ └── output.html │ ├── script-style-tags-multiple-nested │ │ ├── input.html │ │ └── output.html │ ├── prettier-ignore-ranges-and-lines │ │ ├── output.html │ │ └── input.html │ ├── long-mustache-value │ │ ├── input.html │ │ └── output.html │ ├── svelte-await-block-break │ │ ├── input.html │ │ └── output.html │ ├── inline-element-break-long │ │ ├── input.html │ │ └── output.html │ ├── attributes-class │ │ ├── output.html │ │ └── input.html │ ├── attribute-remove-quotes │ │ ├── output.html │ │ └── input.html │ └── long-attribute-value │ │ ├── input.html │ │ └── output.html │ └── index.ts ├── .gitignore ├── ava.config.js ├── .prettierrc ├── tsconfig.json ├── wallaby.js ├── .github └── workflows │ └── ci.yml ├── LICENSE ├── index.d.ts ├── rollup.config.js ├── package.json └── README.md /.prettierignore: -------------------------------------------------------------------------------- 1 | test/**/*.html -------------------------------------------------------------------------------- /src/modules.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'svelte'; 2 | -------------------------------------------------------------------------------- /test/printer/samples/debug-tag.html: -------------------------------------------------------------------------------- 1 | {@debug} 2 | -------------------------------------------------------------------------------- /test/printer/samples/doctype.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/comment.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/if-inline.html: -------------------------------------------------------------------------------- 1 | {#if foo}bar{/if} 2 | -------------------------------------------------------------------------------- /test/printer/samples/action.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/debug-tag-with-var.html: -------------------------------------------------------------------------------- 1 | {@debug a} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | -------------------------------------------------------------------------------- /test/printer/samples/spread.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/unicode-element.html: -------------------------------------------------------------------------------- 1 |
Lønn
2 | -------------------------------------------------------------------------------- /test/formatting/samples/empty-element/input.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/empty-element/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-shorthand.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/binding-shorthand.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/binding.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/class-shorthand.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/debug-tag-with-vars.html: -------------------------------------------------------------------------------- 1 | {@debug a, b, c} 2 | -------------------------------------------------------------------------------- /test/printer/samples/pre-element.html: -------------------------------------------------------------------------------- 1 |
foo
2 | bar baz
3 | -------------------------------------------------------------------------------- /test/printer/samples/unicode-mustache.html: -------------------------------------------------------------------------------- 1 |
{"Lønn"}
2 | -------------------------------------------------------------------------------- /test/printer/samples/class.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-text.html: -------------------------------------------------------------------------------- 1 |
Hello, world!
2 | -------------------------------------------------------------------------------- /test/printer/samples/if-inline-else.html: -------------------------------------------------------------------------------- 1 | {#if foo}bar{:else}baz{/if} 2 | -------------------------------------------------------------------------------- /test/printer/samples/transition-in.html: -------------------------------------------------------------------------------- 1 |
fades in
2 | -------------------------------------------------------------------------------- /test/formatting/samples/empty-element-whitespace/input.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/empty-element-whitespace/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-leading-whitespace/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-line-breaks-text/output.html: -------------------------------------------------------------------------------- 1 | Hello, world ! 2 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-tailing-whitespace/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-multiple.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-mustache.html: -------------------------------------------------------------------------------- 1 |

hello {name}!

2 | -------------------------------------------------------------------------------- /test/printer/samples/event-handler.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/if-block.html: -------------------------------------------------------------------------------- 1 | {#if foo} 2 |

foo

3 | {/if} 4 | -------------------------------------------------------------------------------- /test/printer/samples/transition-out.html: -------------------------------------------------------------------------------- 1 |
fades out
2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-bracket-new-line.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-bracket-no-new-line.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-bracket-same-line.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/each-inline.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal}{animal}{/each} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-mustache-no-space.html: -------------------------------------------------------------------------------- 1 |

hello_{name}!

2 | -------------------------------------------------------------------------------- /test/printer/samples/if-inline-elseif.html: -------------------------------------------------------------------------------- 1 | {#if foo}bar{:else if baz}qux{/if} 2 | -------------------------------------------------------------------------------- /test/printer/samples/require-pragma-missing.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | nope 5 |

-------------------------------------------------------------------------------- /test/printer/samples/self-closing-tags-lenient.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/printer/samples/text-html-entities.html: -------------------------------------------------------------------------------- 1 | & 2 | -------------------------------------------------------------------------------- /test/printer/samples/transition-in-local.html: -------------------------------------------------------------------------------- 1 |
fades in
2 | -------------------------------------------------------------------------------- /test/printer/samples/transition.html: -------------------------------------------------------------------------------- 1 |

fades in and out

2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-attribute-shortand/input.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-attribute-shortand/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-bind-shorthand/output.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-class-shorthand/output.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/insert-pragma/input.html: -------------------------------------------------------------------------------- 1 |

2 | format 3 | me 4 |

-------------------------------------------------------------------------------- /test/formatting/samples/trim-leading-whitespace/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-tailing-whitespace/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/action-with-expression.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-static-boolean.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-siblings.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-multi-mustache.html: -------------------------------------------------------------------------------- 1 |

{greeting} {name}!

2 | -------------------------------------------------------------------------------- /test/printer/samples/s-after-style-tag.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | sssssweet 5 | -------------------------------------------------------------------------------- /test/printer/samples/script-inside-comment.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/single-quote.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-body-element.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-options-element.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-window-element.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/transition-out-local.html: -------------------------------------------------------------------------------- 1 |
fades out
2 | -------------------------------------------------------------------------------- /test/formatting/samples/child-text-leading-whitespace/output.html: -------------------------------------------------------------------------------- 1 |

Hello, world!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/child-text-tailing-whitespace/output.html: -------------------------------------------------------------------------------- 1 |

Hello, world!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-bind-shorthand/input.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-intra-text-whitespace/output.html: -------------------------------------------------------------------------------- 1 |

Hello, world!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/insert-pragma/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "insertPragma": true 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/insert-pragma/output.html: -------------------------------------------------------------------------------- 1 | 2 |

format me

3 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-dynamic.html: -------------------------------------------------------------------------------- 1 |
{color}
2 | -------------------------------------------------------------------------------- /test/printer/samples/each-inline-keyed.html: -------------------------------------------------------------------------------- 1 | {#each todos as todo (todo.id)}{todo}{/each} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-multi-mustache-no-space.html: -------------------------------------------------------------------------------- 1 |

{greeting}{name}!

2 | -------------------------------------------------------------------------------- /test/printer/samples/style-inside-comment.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-document-element.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/transition-local.html: -------------------------------------------------------------------------------- 1 |

fades in and out

2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode 3 | .history 4 | plugin.js 5 | plugin.js.map 6 | browser.js -------------------------------------------------------------------------------- /test/formatting/samples/collapse-class-shorthand/input.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-intra-text-whitespace/input.html: -------------------------------------------------------------------------------- 1 |

Hello, world!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/syntax-error/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "expectSyntaxErrors": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-inline-indexed.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal, i}{i}: {animal}{/each} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-children-bracket-new-line.html: -------------------------------------------------------------------------------- 1 |
Test
2 | -------------------------------------------------------------------------------- /test/printer/samples/event-with-modifier.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/printer/samples/insert-pragma-present.html: -------------------------------------------------------------------------------- 1 | 2 |

already formatted

3 | -------------------------------------------------------------------------------- /test/printer/samples/insert-pragma-present.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "insertPragma": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/raw-mustaches.html: -------------------------------------------------------------------------------- 1 |

2 | {@html raw1} 3 | {@html raw2} 4 |

5 | -------------------------------------------------------------------------------- /test/printer/samples/require-pragma-missing.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "requirePragma": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/script-only.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-none.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "none" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-none2.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "none" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-component-element.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-add-quotes/input.html: -------------------------------------------------------------------------------- 1 | Google 2 | -------------------------------------------------------------------------------- /test/formatting/samples/child-text-leading-whitespace/input.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | Hello, world!

4 | -------------------------------------------------------------------------------- /test/formatting/samples/child-text-tailing-whitespace/input.html: -------------------------------------------------------------------------------- 1 |

Hello, world! 2 | 3 |

4 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-intra-mustache-whitespace/input.html: -------------------------------------------------------------------------------- 1 |

{greeting} {name}!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-intra-mustache-whitespace/output.html: -------------------------------------------------------------------------------- 1 |

{greeting} {name}!

2 | -------------------------------------------------------------------------------- /test/formatting/samples/require-pragma-present/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "requirePragma": true 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/require-pragma-present/output.html: -------------------------------------------------------------------------------- 1 | 2 |

format me

3 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-line-breaks-text/input.html: -------------------------------------------------------------------------------- 1 | Hello, 2 | 3 | 4 | world 5 | 6 | 7 | ! 8 | -------------------------------------------------------------------------------- /test/printer/samples/allow-shorthand-true.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteAllowShorthand": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-block.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-children-bracket-no-new-line.html: -------------------------------------------------------------------------------- 1 |
Test
2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-element.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /test/printer/samples/if-inline-elseif-else.html: -------------------------------------------------------------------------------- 1 | {#if foo}bar{:else if baz}qux{:else}foobar{/if} 2 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-element-static-tag.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/template-empty-with-url.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/allow-shorthand-false/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteAllowShorthand": false 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-add-quotes/output.html: -------------------------------------------------------------------------------- 1 | Google 2 | -------------------------------------------------------------------------------- /test/formatting/samples/attributes-no-newline/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/allow-shorthand-false.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteAllowShorthand": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-bracket-same-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSameLine": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-inline-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal}{animal}{:else}no animals{/each} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-siblings-spaced.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | -------------------------------------------------------------------------------- /test/printer/samples/event-with-modifiers.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /test/formatting/samples/attributes-bracket-same-line/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSameLine": true 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-with-children-no-ws/input.html: -------------------------------------------------------------------------------- 1 |
Foo 2 | 3 |
-------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-children-no-ws/input.html: -------------------------------------------------------------------------------- 1 | Foo 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/formatting/samples/single-attribute-per-line/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleAttributePerLine": true 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-bracket-no-new-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-keyed.html: -------------------------------------------------------------------------------- 1 | {#each todos as todo (todo.id)} 2 |

{todo}

3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-attributes-and-mustache.html: -------------------------------------------------------------------------------- 1 | {linkText} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-element-mustache.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | {score} 4 |
5 | -------------------------------------------------------------------------------- /test/printer/samples/empty-elements-no-newline.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/indent-script-and-style.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteIndentScriptAndStyle": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/single-attribute-per-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleAttributePerLine": true 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-convert-single-quotes/input.html: -------------------------------------------------------------------------------- 1 | Google 2 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-convert-single-quotes/output.html: -------------------------------------------------------------------------------- 1 | Google 2 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-let-shorthand/output.html: -------------------------------------------------------------------------------- 1 | 2 |

{foo}

3 |
4 | -------------------------------------------------------------------------------- /test/formatting/samples/no-html-whitespace-outside-inline-element/input.html: -------------------------------------------------------------------------------- 1 |

"Bold Italic"

2 | -------------------------------------------------------------------------------- /test/formatting/samples/no-html-whitespace-outside-inline-element/output.html: -------------------------------------------------------------------------------- 1 |

"Bold Italic"

2 | -------------------------------------------------------------------------------- /test/formatting/samples/require-pragma-present/input.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | format 4 | me 5 |

-------------------------------------------------------------------------------- /test/printer/samples/await-block-with-only-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 |

loading...

3 | {/await} 4 | -------------------------------------------------------------------------------- /test/printer/samples/await-inline-without-catch.html: -------------------------------------------------------------------------------- 1 | {#await promise}loading{:then}the value is {value}{/await} 2 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-indexed.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal, i} 2 |

{i}: {animal}

3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-class-and-comment-inside.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /test/printer/samples/event-handler-with-expression.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/printer/samples/if-block-else.html: -------------------------------------------------------------------------------- 1 | {#if foo} 2 |

foo

3 | {:else} 4 |

not foo

5 | {/if} 6 | -------------------------------------------------------------------------------- /test/printer/samples/let-shorthand.html: -------------------------------------------------------------------------------- 1 | 2 |

Thing #{foo.id}: {foo.title}

3 |
4 | -------------------------------------------------------------------------------- /test/printer/samples/let.html: -------------------------------------------------------------------------------- 1 | 2 |

Thing #{id}: {title}

3 |
4 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-self-element.html: -------------------------------------------------------------------------------- 1 | {#if depth > 1} 2 | 3 | {/if} 4 | -------------------------------------------------------------------------------- /test/formatting/samples/collapse-let-shorthand/input.html: -------------------------------------------------------------------------------- 1 | 2 |

{foo}

3 |
4 | -------------------------------------------------------------------------------- /test/formatting/samples/component-ignore-whitespace/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "htmlWhitespaceSensitivity": "ignore" 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-break-long-nonewline/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/script-only-extra-whitespace/output.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-line-breaks-elements/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | -------------------------------------------------------------------------------- /test/printer/samples/animation.html: -------------------------------------------------------------------------------- 1 | {#each things as thing (thing)} 2 |
flips
3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-several-bracket-no-new-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/await-catch-without-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise catch theCatch}the value is {theCatch}{/await} 2 | -------------------------------------------------------------------------------- /test/printer/samples/await-inline-without-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise then theValue}the value is {theValue}{/await} 2 | -------------------------------------------------------------------------------- /test/printer/samples/s-after-style-tag.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-scripts-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/script.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |

Hello {name}!

6 | -------------------------------------------------------------------------------- /test/printer/samples/unicode-script.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
{word}
6 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-ignore-whitespace/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "htmlWhitespaceSensitivity": "ignore" 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-strict-whitespace/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "htmlWhitespaceSensitivity": "strict" 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-children-no-ws/output.html: -------------------------------------------------------------------------------- 1 | Foo 3 | 4 | 6 | -------------------------------------------------------------------------------- /test/printer/samples/allow-shorthand-true.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/element-many-attributes-bracket-no-new-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-children-bracket-no-new-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteBracketNewLine": false 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/script-inside-element.html: -------------------------------------------------------------------------------- 1 |
2 | 5 |
6 | -------------------------------------------------------------------------------- /test/printer/samples/style-unclosed-inside-script.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/printer/samples/style.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 8 | -------------------------------------------------------------------------------- /test/printer/samples/typescript-call-generic-function.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-with-children-no-ws/output.html: -------------------------------------------------------------------------------- 1 |
2 | Foo 3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-line-breaks-elements/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /test/printer/samples/await-inline-no-args.html: -------------------------------------------------------------------------------- 1 | {#await promise}loading{:then}the value is {value}{:catch}oops {error}{/await} 2 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-element-text-mustache.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Current score: [{score}] 4 |
5 | -------------------------------------------------------------------------------- /test/printer/samples/script-style-script-snipping.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-scripts-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/style-scripts-snipping-spans.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-scripts-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-whitespace-after-script/output.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-whitespace-after-style/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-scripts-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/comment-at-end.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | 6 | 7 | -------------------------------------------------------------------------------- /test/printer/samples/comments-above-html-block.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | -------------------------------------------------------------------------------- /test/printer/samples/style-inside-script.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/transition-with-expression.html: -------------------------------------------------------------------------------- 1 |

flies 200 pixels up, slowly

2 | -------------------------------------------------------------------------------- /test/printer/samples/await-block-without-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise then theValue} 2 |

the value is {theValue}

3 | {/await} 4 | -------------------------------------------------------------------------------- /test/printer/samples/await-inline-with-catch-without-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise then theValue}{theValue}{:catch error}{error}{/await} 2 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-subblocks/input.html: -------------------------------------------------------------------------------- 1 |
hi
hihi

hi

hihihi
-------------------------------------------------------------------------------- /test/formatting/samples/trim-whitespace-after-script/input.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 |

no animals

5 | {/each} 6 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-options-scripts-styles.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-options-scripts-styles" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-options-styles-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-options-styles-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-scripts-options-styles.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-scripts-options-styles" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-scripts-styles-options.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-scripts-styles-options" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-styles-options-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-styles-options-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-styles-scripts-options.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "markup-styles-scripts-options" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-markup-scripts-styles.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-markup-scripts-styles" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-markup-styles-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-markup-styles-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-scripts-styles-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-scripts-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-styles-markup-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-styles-markup-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-styles-scripts-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "options-styles-scripts-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-options-styles-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "scripts-options-styles-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-styles-markup-options.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "scripts-styles-markup-options" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-styles-options-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "scripts-styles-options-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-markup-options-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-markup-options-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-markup-scripts-options.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-markup-scripts-options" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-options-markup-scripts.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-options-markup-scripts" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-options-scripts-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-options-scripts-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-scripts-markup-options.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-scripts-markup-options" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-scripts-options-markup.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "svelteSortOrder": "styles-scripts-options-markup" 3 | } 4 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-head-element.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/unicode-style.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 8 | -------------------------------------------------------------------------------- /test/printer/samples/prettier-ignore-script.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |

Title

8 | -------------------------------------------------------------------------------- /test/formatting/samples/inlineblock-element-break-subblocks/input.html: -------------------------------------------------------------------------------- 1 |
hi
hihi

hi

hihihi
-------------------------------------------------------------------------------- /test/printer/samples/if-block-elseif.html: -------------------------------------------------------------------------------- 1 | {#if x > 10} 2 |

x is greater than 10

3 | {:else if x < 5} 4 |

x is less than 5

5 | {/if} 6 | -------------------------------------------------------------------------------- /test/printer/samples/style-with-attributes.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 8 | -------------------------------------------------------------------------------- /ava.config.js: -------------------------------------------------------------------------------- 1 | process.env.TS_NODE_TRANSPILE_ONLY = true; 2 | 3 | export default { 4 | extensions: ['ts'], 5 | require: ['ts-node/register'], 6 | }; 7 | -------------------------------------------------------------------------------- /test/printer/samples/script-type-typescript.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |

Hello {name}!

6 | -------------------------------------------------------------------------------- /test/printer/samples/single-attribute-per-line-bracket-no-new-line.options.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleAttributePerLine": true, 3 | "bracketSameLine": true 4 | } 5 | -------------------------------------------------------------------------------- /test/printer/samples/style-inside-element.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 | -------------------------------------------------------------------------------- /test/printer/samples/transition-with-expression-local.html: -------------------------------------------------------------------------------- 1 |

2 | flies 200 pixels up, slowly 3 |

4 | -------------------------------------------------------------------------------- /test/formatting/samples/scripts-styles-empty-handling/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /test/formatting/samples/scripts-styles-empty-handling/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /test/formatting/samples/wrap-element-attributes-and-children/input.html: -------------------------------------------------------------------------------- 1 | {linkText} 2 | -------------------------------------------------------------------------------- /test/printer/samples/animation-with-expression.html: -------------------------------------------------------------------------------- 1 | {#each things as thing (thing)} 2 |
{thing.name}
3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/if-block-without-whitespace.html: -------------------------------------------------------------------------------- 1 | {#each items as item} 2 | {item.name}{#if item.isNew}*{/if}{#if item.isUpdated}!{/if} 3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/script-lang-typescript.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |

Hello {name}!

6 | -------------------------------------------------------------------------------- /test/printer/samples/jsdoc-parens-in-script.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/printer/samples/prettier-ignore-nested.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | .doNotFormatMe 5 | d 6 | d 7 |
8 |
9 | -------------------------------------------------------------------------------- /test/printer/samples/toplevel-blocks.html: -------------------------------------------------------------------------------- 1 | 3 | 4 |
5 |
6 | 7 |
8 | 9 | 11 | -------------------------------------------------------------------------------- /test/printer/samples/toplevel-blocks2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | bla 5 | 6 | bla 7 | 8 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-hardline/output.html: -------------------------------------------------------------------------------- 1 | asd 2 | 3 | asdasd 4 | 5 | asd 6 | 7 | asdasd 8 | -------------------------------------------------------------------------------- /test/formatting/samples/no-html-whitespace-inside-inline-element/input.html: -------------------------------------------------------------------------------- 1 |

Apples, Orange, Bananas, Pineapples, Grapefruit, Kiwi

-------------------------------------------------------------------------------- /test/formatting/samples/syntax-error/output.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

This should be formatted anyway.

8 | -------------------------------------------------------------------------------- /test/printer/samples/await-block-without-catch.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 |

loading...

3 | {:then theValue} 4 |

the value is {theValue}

5 | {/await} 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": false, 3 | "printWidth": 100, 4 | "tabWidth": 4, 5 | "semi": true, 6 | "trailingComma": "all", 7 | "singleQuote": true 8 | } 9 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-wrap-several/input.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/formatting/samples/wrap-element-attributes-and-children/output.html: -------------------------------------------------------------------------------- 1 | {linkText} 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-inline.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"}no dogs{/if} 5 | {/each} 6 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-several-attributes-and-mustache.html: -------------------------------------------------------------------------------- 1 | {linkText} 4 | -------------------------------------------------------------------------------- /test/printer/samples/event-handler-comments.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /test/formatting/samples/allow-shorthand-false/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/formatting/samples/allow-shorthand-false/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-subblocks/output.html: -------------------------------------------------------------------------------- 1 |
2 |
hi
3 | hihi 4 |

hi

5 | hihihi 6 |
7 | -------------------------------------------------------------------------------- /test/formatting/samples/script-only-extra-whitespace/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/printer/samples/await-inline.html: -------------------------------------------------------------------------------- 1 | {#await promise}loading{:then value}{value}{:catch error}{error.message}{/await} 2 | 3 | {#await p} l {:then v}

{v}

{:catch e} {e.m} {/await} 4 | -------------------------------------------------------------------------------- /test/printer/samples/style-lang-less.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/style-lang-scss.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/const.html: -------------------------------------------------------------------------------- 1 | {#each [1, 2] as foo} 2 | {@const bar = foo} 3 | {foo}{bar} 4 | {/each} 5 | 6 | {#await aPromise then result} 7 | {@const bar = result} 8 | {/await} 9 | -------------------------------------------------------------------------------- /test/printer/samples/style-type-less.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/style-type-scss.html: -------------------------------------------------------------------------------- 1 |
foo
2 | 3 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-long/input.html: -------------------------------------------------------------------------------- 1 |
looooooooooong
looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong

hi

hi

2 | -------------------------------------------------------------------------------- /test/formatting/samples/inlineblock-element-break-subblocks/output.html: -------------------------------------------------------------------------------- 1 |
hi
3 | hihi 4 |

hi

5 | hihihi
7 | -------------------------------------------------------------------------------- /test/formatting/samples/move-options-to-top/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

hi

4 | 5 | 6 | 7 |

some stuff

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/move-options-to-top/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

hi

6 | 7 |

some stuff

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-destructured.html: -------------------------------------------------------------------------------- 1 | {#each animals as [key, value]} 2 |

{key}: {value}

3 | {/each} 4 | 5 | {#each animals as [, value]} 6 |

{value}

7 | {/each} 8 | -------------------------------------------------------------------------------- /test/printer/samples/prettier-ignore-style.html: -------------------------------------------------------------------------------- 1 | 3 | 4 |

Title

5 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-strict-whitespace/input.html: -------------------------------------------------------------------------------- 1 |
looooooooooong
looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong

hi

hi

2 | -------------------------------------------------------------------------------- /test/formatting/samples/no-html-whitespace-inside-inline-element/output.html: -------------------------------------------------------------------------------- 1 |

2 | Apples, Orange, Bananas, Pineapples, 3 | Grapefruit, Kiwi 4 |

5 | -------------------------------------------------------------------------------- /test/formatting/samples/syntax-error/input.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

8 | 9 | This should be formatted anyway. 10 | 11 |

-------------------------------------------------------------------------------- /test/printer/samples/await-block-with-catch-without-pending.html: -------------------------------------------------------------------------------- 1 | {#await thePromise then theValue} 2 |

the value is {theValue}

3 | {:catch} 4 |

oh no! {theError.message}

5 | {/await} 6 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-destructured-default-value.html: -------------------------------------------------------------------------------- 1 | {#each animals as { key, value = 1, arrayExpr = [{ a: true }], objectExpr = { a: true, b: [1] } }} 2 |

{key}: {value}

3 | {/each} 4 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-inline-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"}no dogs{:else}no animals{/if} 5 | {/each} 6 | -------------------------------------------------------------------------------- /test/printer/samples/indent-script-and-style.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 | 12 | -------------------------------------------------------------------------------- /test/printer/samples/await-block-no-args.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 |

loading...

3 | {:then} 4 |

the value is {theValue}

5 | {:catch} 6 |

oh no! {theError.message}

7 | {/await} 8 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-block.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"} 5 |

no dogs

6 | {/if} 7 | {/each} 8 | -------------------------------------------------------------------------------- /test/printer/samples/if-block-elseif-else.html: -------------------------------------------------------------------------------- 1 | {#if x > 10} 2 |

x is greater than 10

3 | {:else if x < 5} 4 |

x is less than 5

5 | {:else} 6 |

x is between 5 and 10

7 | {/if} 8 | -------------------------------------------------------------------------------- /test/printer/samples/script-with-html-comment-and-style.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-with-children-ws/output.html: -------------------------------------------------------------------------------- 1 |
2 | Foo 3 | 4 | 5 |
6 | 7 |
8 | Foo 9 | 10 | 11 | 12 |
13 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-hardline/input.html: -------------------------------------------------------------------------------- 1 | 2 | asd 4 | 5 | 6 | asdasd 8 | 9 | asd 10 | 11 | 12 | asdasd 13 | -------------------------------------------------------------------------------- /test/printer/samples/key-block.html: -------------------------------------------------------------------------------- 1 | {#key value} 2 |

hello

3 |

hello

4 | {/key} 5 | {#key $store} 6 |

hello

7 | {/key} 8 | {#key expr.obj} 9 |

hello

10 | {/key} 11 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-ignore-whitespace/input.html: -------------------------------------------------------------------------------- 1 | looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooonghihi 2 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-long-whitespace/input.html: -------------------------------------------------------------------------------- 1 |
looooooooooong
looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong

hi

hi

2 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-with-children-ws/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Foo 4 | 5 | 6 | 7 |
8 | 9 |
10 | Foo 11 | 12 | 13 | 14 | 15 |
-------------------------------------------------------------------------------- /test/formatting/samples/style-directive/output.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /test/printer/samples/await-block.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 |

loading...

3 | {:then theValue} 4 |

the value is {theValue}

5 | {:catch theError} 6 |

oh no! {theError.message}

7 | {/await} 8 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-inline-elseif.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"}no dogs{:else if type === "cat"}no cats{/if} 5 | {/each} 6 | -------------------------------------------------------------------------------- /test/printer/samples/script-and-style.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |

Hello {name}!

6 | 7 | 12 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-whitespace-after-style/output.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /test/formatting/samples/whitespace-between-tags-and-text/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Text 4 | 5 | 6 | Text 7 | 8 | 9 | 10 | Text 11 | 12 | 13 |
14 | -------------------------------------------------------------------------------- /test/printer/samples/inline-element-single-text.html: -------------------------------------------------------------------------------- 1 | hi 2 | hi 3 | hi 4 | hi 5 | {hi} 6 | {hi} 7 | {hi} 8 | {hi} 9 | -------------------------------------------------------------------------------- /test/printer/samples/script-and-module.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | 9 |

Hello {name}!

10 | -------------------------------------------------------------------------------- /test/formatting/samples/style-directive/input.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /test/printer/samples/pre-element-inside-other-element.html: -------------------------------------------------------------------------------- 1 |
2 |
foo
 3 | bar
 4 | 
 5 |     bold     
d
6 | 7 | 8 | 9 | bold
d
10 | 11 | baz
12 |
13 | -------------------------------------------------------------------------------- /test/printer/samples/pre-element-with-code-element.html: -------------------------------------------------------------------------------- 1 |
2 |     
3 |         const greeting = "Hello",
4 |             name = "World",
5 |             text = greeting + ", " + name + "!";
6 |     
7 | 
8 | -------------------------------------------------------------------------------- /test/formatting/samples/trim-whitespace-after-style/input.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | 13 |
14 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-several.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/attributes-nested-quotes.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | -------------------------------------------------------------------------------- /test/printer/samples/component-style-script-tagname.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-fragment-element.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

hi

4 |
5 |

hi

6 | -------------------------------------------------------------------------------- /test/printer/samples/comments-multiple-above-blocks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/printer/samples/svelte-head-script-content.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true 7 | }, 8 | "include": ["src/**/*", "index.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-strict-whitespace/output.html: -------------------------------------------------------------------------------- 1 |
looooooooooong
looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong

hi

hi

7 | -------------------------------------------------------------------------------- /test/formatting/samples/attribute-wrap-several/output.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/whitespace-between-tags-and-text/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Text 5 | 6 | 7 | Text 8 | 9 | 10 | 11 | 12 | Text 13 | 14 | 15 | 16 | 17 | 18 |
-------------------------------------------------------------------------------- /test/printer/samples/script-tag-generics.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
d
6 | 7 | 12 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-several-bracket-new-line.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/attribute-several-bracket-no-new-line.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/hug-content-edge-cases.html: -------------------------------------------------------------------------------- 1 | hi 3 | 4 | 5 | 6 | hithere 8 | -------------------------------------------------------------------------------- /test/printer/samples/script-style-inside-element-comment.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /test/printer/samples/unsupported-language.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-children/input.html: -------------------------------------------------------------------------------- 1 |
asd
asd
2 | 3 |
asd
asd
4 | 5 |
asd
asd
6 | 7 |
asd
asd
8 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-long/output.html: -------------------------------------------------------------------------------- 1 |
2 |
looooooooooong
3 | looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong 4 |
5 |

hi

6 |

hi

7 |
8 |
9 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-inline-elseif-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"} 5 | no dogs 6 | {:else if type === "cat"}no cats{:else}no animals{/if} 7 | {/each} 8 | -------------------------------------------------------------------------------- /test/printer/samples/nested-destructuring.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 |

loading...

3 | {:then { data: [theValue] }} 4 |

the value is {theValue}

5 | {:catch { data: [{ data: [theError] }] }} 6 |

oh no! {theError.message}

7 | {/await} 8 | -------------------------------------------------------------------------------- /test/printer/samples/typescript-template.html.skip: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/printer/samples/await-then-destruct-array.html: -------------------------------------------------------------------------------- 1 | {#await thePromise} 2 | loading... 3 | {:then [a, b]} 4 |

a: {a}

5 |

b: {b}

6 | {:catch [c, [d, e]]} 7 |

c: {c}

8 |

d: {d}

9 |

e: {e}

10 | {/await} 11 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-block-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"} 5 |

no dogs

6 | {:else} 7 |

no animals

8 | {/if} 9 | {/each} 10 | -------------------------------------------------------------------------------- /test/formatting/samples/block-element-break-long-whitespace/output.html: -------------------------------------------------------------------------------- 1 |
2 |
looooooooooong
3 | looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong 4 |
5 |

hi

6 |

hi

7 |
8 |
9 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-break-children/input.html: -------------------------------------------------------------------------------- 1 |
asd
asd
2 | 3 | asd
asd
4 | 5 |
asd
asd
6 | 7 | asd
asd
8 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-options-scripts-styles.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 4 | 5 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-options-styles-scripts.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-scripts-options-styles.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 6 | 7 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-scripts-styles-options.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-styles-options-scripts.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 8 | 9 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-markup-styles-scripts-options.html: -------------------------------------------------------------------------------- 1 |

Hello {name}!

2 | 3 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-markup-scripts-styles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello {name}!

4 | 5 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-markup-styles-scripts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello {name}!

4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-scripts-styles-markup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-styles-markup-scripts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 |

Hello {name}!

10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-options-styles-scripts-markup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-options-styles-markup.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-styles-markup-options.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 |

Hello {name}!

12 | 13 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-scripts-styles-options-markup.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-markup-options-scripts.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

Hello {name}!

8 | 9 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-markup-scripts-options.html: -------------------------------------------------------------------------------- 1 | 6 | 7 |

Hello {name}!

8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-options-markup-scripts.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 |

Hello {name}!

10 | 11 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-options-scripts-markup.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-scripts-markup-options.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 |

Hello {name}!

12 | 13 | 14 | -------------------------------------------------------------------------------- /test/printer/samples/sort-order-styles-scripts-options-markup.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 12 | 13 |

Hello {name}!

14 | -------------------------------------------------------------------------------- /test/printer/samples/element-with-text-and-inline-element.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | This is line A. 4 | This is B. len(A + B) > 80+ chars. len(b) lt; 80. 5 |

6 |

This is line A. This is B. len(A + B) < 80 chars.

7 |
8 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-block-elseif.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"} 5 |

no dogs

6 | {:else if type === "cat"} 7 |

no cats

8 | {/if} 9 | {/each} 10 | -------------------------------------------------------------------------------- /test/formatting/samples/all-elements-ignore-whitespace/output.html: -------------------------------------------------------------------------------- 1 | 2 | looooooooooong 3 | looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong 4 | 5 | hi 6 | hi 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/printer/samples/allow-shorthand-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-break-long-whitespace/input.html: -------------------------------------------------------------------------------- 1 | looooooooooong looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong hihi looooooooooonglooooooooooonglooooooooooonglooooooooooong -------------------------------------------------------------------------------- /test/formatting/samples/const/input.html: -------------------------------------------------------------------------------- 1 | {#each [1, 2] as foo} 2 | {@const bar = 3 | foo} 4 | {foo}{bar} 5 | {/each} 6 | 7 | {#await aPromise then result} 8 | {@const bar = result ? 'some super long text which will force the ternary to break' : 'etc etc'} 9 | {/await} 10 | -------------------------------------------------------------------------------- /test/formatting/samples/top-level-comments/input.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 |

Title

7 | 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/formatting/samples/top-level-comments/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |

Title

10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /test/formatting/samples/attributes-without-quotes/input.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 |

asd

7 |
8 | 9 |
10 | 11 | 14 | -------------------------------------------------------------------------------- /test/formatting/samples/prettier-ignore-range-wrong/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
no format madness here
5 | 6 |

no toplevel

7 | 8 | 9 |
10 | 11 |
We all need to adhere sadly
12 | -------------------------------------------------------------------------------- /test/formatting/samples/const/output.html: -------------------------------------------------------------------------------- 1 | {#each [1, 2] as foo} 2 | {@const bar = foo} 3 | {foo}{bar} 4 | {/each} 5 | 6 | {#await aPromise then result} 7 | {@const bar = result 8 | ? "some super long text which will force the ternary to break" 9 | : "etc etc"} 10 | {/await} 11 | -------------------------------------------------------------------------------- /test/printer/samples/style-script-commented-out.html: -------------------------------------------------------------------------------- 1 | 4 | 7 | 8 | 11 | 16 | -------------------------------------------------------------------------------- /wallaby.js: -------------------------------------------------------------------------------- 1 | module.exports = function (w) { 2 | return { 3 | files: ['src/**/*.ts', 'test/**/*.html'], 4 | tests: ['test/**/*.ts'], 5 | env: { 6 | type: 'node', 7 | runner: 'node', 8 | }, 9 | testFramework: 'ava', 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-children-ws/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Foo 4 | 5 | 6 | 7 | 8 | 9 | 10 | Foo 11 | 12 | 13 | 14 | 15 | 16 | 17 | Text -------------------------------------------------------------------------------- /test/formatting/samples/prettier-ignore-range-wrong/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
no format madness here
5 | 6 |

7 | no 8 | toplevel 9 |

10 | 11 | 12 |
13 | 14 |
We all need to adhere sadly
15 | -------------------------------------------------------------------------------- /test/formatting/samples/component-ignore-whitespace/input.html: -------------------------------------------------------------------------------- 1 |

buy!

2 | 3 |

buy me a!

4 | 5 |

buy me a coffee!

6 | -------------------------------------------------------------------------------- /test/formatting/samples/each-await-block-destructuring/input.html: -------------------------------------------------------------------------------- 1 | {#each arr as { a,b =''}} 2 | {a} 3 | {b} 4 | {/each} 5 | 6 | {#await promise then { a,b =''}} 7 | {a} 8 | {b} 9 | {/await} 10 | 11 | {#await promise} 12 | Loading 13 | {:then { a,b =''}} 14 | {a} 15 | {b} 16 | {/await} 17 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-with-children-ws/output.html: -------------------------------------------------------------------------------- 1 | 2 | Foo 3 | 4 | 5 | 6 | 7 | 8 | Foo 9 | 10 | 11 | 12 | 13 | 14 | 15 | Text 17 | -------------------------------------------------------------------------------- /test/formatting/samples/component-treated-as-inline-element/input.html: -------------------------------------------------------------------------------- 1 |

buy!

2 | 3 |

buy me a!

4 | 5 |

buy me a coffee!

6 | -------------------------------------------------------------------------------- /test/formatting/samples/each-await-block-destructuring/output.html: -------------------------------------------------------------------------------- 1 | {#each arr as { a, b = '' }} 2 | {a} 3 | {b} 4 | {/each} 5 | 6 | {#await promise then { a, b = '' }} 7 | {a} 8 | {b} 9 | {/await} 10 | 11 | {#await promise} 12 | Loading 13 | {:then { a, b = '' }} 14 | {a} 15 | {b} 16 | {/await} 17 | -------------------------------------------------------------------------------- /test/formatting/samples/inline-element-break-long-whitespace/output.html: -------------------------------------------------------------------------------- 1 | 2 | looooooooooong 3 | looooooooooonglooooooooooonglooooooooooonglooooooooooonglooooooooooong 4 | hihi 5 | looooooooooonglooooooooooonglooooooooooonglooooooooooong 6 | 7 | -------------------------------------------------------------------------------- /test/printer/samples/each-block-else-with-nested-if-block-elseif-else.html: -------------------------------------------------------------------------------- 1 | {#each animals as animal} 2 |

{animal}

3 | {:else} 4 | {#if type === "dog"} 5 |

no dogs

6 | {:else if type === "cat"} 7 |

no cats

8 | {:else} 9 |

no animals

10 | {/if} 11 | {/each} 12 | -------------------------------------------------------------------------------- /test/printer/samples/inline-blocks-nested.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | asd1 4 | 5 | asd2 6 | 7 | 8 | 9 | 10 | asd1 11 | 12 | asd2 13 | asd3 14 | asd4 15 | asd5 16 | 17 | -------------------------------------------------------------------------------- /test/formatting/samples/attributes-without-quotes/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

asd

6 |
7 | 10 |
11 | 12 | 17 | -------------------------------------------------------------------------------- /test/formatting/samples/prettier-ignore-range-2/output.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |
I need to adhere sadly
6 | 7 | 8 | 9 |
format madness here
10 | 11 |

12 | I'm 13 | freeeee! 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /test/formatting/samples/prettier-ignore/input.html: -------------------------------------------------------------------------------- 1 | 2 |