Skip to content

Instantly share code, notes, and snippets.

@Vehmloewff
Last active October 8, 2020 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vehmloewff/dfc296f8bf0c02a1c75de39f0d263dd0 to your computer and use it in GitHub Desktop.
Save Vehmloewff/dfc296f8bf0c02a1c75de39f0d263dd0 to your computer and use it in GitHub Desktop.
import { createStreaming } from "https://dprint.dev/formatter/v2.ts";
const globalConfig = {
indentWidth: 2,
lineWidth: 80,
};
console.log("before createStreaming")
const tsFormatter = await createStreaming(
fetch("https://plugins.dprint.dev/typescript-0.32.4.wasm"),
);
console.log("after createStreaming")
tsFormatter.setConfig(globalConfig, {
semiColons: "asi",
});
// outputs: "const t = 5\n"
console.log(tsFormatter.formatText("file.ts", "const t = 5;"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment