Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: prettier/plugin-xml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.1
Choose a base ref
...
head repository: prettier/plugin-xml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.1.0
Choose a head ref

Commits on Mar 24, 2022

  1. chore(deps-dev): bump @types/node from 17.0.22 to 17.0.23

    Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.22 to 17.0.23.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)
    
    ---
    updated-dependencies:
    - dependency-name: "@types/node"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 24, 2022
    Copy the full SHA
    36526ff View commit details
  2. Merge pull request #433 from prettier/dependabot/npm_and_yarn/types/n…

    …ode-17.0.23
    
    chore(deps-dev): bump @types/node from 17.0.22 to 17.0.23
    github-actions[bot] authored Mar 24, 2022
    Copy the full SHA
    61bc052 View commit details

Commits on Mar 25, 2022

  1. chore(deps-dev): bump ts-jest from 27.1.3 to 27.1.4

    Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 27.1.3 to 27.1.4.
    - [Release notes](https://github.com/kulshekhar/ts-jest/releases)
    - [Changelog](https://github.com/kulshekhar/ts-jest/blob/v27.1.4/CHANGELOG.md)
    - [Commits](kulshekhar/ts-jest@v27.1.3...v27.1.4)
    
    ---
    updated-dependencies:
    - dependency-name: ts-jest
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 25, 2022
    Copy the full SHA
    c3a81e3 View commit details
  2. chore(deps-dev): bump typescript from 4.6.2 to 4.6.3

    Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.2 to 4.6.3.
    - [Release notes](https://github.com/Microsoft/TypeScript/releases)
    - [Commits](microsoft/TypeScript@v4.6.2...v4.6.3)
    
    ---
    updated-dependencies:
    - dependency-name: typescript
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 25, 2022
    Copy the full SHA
    e87aade View commit details
  3. Merge pull request #434 from prettier/dependabot/npm_and_yarn/ts-jest…

    …-27.1.4
    
    chore(deps-dev): bump ts-jest from 27.1.3 to 27.1.4
    github-actions[bot] authored Mar 25, 2022
    Copy the full SHA
    ee52dcc View commit details
  4. Merge pull request #435 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-4.6.3
    
    chore(deps-dev): bump typescript from 4.6.2 to 4.6.3
    github-actions[bot] authored Mar 25, 2022
    Copy the full SHA
    0ddb807 View commit details

Commits on Mar 28, 2022

  1. chore(deps): bump prettier from 2.6.0 to 2.6.1

    Bumps [prettier](https://github.com/prettier/prettier) from 2.6.0 to 2.6.1.
    - [Release notes](https://github.com/prettier/prettier/releases)
    - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
    - [Commits](prettier/prettier@2.6.0...2.6.1)
    
    ---
    updated-dependencies:
    - dependency-name: prettier
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 28, 2022
    Copy the full SHA
    46e597f View commit details
  2. chore(deps-dev): bump eslint from 8.11.0 to 8.12.0

    Bumps [eslint](https://github.com/eslint/eslint) from 8.11.0 to 8.12.0.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v8.11.0...v8.12.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 28, 2022
    Copy the full SHA
    8def788 View commit details
  3. Merge pull request #436 from prettier/dependabot/npm_and_yarn/prettie…

    …r-2.6.1
    
    chore(deps): bump prettier from 2.6.0 to 2.6.1
    github-actions[bot] authored Mar 28, 2022
    Copy the full SHA
    14f988b View commit details
  4. Merge pull request #437 from prettier/dependabot/npm_and_yarn/eslint-…

    …8.12.0
    
    chore(deps-dev): bump eslint from 8.11.0 to 8.12.0
    github-actions[bot] authored Mar 28, 2022
    Copy the full SHA
    dd33d9d View commit details

Commits on Mar 29, 2022

  1. chore(deps-dev): bump @typescript-eslint/parser from 5.16.0 to 5.17.0

    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.16.0 to 5.17.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.17.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 29, 2022
    Copy the full SHA
    93d0f11 View commit details
  2. Merge pull request #438 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/parser-5.17.0
    
    chore(deps-dev): bump @typescript-eslint/parser from 5.16.0 to 5.17.0
    github-actions[bot] authored Mar 29, 2022
    Copy the full SHA
    9eb7032 View commit details
  3. chore(deps-dev): bump @typescript-eslint/eslint-plugin

    Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.16.0 to 5.17.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.17.0/packages/eslint-plugin)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 29, 2022
    Copy the full SHA
    376e3c2 View commit details
  4. Merge pull request #439 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/eslint-plugin-5.17.0
    
    chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.16.0 to 5.17.0
    github-actions[bot] authored Mar 29, 2022
    Copy the full SHA
    5e21492 View commit details

Commits on Apr 4, 2022

  1. chore(deps): bump prettier from 2.6.1 to 2.6.2

    Bumps [prettier](https://github.com/prettier/prettier) from 2.6.1 to 2.6.2.
    - [Release notes](https://github.com/prettier/prettier/releases)
    - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
    - [Commits](prettier/prettier@2.6.1...2.6.2)
    
    ---
    updated-dependencies:
    - dependency-name: prettier
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 4, 2022
    Copy the full SHA
    a6025b2 View commit details
  2. Merge pull request #440 from prettier/dependabot/npm_and_yarn/prettie…

    …r-2.6.2
    
    chore(deps): bump prettier from 2.6.1 to 2.6.2
    github-actions[bot] authored Apr 4, 2022
    Copy the full SHA
    a747939 View commit details

Commits on Apr 5, 2022

  1. chore(deps-dev): bump @typescript-eslint/parser from 5.17.0 to 5.18.0

    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.17.0 to 5.18.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.18.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 5, 2022
    Copy the full SHA
    d98d768 View commit details
  2. Merge pull request #442 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/parser-5.18.0
    
    chore(deps-dev): bump @typescript-eslint/parser from 5.17.0 to 5.18.0
    github-actions[bot] authored Apr 5, 2022
    Copy the full SHA
    e180740 View commit details
  3. chore(deps-dev): bump @typescript-eslint/eslint-plugin

    Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.17.0 to 5.18.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.18.0/packages/eslint-plugin)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 5, 2022
    Copy the full SHA
    e78616b View commit details
  4. Merge pull request #441 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/eslint-plugin-5.18.0
    
    chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.17.0 to 5.18.0
    github-actions[bot] authored Apr 5, 2022
    Copy the full SHA
    b3bc3f0 View commit details

Commits on Apr 11, 2022

  1. chore(deps-dev): bump eslint from 8.12.0 to 8.13.0

    Bumps [eslint](https://github.com/eslint/eslint) from 8.12.0 to 8.13.0.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v8.12.0...v8.13.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 11, 2022
    Copy the full SHA
    9ddbaa4 View commit details
  2. chore(deps-dev): bump @types/prettier from 2.4.4 to 2.6.0

    Bumps [@types/prettier](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prettier) from 2.4.4 to 2.6.0.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prettier)
    
    ---
    updated-dependencies:
    - dependency-name: "@types/prettier"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 11, 2022
    Copy the full SHA
    266fdf8 View commit details
  3. Merge pull request #443 from prettier/dependabot/npm_and_yarn/eslint-…

    …8.13.0
    
    chore(deps-dev): bump eslint from 8.12.0 to 8.13.0
    github-actions[bot] authored Apr 11, 2022
    Copy the full SHA
    6c7101f View commit details
  4. Merge pull request #444 from prettier/dependabot/npm_and_yarn/types/p…

    …rettier-2.6.0
    
    chore(deps-dev): bump @types/prettier from 2.4.4 to 2.6.0
    github-actions[bot] authored Apr 11, 2022
    Copy the full SHA
    e74179d View commit details

Commits on Apr 12, 2022

  1. chore(deps-dev): bump @typescript-eslint/parser from 5.18.0 to 5.19.0

    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.18.0 to 5.19.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.19.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 12, 2022
    Copy the full SHA
    27d5b9e View commit details
  2. Merge pull request #445 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/parser-5.19.0
    
    chore(deps-dev): bump @typescript-eslint/parser from 5.18.0 to 5.19.0
    github-actions[bot] authored Apr 12, 2022
    Copy the full SHA
    f044a4a View commit details
  3. chore(deps-dev): bump @typescript-eslint/eslint-plugin

    Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.18.0 to 5.19.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.19.0/packages/eslint-plugin)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 12, 2022
    Copy the full SHA
    ed85735 View commit details
  4. Merge pull request #446 from prettier/dependabot/npm_and_yarn/typescr…

    …ipt-eslint/eslint-plugin-5.19.0
    
    chore(deps-dev): bump @typescript-eslint/eslint-plugin from 5.18.0 to 5.19.0
    github-actions[bot] authored Apr 12, 2022
    Copy the full SHA
    3dc7539 View commit details

Commits on Apr 15, 2022

  1. chore(deps-dev): bump @types/node from 17.0.23 to 17.0.24

    Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.23 to 17.0.24.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)
    
    ---
    updated-dependencies:
    - dependency-name: "@types/node"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 15, 2022
    Copy the full SHA
    3600c09 View commit details
  2. Merge pull request #447 from prettier/dependabot/npm_and_yarn/types/n…

    …ode-17.0.24
    
    chore(deps-dev): bump @types/node from 17.0.23 to 17.0.24
    github-actions[bot] authored Apr 15, 2022
    Copy the full SHA
    8613c8f View commit details

Commits on Apr 17, 2022

  1. singleAttributePerLine

    kddnewton committed Apr 17, 2022
    Copy the full SHA
    78595ce View commit details
  2. Merge pull request #449 from prettier/singleAttributePerLine

    singleAttributePerLine
    kddnewton authored Apr 17, 2022
    Copy the full SHA
    8ca4b03 View commit details
  3. Bump to v2.1.0

    kddnewton committed Apr 17, 2022
    Copy the full SHA
    3b6819c View commit details
Showing with 184 additions and 73 deletions.
  1. +8 −1 CHANGELOG.md
  2. +8 −7 README.md
  3. +1 −1 package.json
  4. +5 −1 src/printer.ts
  5. +90 −0 test/__snapshots__/format.test.ts.snap
  6. +9 −0 test/format.test.ts
  7. +63 −63 yarn.lock
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

## [2.1.0] - 2022-04-16

### Added

- Support for the `singleAttributePerLine` option.

## [2.0.1] - 2022-03-22

### Added
@@ -179,7 +185,8 @@ and it will maintain your formatting.

- Initial release 🎉

[unreleased]: https://github.com/prettier/plugin-xml/compare/v2.0.1...HEAD
[unreleased]: https://github.com/prettier/plugin-xml/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/prettier/plugin-xml/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/prettier/plugin-xml/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/prettier/plugin-xml/compare/v1.2.0...v2.0.0
[1.2.0]: https://github.com/prettier/plugin-xml/compare/v1.1.0...v1.2.0
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -46,13 +46,14 @@ The `prettier` executable is now installed and ready for use:

Below are the options (from [`src/plugin.ts`](src/plugin.ts)) that `@prettier/plugin-xml` currently supports:

| API Option | CLI Option | Default | Description |
| -------------------------- | ------------------------------ | :--------: | ----------------------------------------------------------------------------------------------------- |
| `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"` | Options are `"strict"` and `"ignore"`. You may want `"ignore"`, [see below](#whitespace). |
| API Option | CLI Option | Default | Description |
| -------------------------- | ------------------------------ | :--------: | ------------------------------------------------------------------------------------------------------------- |
| `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)). |
| `singleAttributePerLine` | `--single-attribute-per-line` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line)) |
| `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"` | Options are `"strict"` and `"ignore"`. You may want `"ignore"`, [see below](#whitespace). |

Any of these can be added to your existing [prettier configuration
file](https://prettier.io/docs/en/configuration.html). For example:
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prettier/plugin-xml",
"version": "2.0.1",
"version": "2.1.0",
"description": "prettier plugin for XML",
"main": "dist/plugin.js",
"scripts": {
6 changes: 5 additions & 1 deletion src/printer.ts
Original file line number Diff line number Diff line change
@@ -264,8 +264,12 @@ const printer: Printer = {
const parts: Doc[] = [OPEN[0].image, Name[0].image];

if (attribute) {
const separator = opts.singleAttributePerLine ? hardline : line;
parts.push(
indent([line, join(line, path.map(print, "children", "attribute"))])
indent([
line,
join(separator, path.map(print, "children", "attribute"))
])
);
}

90 changes: 90 additions & 0 deletions test/__snapshots__/format.test.ts.snap
Original file line number Diff line number Diff line change
@@ -227,6 +227,96 @@ use {
"
`;

exports[`singleAttributePerLine => true 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?>
<!DOCTYPE module PUBLIC \\"-//Puppy Crawl//DTD Check Configuration 1.3//EN\\"
\\"https://www.puppycrawl.com/dtds/configuration_1_3.dtd\\">
<?xml-model href=\\"project.rnc\\" type=\\"application/relax-ng-compact-syntax\\"?>
<!-- foo -->
<svg
xmlns=\\"http://www.w3.org/2000/svg\\"
xmlns:xlink=\\"http://www.w3.org/1999/xlink\\"
width=\\"200\\"
height=\\"100\\"
viewBox=\\"0 0 200 100\\"
>
<title>Style inheritance and the use element</title>
<desc _attr=\\"attr\\">
&anp; &#12345;
<![CDATA[
foo
]]>
bar
</desc>
<?pagebreak?>
<style />
<style />
<style type=\\"text/css\\">
circle {
stroke-opacity: 0.7;
}
.special circle {
stroke: green;
}
use {
stroke: purple;
fill: orange;
}
</style>
<yaml
myveryveryveryverylongattributename=\\"myveryveryveryverylongattributevalue\\"
>
- 1
- 2
- 3
</style>
<!-- inner comment -->
<?pagebreak?>
<g
class=\\"special\\"
style=\\"fill: blue\\"
>
<circle
id=\\"c\\"
cy=\\"50\\"
cx=\\"50\\"
r=\\"40\\"
stroke-width=\\"20\\"
/>
</g>
<use
xlink:href=\\"#c\\"
x=\\"100\\"
/>
<ignored>
<!-- prettier-ignore-start -->
< ignored />
<!-- prettier-ignore-end -->
</ignored>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at est eget
enim consectetur accumsan. Aliquam pretium sodales ipsum quis dignissim. Sed
id sem vel diam luctus fringilla. Aliquam quis egestas magna. Curabitur
molestie lorem et odio porta, et molestie libero laoreet. Morbi rhoncus
sagittis cursus. Nullam vehicula pretium consequat. Praesent porta ante at
posuere sollicitudin. Nullam commodo tempor arcu, at condimentum neque
elementum ut.
</p>
<span>content</span>
<div>
even more
<content />
</div>
</svg>
<!-- bar -->
"
`;

exports[`xmlSelfClosingSpace => false 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<!DOCTYPE module PUBLIC \\"-//Puppy Crawl//DTD Check Configuration 1.3//EN\\"
9 changes: 9 additions & 0 deletions test/format.test.ts
Original file line number Diff line number Diff line change
@@ -52,3 +52,12 @@ test("bracketSameLine => true, xmlSelfClosingSpace => false", () => {

expect(formatted).toMatchSnapshot();
});

test("singleAttributePerLine => true", () => {
const formatted = format(fixture, {
singleAttributePerLine: true,
xmlWhitespaceSensitivity: "ignore"
});

expect(formatted).toMatchSnapshot();
});
126 changes: 63 additions & 63 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -670,14 +670,14 @@
integrity sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==

"@types/node@*", "@types/node@^17.0.22":
version "17.0.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.22.tgz#38b6c4b9b2f3ed9f2e376cce42a298fb2375251e"
integrity sha512-8FwbVoG4fy+ykY86XCAclKZDORttqE5/s7dyWZKLXTdv3vRy5HozBEinG5IqhvPXXzIZEcTVbuHlQEI6iuwcmw==
version "17.0.24"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.24.tgz#20ba1bf69c1b4ab405c7a01e950c4f446b05029f"
integrity sha512-aveCYRQbgTH9Pssp1voEP7HiuWlD2jW2BO56w+bVrJn04i61yh6mRfoKO6hEYQD9vF+W8Chkwc6j1M36uPkx4g==

"@types/prettier@^2.1.5", "@types/prettier@^2.3.0":
version "2.4.4"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.4.tgz#5d9b63132df54d8909fce1c3f8ca260fdd693e17"
integrity sha512-ReVR2rLTV1kvtlWFyuot+d1pkpG2Fw/XKE3PDAdj57rbM97ttSp9JZ2UsP+2EHTylra9cUf6JA7tGwW1INzUrA==
version "2.6.0"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.6.0.tgz#efcbd41937f9ae7434c714ab698604822d890759"
integrity sha512-G/AdOadiZhnJp0jXCaBQU449W2h716OW/EoXeYkCytxKL06X1WCXB4DZpp8TpZ8eyIJVS1cw4lrlkkSYU21cDw==

"@types/stack-utils@^2.0.0":
version "2.0.1"
@@ -697,13 +697,13 @@
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@^5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.16.0.tgz#78f246dd8d1b528fc5bfca99a8a64d4023a3d86d"
integrity sha512-SJoba1edXvQRMmNI505Uo4XmGbxCK9ARQpkvOd00anxzri9RNQk0DDCxD+LIl+jYhkzOJiOMMKYEHnHEODjdCw==
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.19.0.tgz#9608a4b6d0427104bccf132f058cba629a6553c0"
integrity sha512-w59GpFqDYGnWFim9p6TGJz7a3qWeENJuAKCqjGSx+Hq/bwq3RZwXYqy98KIfN85yDqz9mq6QXiY5h0FjGQLyEg==
dependencies:
"@typescript-eslint/scope-manager" "5.16.0"
"@typescript-eslint/type-utils" "5.16.0"
"@typescript-eslint/utils" "5.16.0"
"@typescript-eslint/scope-manager" "5.19.0"
"@typescript-eslint/type-utils" "5.19.0"
"@typescript-eslint/utils" "5.19.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
@@ -712,68 +712,68 @@
tsutils "^3.21.0"

"@typescript-eslint/parser@^5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.16.0.tgz#e4de1bde4b4dad5b6124d3da227347616ed55508"
integrity sha512-fkDq86F0zl8FicnJtdXakFs4lnuebH6ZADDw6CYQv0UZeIjHvmEw87m9/29nk2Dv5Lmdp0zQ3zDQhiMWQf/GbA==
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.19.0.tgz#05e587c1492868929b931afa0cb5579b0f728e75"
integrity sha512-yhktJjMCJX8BSBczh1F/uY8wGRYrBeyn84kH6oyqdIJwTGKmzX5Qiq49LRQ0Jh0LXnWijEziSo6BRqny8nqLVQ==
dependencies:
"@typescript-eslint/scope-manager" "5.16.0"
"@typescript-eslint/types" "5.16.0"
"@typescript-eslint/typescript-estree" "5.16.0"
"@typescript-eslint/scope-manager" "5.19.0"
"@typescript-eslint/types" "5.19.0"
"@typescript-eslint/typescript-estree" "5.19.0"
debug "^4.3.2"

"@typescript-eslint/scope-manager@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.16.0.tgz#7e7909d64bd0c4d8aef629cdc764b9d3e1d3a69a"
integrity sha512-P+Yab2Hovg8NekLIR/mOElCDPyGgFZKhGoZA901Yax6WR6HVeGLbsqJkZ+Cvk5nts/dAlFKm8PfL43UZnWdpIQ==
"@typescript-eslint/scope-manager@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.19.0.tgz#97e59b0bcbcb54dbcdfba96fc103b9020bbe9cb4"
integrity sha512-Fz+VrjLmwq5fbQn5W7cIJZ066HxLMKvDEmf4eu1tZ8O956aoX45jAuBB76miAECMTODyUxH61AQM7q4/GOMQ5g==
dependencies:
"@typescript-eslint/types" "5.16.0"
"@typescript-eslint/visitor-keys" "5.16.0"
"@typescript-eslint/types" "5.19.0"
"@typescript-eslint/visitor-keys" "5.19.0"

"@typescript-eslint/type-utils@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.16.0.tgz#b482bdde1d7d7c0c7080f7f2f67ea9580b9e0692"
integrity sha512-SKygICv54CCRl1Vq5ewwQUJV/8padIWvPgCxlWPGO/OgQLCijY9G7lDu6H+mqfQtbzDNlVjzVWQmeqbLMBLEwQ==
"@typescript-eslint/type-utils@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.19.0.tgz#80f2125b0dfe82494bbae1ea99f1c0186d420282"
integrity sha512-O6XQ4RI4rQcBGshTQAYBUIGsKqrKeuIOz9v8bckXZnSeXjn/1+BDZndHLe10UplQeJLXDNbaZYrAytKNQO2T4Q==
dependencies:
"@typescript-eslint/utils" "5.16.0"
"@typescript-eslint/utils" "5.19.0"
debug "^4.3.2"
tsutils "^3.21.0"

"@typescript-eslint/types@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.16.0.tgz#5827b011982950ed350f075eaecb7f47d3c643ee"
integrity sha512-oUorOwLj/3/3p/HFwrp6m/J2VfbLC8gjW5X3awpQJ/bSG+YRGFS4dpsvtQ8T2VNveV+LflQHjlLvB6v0R87z4g==
"@typescript-eslint/types@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.19.0.tgz#12d3d600d754259da771806ee8b2c842d3be8d12"
integrity sha512-zR1ithF4Iyq1wLwkDcT+qFnhs8L5VUtjgac212ftiOP/ZZUOCuuF2DeGiZZGQXGoHA50OreZqLH5NjDcDqn34w==

"@typescript-eslint/typescript-estree@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.16.0.tgz#32259459ec62f5feddca66adc695342f30101f61"
integrity sha512-SE4VfbLWUZl9MR+ngLSARptUv2E8brY0luCdgmUevU6arZRY/KxYoLI/3V/yxaURR8tLRN7bmZtJdgmzLHI6pQ==
"@typescript-eslint/typescript-estree@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.19.0.tgz#fc987b8f62883f9ea6a5b488bdbcd20d33c0025f"
integrity sha512-dRPuD4ocXdaE1BM/dNR21elSEUPKaWgowCA0bqJ6YbYkvtrPVEvZ+zqcX5a8ECYn3q5iBSSUcBBD42ubaOp0Hw==
dependencies:
"@typescript-eslint/types" "5.16.0"
"@typescript-eslint/visitor-keys" "5.16.0"
"@typescript-eslint/types" "5.19.0"
"@typescript-eslint/visitor-keys" "5.19.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/utils@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.16.0.tgz#42218b459d6d66418a4eb199a382bdc261650679"
integrity sha512-iYej2ER6AwmejLWMWzJIHy3nPJeGDuCqf8Jnb+jAQVoPpmWzwQOfa9hWVB8GIQE5gsCv/rfN4T+AYb/V06WseQ==
"@typescript-eslint/utils@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.19.0.tgz#fe87f1e3003d9973ec361ed10d36b4342f1ded1e"
integrity sha512-ZuEckdupXpXamKvFz/Ql8YnePh2ZWcwz7APICzJL985Rp5C2AYcHO62oJzIqNhAMtMK6XvrlBTZeNG8n7gS3lQ==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.16.0"
"@typescript-eslint/types" "5.16.0"
"@typescript-eslint/typescript-estree" "5.16.0"
"@typescript-eslint/scope-manager" "5.19.0"
"@typescript-eslint/types" "5.19.0"
"@typescript-eslint/typescript-estree" "5.19.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"

"@typescript-eslint/visitor-keys@5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.16.0.tgz#f27dc3b943e6317264c7492e390c6844cd4efbbb"
integrity sha512-jqxO8msp5vZDhikTwq9ubyMHqZ67UIvawohr4qF3KhlpL7gzSjOd+8471H3nh5LyABkaI85laEKKU8SnGUK5/g==
"@typescript-eslint/visitor-keys@5.19.0":
version "5.19.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.19.0.tgz#c84ebc7f6c744707a361ca5ec7f7f64cd85b8af6"
integrity sha512-Ym7zZoMDZcAKWsULi2s7UMLREdVQdScPQ/fKWMYefarCztWlHPFVJo8racf8R0Gc8FAEJ2eD4of8As1oFtnQlQ==
dependencies:
"@typescript-eslint/types" "5.16.0"
"@typescript-eslint/types" "5.19.0"
eslint-visitor-keys "^3.0.0"

"@xml-tools/parser@^1.0.11":
@@ -1342,9 +1342,9 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0:
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==

eslint@^8.5.0:
version "8.11.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.11.0.tgz#88b91cfba1356fc10bb9eb592958457dfe09fb37"
integrity sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==
version "8.13.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.13.0.tgz#6fcea43b6811e655410f5626cfcf328016badcd7"
integrity sha512-D+Xei61eInqauAyTJ6C0q6x9mx7kTUC1KZ0m0LSEexR0V+e94K12LmWX076ZIsldwfQ2RONdaJe0re0TRGQbRQ==
dependencies:
"@eslint/eslintrc" "^1.2.1"
"@humanwhocodes/config-array" "^0.9.2"
@@ -2610,9 +2610,9 @@ prelude-ls@~1.1.2:
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=

prettier@>=2.4.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4"
integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==
version "2.6.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==

pretty-format@^27.0.0, pretty-format@^27.5.1:
version "27.5.1"
@@ -2946,9 +2946,9 @@ tr46@^2.1.0:
punycode "^2.1.1"

ts-jest@^27.0.2:
version "27.1.3"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.1.3.tgz#1f723e7e74027c4da92c0ffbd73287e8af2b2957"
integrity sha512-6Nlura7s6uM9BVUAoqLH7JHyMXjz8gluryjpPXxr3IxZdAXnU6FhjvVLHFtfd1vsE1p8zD1OJfskkc0jhTSnkA==
version "27.1.4"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.1.4.tgz#84d42cf0f4e7157a52e7c64b1492c46330943e00"
integrity sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==
dependencies:
bs-logger "0.x"
fast-json-stable-stringify "2.x"
@@ -3027,9 +3027,9 @@ typedarray-to-buffer@^3.1.5:
is-typedarray "^1.0.0"

typescript@^4.3.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4"
integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==
version "4.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c"
integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==

universalify@^0.1.2:
version "0.1.2"