Hi!
I'm interested in the elixirfmt proposal. I have some assumptions and questions, and would like to get some input on it :)
Assumption
The formatter will use one and enforce one standard style guide. It will take the AST representation of the source code and transform the AST according to the style guide.
Idea
Elixir already exposes the AST and has convenient functions in the Code module. My initial idea is something like this:
- A set of rules for each token and its representation (related to the style guide)
- Recursively traverse the project directory and evaluate every .ex file.
- Evaluate the AST and transform each token according to the style guide.
As I see it, each token can be a subtree and if so recurse down to the leaves and transform from the bottom and up.
Questions
1. Is the thought that this will be included with mix?
2. Will it be possible to configure this style guide through configurations files?
If you have any recommendations for improvements or criticism, please comment I would love to hear your thoughts :)
Best regards,
Robin.