prettier / prettier/plugin-xml

Please include option not to auto-self-close empty nodes

Open
#793 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
278
Forks
46
Avg merge
1m
Merged PRs (30d)
13

Description

There are some situations (Salesforce metadata) where the metadata should not self-close:

This is the desired XML:

<searchLayouts></searchLayouts>

but the plugin auto-closes it to

<searchLayouts/>

I realize that maybe this isn't a best practice, but it is causing a ton of changes in our VCS that we'd rather not have to deal with, and it clutters IDEs until the commit is cleaned with Husky and Prettier.

Could we please have a boolean to prevent this kind of cleanup?

Contributor guide

No contributing guide indexed for this repository

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

Start by locating the plugin's XML formatting path that converts empty paired elements into self-closing elements. Use the issue's searchLayouts examples to define the expected behavior, then identify where a boolean option would be configured and tested. Done means the option preserves while existing cleanup remains unchanged by default.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.