specta_typescript/
formatter.rs1use std::{io, path::Path, process::Command};
2
3use crate::typescript::FormatterFn;
4
5pub fn eslint(file: &Path) -> io::Result<()> {
7 Command::new("eslint")
8 .arg("--fix")
9 .arg(file)
10 .output()
11 .map(|_| ())
12 .map_err(|e| io::Error::new(io::ErrorKind::Other, e))
13}
14
15const _: FormatterFn = eslint;
17
18pub fn prettier(file: &Path) -> io::Result<()> {
20 Command::new("prettier")
21 .arg("--write")
22 .arg(file)
23 .output()
24 .map(|_| ())
25 .map_err(|e| io::Error::new(io::ErrorKind::Other, e))
26}
27
28const _: FormatterFn = prettier;
30
31pub fn biome(file: &Path) -> io::Result<()> {
33 Command::new("biome")
34 .arg("format")
35 .arg(file)
36 .output()
37 .map(|_| ())
38 .map_err(|e| io::Error::new(io::ErrorKind::Other, e))
39}
40
41const _: FormatterFn = biome;