Anyone have a regex to de-nest alaises in an Elixir code base?

That kind of transformation is safer to do on AST (versus regexing code). The formatter provides some inspiration:

In between calls to Code.string_to_quoted_with_comments! and Code.Formatter.to_algebra, you could find alias nodes in the AST and transform them into the desired shape.

OR

You (could use the already-baked version included as a tutorial in the Sourceror docs! :tada:

See also the release announcement thread:

6 Likes