Parsable format for RSX files as tsx

I would like to statically analyze the rsx files to verify that they follow our team's development rules.
For example, “Do not use the ParentWindowQuery placeholder".

I have tried to parse rsx files using ts-morph, but the format of the rsx files is slightly different from tsx, so I cannot parse them correctly.

rsx

  <ParentWindowQuery
    id="id"
    errorTransformer="// The variable 'data' allows you to reference the request's data in the transformer. 
// example: return data.find(element => element.isError)
return data.error"
    resourceName="ParentWindow"
    resourceTypeOverride=""
    selector="id"
    transformer="// Query results are available as the `data` variable
return data"
  >

Formatted as tsx, it looks like this

  <ParentWindowQuery
    id="id"
    errorTransformer="// The variable 'data' allows you to reference the request's data in the transformer. \n// example: return data.find(element => element.isError)\nreturn data.error"
    resourceName="ParentWindow"
    resourceTypeOverride=""
    selector="id"
    transformer="// Query results are available as the `data` variable\nreturn data"
  />

Hello @toiroakr,

Very interesting use case!

I can definitely make a feature request to see if it would be possible for our team to set up a RSX to TSX file converter. Which could then be used by third party libraries such as ts-morph.

I will keep you updated and let you know if our engineering team has any ideas for work arounds that could be used as well :+1:

1 Like