How to insert a new AST Node if absent? #280
-
Imagine we have a JSX component expressed like
How to write a Piranha rule such that it will add Expected code:
Question Credit - @gregintuitaio |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
The idea would be to match some attribute (which is not
|
Beta Was this translation helpful? Give feedback.
-
I think this also calls out that - "we should support insert child" as a first class citizen in our "DSL". Like we have to do these |
Beta Was this translation helpful? Give feedback.
-
@gregintuitaio did u try the rule i suggested? |
Beta Was this translation helpful? Give feedback.
The idea would be to match some attribute (which is not
attributeA
) insideComponentA
that does not contain aattributeA
. This can be achieved by usingrules.constraints
.