Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Prettier for all JS source #717

Closed
wants to merge 5 commits into from
Closed

Integrate Prettier for all JS source #717

wants to merge 5 commits into from

Conversation

zeux
Copy link
Owner

@zeux zeux commented Jul 1, 2024

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.

This is in preparation to prettier integration
@zeux
Copy link
Owner Author

zeux commented Jul 1, 2024

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

zeux added 2 commits July 1, 2024 12:16
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.
Instead of using a variable prefix we now use a comment suffix to
indicate embedding which allows the string literal to be split onto its
own line.

Also adjust regexes for UMD which fixes .module.js building.
@zeux
Copy link
Owner Author

zeux commented Jul 1, 2024

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
Copy link
Owner Author

zeux commented Jul 1, 2024

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

@zeux zeux closed this Jul 1, 2024
@zeux zeux deleted the jsformat branch July 1, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant