Format JS (fjs
) is meant to be an opinionated pretty printer for
JavaScript code. Given a snippet of code it will format it. Being highly
configurable is not a goal.
These are the goals fjs
tries to adhere to. If any of these properties are
violated please open an issue!
All functionality of fjs
should be pure functions, given the same input they
produce the same output. There are no side-effects anywhere.
Code that is formatted should be formatted solely based on the AST. Given an AST the same output should be printed regardless of any existing formatting.
Exceptions:
- Comments: When printing comments new lines before and after the comments are maintained according to the original formatting.
This process should not change the AST in any way. Modifying the AST is a job for another tool.
Exceptions:
- (None yet.)
TODO:
- I still need to figure out how to do this one :)
- This is also the level cursor tracking should come from. Probably? That way any AST changes can be applied and cursors are tracked through them.