Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne(),
);- >95% test complience
- port tests
- build script that parses
__snapshots__from the Prettier format tests to generate rust tests of the same input, output, and options.
- build script that parses
- pass tests (in progress)
- As per the challenge specs, only need to be able to do this with JavaScript (ES6)
- we definitely don't want to have to write our own parser, we went with biome's parser
- pros: pure rust, so it should play nice with wasm; supports a lot of js file-types, including typescript; very well documented.
- cons: not used much outside of the project it was made for, a little heavy
- parse a string of code into an AST for JavaScript
- support embedded languages
- support comments
- support pragma
- port tests
- parse a AST into a document
- render a document
- define the Doc tree-like structure
- utilities for operating on Doc trees
- render a Doc tree into a string (with options)
- build script to generate rust tests from the Prettier repo's format test snapshots
- port the Document Internal Representation
- render a Doc to a string
- organization: flesh out the Parser trait, move things around, separate module for config, maybe rethink configs as a whole (remember, It will eventually need to support plugins).
- experiment with the various parsers until I find the one I want to use (biome's parser)
- use the chosen parser to implement the "text to AST" part of formatting
- port the comments api/algorithm from the JS version
- implement the "AST to Doc" part of formatting - in progress
- workspace organization
- cli tool (really simple, just take a file path as input, and output the formatted test of said input)
- wasm bundle, just expose the api as wasm bindings