-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: typescript #90
feat: typescript #90
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
Actually this is not going to work as I expected, as recast is printing all object properties into new lines, even if they are below the row printWidth. Here is the PR for that benjamn/recast#347 although it's already 8 years old. So my chosen approach might not work as initially expected. |
Bummer that the author never finished it up. But the maintainers liked the PR and the repo is still actively maintained, so if we wanted to clean it up and send a new version it sounds like they would accept it. |
Hi! Let me start with most important message: thank you for contributing! ❤️ I wanted to let you know that I've seen your efforts on mobile. Tomorrow I'll have access to my laptop and I will catch up on your notes and help in any way I can. |
That's troubling! Do you mind sharing at least the first error messages? I'm curious which one of linter(s) is failing.
Ah yes, this may be counter-intuitive or confusing. I'm aware of these 3 snapshots failing, because TypeScript syntax isn't supported yet. I've made these tests for future implementation and marked with it.fails, so using running tests would return a
Are you using Prettier or Biome? This repository uses Biome. |
That's a big blocker, I've tried to figure out if there was an option for recast'
Brackets removal is format related, no need to worry about this one for now. |
Looking at the
Ahh, yes I have seen that previously. Just wondering why it's printing it in red in this case, but then everything seems to be fine.
That's probably the right clue. Didn't think of that but makes sense.
I have just updated some snapshots that were only formatting related and not such big deals. That brings us down to 4 fails
Will see if we can get closer to zero without too much trouble.
Don't fully agree with that. As we are already passing the nodes directly to the print function there should any parsing or
If we trust the repl, this seems to be valid. But I would still like to avoid this: https://svelte.dev/repl/2e818715bffa45a69d6f6753561da287?version=4.2.18 |
So, it's Biome not being happy with the format. I admit I am a little confused by what is happening in your case. Because I can't reproduce those errors locally nor GitHub Actions workflows with CI setup does complain about it. From the shared output in file I see that somehow carriage return ( There's a guide for integrating Biome with VSCode for reference. I personally use Neovim, so I'm not fluent with VSCode setup. I don't want to enforce any settings on you; you know better what works best for you. Although I have to admit that the default(?) behaviour of auto-formatting files (in the open workspace/repository) which are not being currently changed by you, feels uncommon and too invasive to me. |
Sadly I have to come to the conclusion, that this is not possible at this point. I tried re-creating that logic in other ways, but sadly without success. With all the limitations we have encountered here, I don't think this is a good way anymore and we should instead focus on Rich-Harris/esrap#10 |
Thank you for the update, and most importantly - thank you for trying! |
Closes #86
Relates svelte-add/svelte-add#507
Relates svelte-add/svelte-add#193
I wanted to see if we can get any closer to supporting typescript, while using the tooling we are currently using in
svelte-add
. And this comes surprisingly close, with "only" 12 tests failing.Of course there are a few things I didn't bother about right now:
esrap
andrecast
, especially regarding quotes and lines breaks (11 failed tests)Otherwise the typescript test should be working as expected:
This is by no means a full implementation, and we should probably add more tests to see if this works as expected, even inside html templates potentially. This is a minimal implementation, that's why I did not bother renaming
print_es
On other notes: