JSX AST Plugins Persisting #15461
Unanswered
catesandrew
asked this question in
Q&A
Replies: 1 comment
-
I think its because im manipulating the attributes array directly vs using the paths's unshift/push container methods. duh! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have written 4 babel plugins that walk the JSX AST tree. Each one could make changes to the JSXOpeningElement's attributes. It appears that I'm doing something wrong because the following pluings dont seem to recognize changes from previous ones. I cant figure it out but aren't plugins designed to work like a compose where the outputs flow to the inputs sequentially in the plugin list?
By the way, all these plugins work correctly when ran individually, just not chained. So I know i'm missing something at the end of the visitor to sync and persist it before going to the next plugin.
First plugin adds a testID attribute to the top level JSX tree.
Second plugin will add a testID with the contents of an accessibilityLabel if the former DNE and latter does.
Third plugin will deep walk the JSX tree looking for lowest touchable and all proceeding touchables ancestors get an accessible false attribute.
Fourth plugin will walk the jsx tree and add a non-breaking-space testID attribute if it DNE.
So if one makes changes to the attributes collection of a JSXOpeningElement, its not persisted and carried over to the next plugin for some reason. I assumed it would be, am I incorrect in my assumption?
Beta Was this translation helpful? Give feedback.
All reactions