dprint
Typescriptから直接使うこともできる
typescriptの設定
code:sample.ts
import {
createStreaming,
GlobalConfiguration,
const globalConfig: GlobalConfiguration = {
indentWidth: 2,
lineWidth: 80,
};
const tsFormatter = await createStreaming(
);
tsFormatter.setConfig(globalConfig, {
semiColons: "asi",
});
console.log(tsFormatter.formatText("file.ts", `
const t = 5;
const s = "aa // ここでエラーが発生する
const k = t + s;
`));