Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂️ JSX Formatting Support #2262

Open
1 of 7 tasks
ematipico opened this issue Mar 21, 2022 · 2 comments
Open
1 of 7 tasks

☂️ JSX Formatting Support #2262

ematipico opened this issue Mar 21, 2022 · 2 comments
Labels
formatter good first issue umbrella

Comments

@ematipico
Copy link
Collaborator

@ematipico ematipico commented Mar 21, 2022

Description

Description

This issue will be used to track the works around the formatting of JSX inside the formatter.

Please refer to the ungram file to make sure which grammar is supported by the parser which one is not.

For external contributors

Please refer to this section when writing tests for the formatter.

  • we want to format valid JSX programs;
  • start with simple programs, without comments;
  • by default all nodes implement the method format_verbatim, the objective is to remove that and apply a custom formatting;
  • use prettier as inspiration to apply the formatting;
  • if the snapshot will contain a section like "## Unimplemented nodes/tokens", it means that some nodes haven't been implemented and still use the function format_verbatim;
  • when the formatting makes sense, try add some case with comments;
  • the test suites will consider a test valid when:
    1. all tokens are formatted and formatted only once;
    2. the emitted code is a valid program (no syntax errors);
    3. the emitted code, when formatted a second time, is the same;
  • use the playground to understand the AST/CST;
  • use this quick test to inspect the AST. The test is ignored on purpose, so it can be run from an IDE without breaking the CI;
  • use the *Fields structs to extract the tokens/nodes;
@ematipico ematipico added good first issue umbrella formatter labels Mar 21, 2022
darrow-olykos added a commit to RustPhilly/tools that referenced this issue Mar 22, 2022
the simplest tag_expression (that is not self closing) to format is the smallest possible tree that
needs no formatting. for example `<a></a>`.
@darrow-olykos
Copy link
Contributor

@darrow-olykos darrow-olykos commented Mar 22, 2022

I would like to work on JsxElement please!

@ematipico
Copy link
Collaborator Author

@ematipico ematipico commented Mar 22, 2022

@darrow-olykos I assigned you to the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter good first issue umbrella
Projects
None yet
Development

No branches or pull requests

2 participants