You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes node are missing boolean, like prefix: true on UnaryExpression. I don't yet know how to do that in serde
StaticMemberExpression, ComputedMemberExpression & PrivateFieldExpression need to be serialized to MemberExpression with few changes
StringLiteral, BooleanLiteral, ... need to be serialized as Literal with raw value set. For BigInt, because it's not in the JSON spec, it would still requires some work on the JS side but this can be done as part of the reviver function when desrializing.
modifiers is not an ESTree concept. So anytime there is this prop in OXC it probably means you need to set one or two boolean on the equivalent node. Examples are VariableDeclaration.declare, ClassExpression.abstract, TSEnumDeclaration.const. My take here is that it will make the OXC AST more clean and easy to explore to have named booleans on nodes instead of a comment to say which one are 'allowed'. But I don't know the implication of this.
Some types that are nullable in OXC default to empty array in ESTree, like TSInterfaceDeclaration.extends, ClassExpression.implements
FunctionBody is a BlockStatement in ESTree
FormalParameters is closer to ESTree now, but should be inlined directly into <node>.params in multiple nodes
TSMappedTypeModifierOperator is boolean | '-' | '+' | undefined in TSESTree, I think my conversion is incomplete at the moment
UsingDeclaration is a VariableDeclaration (Not done in my wrapper)
Not sure yet, but the structure of hashbang, comments & directives needs some updates
Some changes could be seen as rename only, but as soon we touch the name of the nodes the type generation became complex to handle that why I didn't push more PRs for that for now.
For info the TSUnionType hack is really prettier specific.
But the biggest blocker to make my repo public is the utf16 conversion. The time to print some large files goes in seconds with the dump implementation, and because I saw you plan to solve that I don't want to optimize for it.
Some good news is that my repo successfully gave the same output of prettier on ~500 TSX files, ~8k dts files & 10k files inside my node_modules. This is obviously a very biased dataset, but still promising!
modifiers is not an ESTree concept. So anytime there is this prop in OXC it probably means you need to set one or two boolean on the equivalent node. Examples are VariableDeclaration.declare, ClassExpression.abstract, TSEnumDeclaration.const. My take here is that it will make the OXC AST more clean and easy to explore to have named booleans on nodes instead of a comment to say which one are 'allowed'. But I don't know the implication of this.
The "modifiers" concept was ported from a contributor from a long time ago. We may need to reevaluate this decision and make larger changes. The underlying problem is how recoverable our parsing should be.
This is not exhaustive but should cover all 'types' of differences to resolve:
setProp(node, "typeArguments", node.typeParameters)
is not a mistake, it's because TSESLint deprecatedtypeParameters
in multiple nodes fortypeArguments
but keep both for now for backward compatibility. I'm not sure what is the right move for OXC here. For ref: fix: rename typeParameters to typeArguments where needed typescript-eslint/typescript-eslint#5384prefix: true
onUnaryExpression
. I don't yet know how to do that in serdeStaticMemberExpression
,ComputedMemberExpression
&PrivateFieldExpression
need to be serialized toMemberExpression
with few changesStringLiteral
,BooleanLiteral
, ... need to be serialized asLiteral
with raw value set. For BigInt, because it's not in the JSON spec, it would still requires some work on the JS side but this can be done as part of the reviver function when desrializing.modifiers
is not an ESTree concept. So anytime there is this prop in OXC it probably means you need to set one or two boolean on the equivalent node. Examples areVariableDeclaration.declare
,ClassExpression.abstract
,TSEnumDeclaration.const
. My take here is that it will make the OXC AST more clean and easy to explore to have named booleans on nodes instead of a comment to say which one are 'allowed'. But I don't know the implication of this.TSInterfaceDeclaration.extends
,ClassExpression.implements
FunctionBody
is aBlockStatement
in ESTreeFormalParameters
is closer to ESTree now, but should be inlined directly into<node>.params
in multiple nodesTSMappedTypeModifierOperator
isboolean | '-' | '+' | undefined
in TSESTree, I think my conversion is incomplete at the momentUsingDeclaration
is aVariableDeclaration
(Not done in my wrapper)Some changes could be seen as rename only, but as soon we touch the name of the nodes the type generation became complex to handle that why I didn't push more PRs for that for now.
For info the
TSUnionType
hack is really prettier specific.But the biggest blocker to make my repo public is the utf16 conversion. The time to print some large files goes in seconds with the dump implementation, and because I saw you plan to solve that I don't want to optimize for it.
Some good news is that my repo successfully gave the same output of prettier on ~500 TSX files, ~8k dts files & 10k files inside my node_modules. This is obviously a very biased dataset, but still promising!
Originally posted by @ArnaudBarre in #2463 (comment)
The text was updated successfully, but these errors were encountered: