prettier / prettier/prettier

Format empty JSX tags to self-closing tags

Open
#19,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang:javascript lang:jsx
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier should format empty JSX tags to self-closing tags. That's the reason self-closing tags were created. Prettier is an opinionated formatter and this opinion is easy to motivate.

I am aware of https://github.com/prettier/prettier/issues/6452 and https://github.com/prettier/prettier/pull/8730, but the discussion was about adding this as an option. This issue is for making this the norm.

Also, this is a stylistic issue and not a linting issue, so this should not be done via ESLint.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the discussion in issues #6452 and pull request #8730, then locate Prettier's JSX formatting entry point and existing tests. Done means empty JSX tags are consistently formatted as self-closing tags by default, without an ESLint option.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.