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
but I didn't find any API in swc_ecma_visit related to comments.
It seems that there is no API for directly accessing comments, instead, it's done indirectly through swc_core::plugin::proxies::PluginCommentsProxy or other api. (#4182)
Direct API, such as visit_expr in swc_ecma_visit,
At the very beginning, what I was thinking about was whether there exists an API like visit_comments.
But in reality, AST and comments are separate, and there seems to be no way to independently access the content of the comments. Or, are there other APIs?
I'm not sure if the above thoughts about comments are completely correct.
If my thinking is correct, it seems a bit troublesome to implement the function of independent analysis of comments in a plugin.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to develop an SWC plugin for analyzing comments, like this: no-warning-comments - ESLint - Pluggable JavaScript Linter
but I didn't find any API in
swc_ecma_visit
related to comments.It seems that there is no API for directly accessing comments, instead, it's done indirectly through
swc_core::plugin::proxies::PluginCommentsProxy
or other api. (#4182)Direct API, such as
visit_expr
inswc_ecma_visit
,At the very beginning, what I was thinking about was whether there exists an API like
visit_comments
.But in reality, AST and comments are separate, and there seems to be no way to independently access the content of the comments. Or, are there other APIs?
maybe this's why comments are missing at #6321
and why there is no information about the comments in the AST output at the playground.
https://play.swc.rs/?version=1.3.74&code=H4sIAAAAAAAAA8tJLVFIVNDXVwjxd%2FHn5QIAz5rJoQ8AAAA%3D&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BAWdSIifrKJVBTl7iUE0maH3xsz8jooBbNoeKq1PMsQkYX4nEsi2Sf8lARIOxTNJia49XaWvRrRCtVoOxpIyBOluiX3hoMNQajjLXPGmzH%2FC3VwkUnkCu4o%2BsnSVTc0JbjwXmrZDkk50qF%2FwA%2FqsvNjMPLqm4kXGrYvhlQioBQBAAA%3D
I'm not sure if the above thoughts about comments are completely correct.
If my thinking is correct, it seems a bit troublesome to implement the function of independent analysis of comments in a plugin.
(from #8080 )
Beta Was this translation helpful? Give feedback.
All reactions