Skip to content

fix: support more typescript nodes #70

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

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

manuel3108
Copy link
Member

@manuel3108 manuel3108 commented Jun 26, 2025

Relates: oxc-project/oxc#11495

This aims at supporting more general ast, that can be parsed by oxc-parser and then printed by us. Our current testing setup uses acorn, which has some key differences to @typescript-eslint/types outlined in the past.

I have currently modified the testing setup to use acorn by default. Changing one boolean in the testing setup will also test everything against oxc-parser. There is probably a nicer way to do this in the future, but it should work out for now.

Todo:

  • wth, is going on with oxc-parser's comments? They don't even have a line number or anything, just start and end, but you don't have a clue where those comments should go Currently, we cannot work with oxc-parsers comments as they are missing the loc property, see estree codegen oxc-project/oxc#11495 (comment), let's handle that at a later point
  • Fix testing setup to use both parsers. What would be the best way to do this? With a command line flag? Or just run both inside the test? For now, both parser run in the same test and execute against the same snapshot. Maps are not compared, as they have noticeable differences. We could either create another .map file for oxc or leave it as is.
  • fix some of the errors that are still occurring

Copy link

changeset-bot bot commented Jun 26, 2025

🦋 Changeset detected

Latest commit: bc27fb4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
esrap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@manuel3108 manuel3108 changed the title fix: support more generalized ast fix: support more typescript nodes Jul 5, 2025
Copy link

pkg-pr-new bot commented Jul 5, 2025

npm i https://pkg.pr.new/sveltejs/esrap@70

commit: bc27fb4

@manuel3108
Copy link
Member Author

oxc is completely comment out, as just importing it makes the pipeline fail. Locally everything works as expected (if we ignore the tests that contain comments),

@manuel3108 manuel3108 marked this pull request as ready for review July 5, 2025 11:57
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