Skip to content

Commit deec84b

Browse files
committed
Add TOML language formatting capability to the project infrastructure
Python package-based tools are used by the infrastructure of this project. The configuration of this Python infrastructure is defined by the `pyproject.toml` file. This file uses the TOML language. In addition to the machine entries produced by the Poetry tool, this important file is also edited directly by human contributors. For this reason, it will be useful to provide code formatting infrastructure for TOML files, and to enforce consistent formatting. This is easily accomplished by adding TOML support to the existing code formatting infrastructure via the "prettier-plugin-toml" plugin for the Prettier formatting tool. Poetry's `poetry.lock` file is also written in the TOML language. This file is automatically generated and never manually edited. In this case, the automatically generated content is accepted as-is. So Prettier is configured to exclude the `poetry.lock` file from formatting.
1 parent 415266a commit deec84b

File tree

5 files changed

+81
-2
lines changed

5 files changed

+81
-2
lines changed

.github/workflows/check-prettier-formatting-task.yml

+14
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ on:
9292
- "**.mkdn?"
9393
- "**.ronn"
9494
- "**.workbook"
95+
# TOML
96+
- "**/Cargo.lock"
97+
- "**/Cargo.toml.orig"
98+
- "**/Gopkg.lock"
99+
- "**/Pipfile"
100+
- "**/pdm.lock"
101+
- "**.toml"
95102
# YAML
96103
- "**/.clang-format"
97104
- "**/.clang-tidy"
@@ -189,6 +196,13 @@ on:
189196
- "**.mkdn?"
190197
- "**.ronn"
191198
- "**.workbook"
199+
# TOML
200+
- "**/Cargo.lock"
201+
- "**/Cargo.toml.orig"
202+
- "**/Gopkg.lock"
203+
- "**/Pipfile"
204+
- "**/pdm.lock"
205+
- "**.toml"
192206
# YAML
193207
- "**/.clang-format"
194208
- "**/.clang-tidy"

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.licenses/
22
__pycache__/
33
node_modules/
4+
poetry.lock

.prettierrc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
plugins:
2+
- prettier-plugin-toml

package-lock.json

+62-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"github-label-sync": "3.0.0",
66
"markdown-link-check": "^3.13.7",
77
"markdownlint-cli": "^0.44.0",
8-
"prettier": "^3.5.3"
8+
"prettier": "^3.5.3",
9+
"prettier-plugin-toml": "2.0.2"
910
},
1011
"engines": {
1112
"node": "20.x"

0 commit comments

Comments
 (0)