Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ body:
label: tabWidth
description: What value do you have the `tabWidth` option set to? (Defaults to `2`.)
placeholder: "2"
- type: dropdown
attributes:
label: xmlSelfClosingSpace
description: What value do you have the `xmlSelfClosingSpace` option set to? (Defaults to `true`.)
options:
- "true"
- "false"
- type: dropdown
attributes:
label: xmlWhitespaceSensitivity
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

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

### Removed

- The `xmlSelfClosingSpace` option is now removed to make it easier to maintain.

## [0.13.1] - 2021-03-03

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

Any of these can be added to your existing [prettier configuration
Expand Down
7 changes: 0 additions & 7 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import printer from "./printer";

// These are the extra options defined by this plugin.
const options: Plugin<XMLAst>["options"] = {
xmlSelfClosingSpace: {
type: "boolean",
category: "XML",
default: true,
description: "Adds a space before self-closing tags.",
since: "0.4.0"
},
xmlWhitespaceSensitivity: {
type: "choice",
category: "XML",
Expand Down
13 changes: 2 additions & 11 deletions src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,7 @@ const printer: Printer<XMLAst> = {

// Determine the value that will go between the <, name, and attributes
// of an element and the /> of an element.
let space: Doc = "";

if (opts.bracketSameLine) {
space = " ";
} else if (opts.xmlSelfClosingSpace) {
space = line;
} else {
space = softline;
}
const space: Doc = opts.bracketSameLine ? " " : line;

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

const space = opts.xmlSelfClosingSpace ? line : softline;
return group([...parts, space, SPECIAL_CLOSE[0].image]);
return group([...parts, line, SPECIAL_CLOSE[0].image]);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ export type XMLAst =

export interface XMLOptions extends ParserOptions<XMLAst> {
bracketSameLine: boolean;
xmlSelfClosingSpace: boolean;
xmlWhitespaceSensitivity: "ignore" | "strict";
}