You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(js): format TypeScript files using the faster biomejs formatter and Google style #1987
This speeds up formatting by 4-12x and fixes several formatting related
issues whether they have to do with the commit message, source code, or
license headers.
```
zsh❯ hyperfine -i "pnpm run format:biome" "pnpm run format:prettier"
Benchmark 1: pnpm run format:biome
Time (mean ± σ): 453.6 ms ± 5.6 ms [User: 679.3 ms, System: 92.5 ms]
Range (min … max): 447.9 ms … 465.3 ms 10 runs
Warning: Ignoring non-zero exit code.
Benchmark 2: pnpm run format:prettier
Time (mean ± σ): 5.715 s ± 0.285 s [User: 9.578 s, System: 0.739 s]
Range (min … max): 5.506 s … 6.426 s 10 runs
Summary
pnpm run format:biome ran
12.60 ± 0.65 times faster than pnpm run format:prettier
```
A sample run follows:
```
zsh❯ pnpm run format
> genkit@ format /Users/yesudeep/code/github.com/firebase/genkit
> pnpm dlx @biomejs/biome format --write . && (tsx scripts/copyright.ts)
Formatted 663 files in 86ms. Fixed 217 files.
Checking copyright in sources...
Updated copyright headers in 0 files
```
The configuration for the formatting is more or less based on the Google
TypeScript formatting guidelines at:
- [ ] https://google.github.io/styleguide/tsguide.html#string-literals
- [ ] https://google.github.io/styleguide/jsguide.html
- [ ] https://google.github.io/styleguide/tsguide.html#arrow-function-bodies
- [ ] https://google.github.io/styleguide/tsguide.html#automatic-semicolon-insertion
ISSUE: #1987
CHANGELOG:
- [ ] Update `pnpm run format` to use biomejs
- [ ] Update `pnpm run format:check` to use biomejs
- [ ] Use `bin/add_license` to add license headers.
- [ ] Exclude the `py/` and `go/` runtimes from the formatter.
- [ ] Fix Import attributes cannot be used with a type-only import error
- [ ] Update all the TypeScript files to use Google-style formatting.
- [ ] Re-enable pre-commit formatting for TypeScript.
0 commit comments