zeux / meshoptimizer

Mesh optimization library that makes meshes smaller and faster to render
MIT License
5.49k stars 473 forks source link

Integrate Prettier for all JS source #717

Closed zeux closed 2 months ago

zeux commented 2 months ago

This makes the code style consistent across various uses of JS and also improves integration with editors that use LSP format-on-save like Zed.

As part of this, Wasm patching has been changed to recognize trailing embed comments as that is friendly to Prettier's line splitting.

zeux commented 2 months ago

~The test data is decidedly less readable now but it's probably still worthwhile.~ nothing prettier-ignore can't fix...

zeux commented 2 months ago

Not sure I like some aspects here; my biggest issue is printWidth behavior. It's similar to clang-format for fixed-width column limit except that when a line exceeds that, prettier breaks out every expression on a single line. This PR currently works around that by using an excessively large printWidth but that also results in new long lines being created in opposition to existing line breaks...

zeux commented 2 months ago

Going to cherry-pick some consistency changes like tabs and builds separately but for now we probably don't really need this.