Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Linters which are not language-specific:
| TSX | [Prettier] | [ESLint] |
| TypeScript | [Prettier] | [ESLint] |
| YAML | [yamlfmt] | |
| XML | [@prettier/plugin-xml]| |

[prettier]: https://prettier.io
[google-java-format]: https://github.com/google/google-java-format
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"eslint": "^9.16.0",
"prettier": "^2.8.7",
"prettier-plugin-sql": "^0.14.0",
"@prettier/plugin-xml": "^0.10.0",
"stylelint": "^16",
"stylelint-config-standard": "^36.0.1",
"typescript": "4.9.5",
Expand Down
4 changes: 4 additions & 0 deletions example/src/hello.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<hello>
<world>
todo</world>
</hello>
1 change: 1 addition & 0 deletions example/tools/format/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ format_multirun(
swift = ":swiftformat",
terraform = "@aspect_rules_lint//format:terraform",
visibility = ["//:__subpackages__"],
xml = ":prettier",
yaml = "@aspect_rules_lint//format:yamlfmt",
)

Expand Down
1 change: 1 addition & 0 deletions format/private/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function ls-files {
'TypeScript') patterns=('*.ts' '*.cts' '*.mts') ;;
'Vue') patterns=('*.vue') ;;
'YAML') patterns=('*.yml' '*.yaml' '.clang-format' '.clang-tidy' '.gemrc') ;;
'XML') patterns=('*.xml') ;;

# Note: terraform fmt cannot handle all HCL files such as .terraform.lock
# "Only .tf and .tfvars files can be processed with terraform fmt"
Expand Down
1 change: 1 addition & 0 deletions format/private/formatter_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TOOLS = {
"Cuda": "clang-format",
"YAML": "yamlfmt",
"Rust": "rustfmt",
"XML": "prettier",
}

# Provided to make install more convenient
Expand Down
1 change: 1 addition & 0 deletions format/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ format_multirun(
swift = ":mock_swiftformat.sh",
# TODO: this attribute should be renamed to hcl
terraform = ":mock_terraform-fmt.sh",
xml = ":mock_prettier.sh",
yaml = ":mock_yamlfmt.sh",
)
7 changes: 7 additions & 0 deletions format/test/format_test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ bats_load_library "bats-assert"
assert_output --partial "+ prettier --write .bcr/README.md CONTRIBUTING.md README.md"
}

@test "should run prettier on XML" {
run bazel run //format/test:format_XML_with_prettier
assert_success

assert_output --partial "+ prettier --write example/src/hello.xml"
}

@test "should run prettier on CSS" {
run bazel run //format/test:format_CSS_with_prettier
assert_success
Expand Down
Loading