When I try this code on this AST, I get unknown node type error:
estraverse.traverse(ast, {
enter: function (node, parent) {
console.log(node.type)
},
});
This is the full error stack:
undefined
Error: Unknown node type null.
at Controller.traverse (/Temp/Temp/node_modules/estraverse/estraverse.js:469:31)
at Object.traverse (/Temp/Temp/node_modules/estraverse/estraverse.js:670:27)
at Object.<anonymous> (/Temp/Temp/LocalizationHelper.js:13:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47
If you want to traverse JSX nodes or any other nodes that are not JS nodes, you must use the custom visitor keys feature. See the README for documentation.
Hello,
This is my
Menu.jsx
content:And this is the AST generated for this, using
nightly-esprima
:When I try this code on this AST, I get
unknown node type
error:This is the full error stack:
What is wrong here?