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

feat(unstable): refactor js lint plugin AST #27615

Merged
merged 12 commits into from
Jan 14, 2025

Conversation

marvinhagemeister
Copy link
Contributor

@marvinhagemeister marvinhagemeister commented Jan 9, 2025

This PR changes the underlying buffer backed AST format we use for JavaScript-based linting plugins. It adds support for various new types, makes traversal code a lot easier and is more polished compared to previous iterations.

Here is a quick summary (in no particular order):

  • Node prop data is separate from traversal, which makes traversal code so much easier to reason about. Previously, it was interleaved with node prop data
  • spans are in a separate table as well, as they are rarely needed.
  • schema is separate from SWC conversion logic, which makes
  • supports recursive plain objects
  • supports numbers
  • supports bigint
  • supports regex
  • adds all SWC nodes

Apologies, this is kinda a big PR, but it's worth it imo.

Marking as draft because I need to update some tests tomorrow.

This has several benefits:
- Node prop data is separate from traversal (makes traversal code so much easier!)
- schema is separate from SWC conversion logic
- supports recursive plain objects
- supports numbers
- supports bigint
- supports regex
- adds all SWC nodes
@marvinhagemeister marvinhagemeister marked this pull request as ready for review January 10, 2025 18:38
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's land it

@marvinhagemeister marvinhagemeister merged commit 3fb8fc1 into main Jan 14, 2025
17 checks passed
@marvinhagemeister marvinhagemeister deleted the lint-plugin-ast-refactor branch January 14, 2025 12:31
bartlomieju pushed a commit that referenced this pull request Jan 16, 2025
This PR changes the underlying buffer backed AST format we use for
JavaScript-based linting plugins. It adds support for various new types,
makes traversal code a lot easier and is more polished compared to
previous iterations.

Here is a quick summary (in no particular order):

- Node prop data is separate from traversal, which makes traversal code
so much easier to reason about. Previously, it was interleaved with node
prop data
- spans are in a separate table as well, as they are rarely needed.
- schema is separate from SWC conversion logic, which makes 
- supports recursive plain objects
- supports numbers
- supports bigint
- supports regex
- adds all SWC nodes

Apologies, this is kinda a big PR, but it's worth it imo.

_Marking as draft because I need to update some tests tomorrow._
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.

2 participants