Skip to content

fix(ast): rename serialized fields to camel case#2566

Merged
Boshen merged 1 commit intomainfrom
03-02-fix_ast_rename_serialized_fields_to_camel_case
Mar 2, 2024
Merged

fix(ast): rename serialized fields to camel case#2566
Boshen merged 1 commit intomainfrom
03-02-fix_ast_rename_serialized_fields_to_camel_case

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 2, 2024

Fixes a few more AST fields names which are currently snake case in serialized JSON.

Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 2, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @overlookmotel and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added the A-ast Area - AST label Mar 2, 2024
@overlookmotel
Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 2, 2024

@ArnaudBarre Was there a reason why you didn't do these already in #2522?

(trailing_comma in ArrayExpression, ObjectExpression and
ArrayAssignmentTarget)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 2, 2024

CodSpeed Performance Report

Merging #2566 will not alter performance

Comparing 03-02-fix_ast_rename_serialized_fields_to_camel_case (c75a78e) with main (78f8c2c)

Summary

✅ 27 untouched benchmarks

@Boshen Boshen merged commit e339461 into main Mar 2, 2024
@Boshen Boshen deleted the 03-02-fix_ast_rename_serialized_fields_to_camel_case branch March 2, 2024 14:47
@ArnaudBarre
Copy link
Copy Markdown
Contributor

ArnaudBarre commented Mar 2, 2024

I didn't include this one because I think tailing comma part of ESTree and I let discussing skip vs camelCase for later

@overlookmotel
Copy link
Copy Markdown
Member Author

Ah I see. Well maybe they should be skipped. But regardless of whether they're in ESTree or not, I think it's better all properties in JSON AST are camelCase - snake_case would be unexpected to JS users.

@ArnaudBarre
Copy link
Copy Markdown
Contributor

Yeah this could be added to all nodes for potential future field if the cost is 0, if there is a small cost I think this is fine adding it when needed

@overlookmotel
Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 2, 2024

I don't think there's any runtime cost to field renaming, as the serializers are built at compile-time. Maybe yes we should add to all AST structs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants