Skip to content

Commit e80e5ab

Browse files
committed
Remove xmlSelfClosingSpace
1 parent 09cd8ff commit e80e5ab

File tree

6 files changed

+6
-27
lines changed

6 files changed

+6
-27
lines changed

.github/ISSUE_TEMPLATE/formatting.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ body:
1818
label: tabWidth
1919
description: What value do you have the `tabWidth` option set to? (Defaults to `2`.)
2020
placeholder: "2"
21-
- type: dropdown
22-
attributes:
23-
label: xmlSelfClosingSpace
24-
description: What value do you have the `xmlSelfClosingSpace` option set to? (Defaults to `true`.)
25-
options:
26-
- "true"
27-
- "false"
2821
- type: dropdown
2922
attributes:
3023
label: xmlWhitespaceSensitivity

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1010

1111
- Support for the `bracketSameLine` option to mirror the core option.
1212

13+
### Removed
14+
15+
- The `xmlSelfClosingSpace` option is now removed to make it easier to maintain.
16+
1317
## [0.13.1] - 2021-03-03
1418

1519
### Changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Below are the options (from [`src/plugin.js`](src/plugin.js)) that `@prettier/pl
5151
| `bracketSameLine` | `--bracket-same-line` | `true` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#bracket-same-line)) |
5252
| `printWidth` | `--print-width` | `80` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)). |
5353
| `tabWidth` | `--tab-width` | `2` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)). |
54-
| `xmlSelfClosingSpace` | `--xml-self-closing-space` | `true` | Adds a space before self-closing tags. |
5554
| `xmlWhitespaceSensitivity` | `--xml-whitespace-sensitivity` | `"strict"` | How to handle whitespaces. Options are `"strict"` and `"ignore"`. |
5655

5756
Any of these can be added to your existing [prettier configuration

src/plugin.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ import printer from "./printer";
77

88
// These are the extra options defined by this plugin.
99
const options: Plugin<XMLAst>["options"] = {
10-
xmlSelfClosingSpace: {
11-
type: "boolean",
12-
category: "XML",
13-
default: true,
14-
description: "Adds a space before self-closing tags.",
15-
since: "0.4.0"
16-
},
1710
xmlWhitespaceSensitivity: {
1811
type: "choice",
1912
category: "XML",

src/printer.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,7 @@ const printer: Printer<XMLAst> = {
275275

276276
// Determine the value that will go between the <, name, and attributes
277277
// of an element and the /> of an element.
278-
let space: Doc = "";
279-
280-
if (opts.bracketSameLine) {
281-
space = " ";
282-
} else if (opts.xmlSelfClosingSpace) {
283-
space = line;
284-
} else {
285-
space = softline;
286-
}
278+
const space: Doc = opts.bracketSameLine ? " " : line;
287279

288280
if (SLASH_CLOSE) {
289281
return group([...parts, space, SLASH_CLOSE[0].image]);
@@ -460,8 +452,7 @@ const printer: Printer<XMLAst> = {
460452
);
461453
}
462454

463-
const space = opts.xmlSelfClosingSpace ? line : softline;
464-
return group([...parts, space, SPECIAL_CLOSE[0].image]);
455+
return group([...parts, line, SPECIAL_CLOSE[0].image]);
465456
}
466457
}
467458
}

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@ export type XMLAst =
3535

3636
export interface XMLOptions extends ParserOptions<XMLAst> {
3737
bracketSameLine: boolean;
38-
xmlSelfClosingSpace: boolean;
3938
xmlWhitespaceSensitivity: "ignore" | "strict";
4039
}

0 commit comments

Comments
 (0)