From 62f53f15747f4d9298976021c1acadc0cf5c0f5f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 20 May 2024 14:10:28 +0900 Subject: [PATCH 1/3] Replace dprint prettier plugin with yamlfmt --- .github/workflows/lint.yml | 11 +++++++++++ .vscode/extensions.json | 1 + .vscode/settings.json | 6 ++++++ Taskfile.yml | 3 +++ dprint.json | 7 +------ flake.nix | 1 + yamlfmt.yml | 7 +++++++ 7 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 yamlfmt.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9b3a18b..faf89e4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,3 +26,14 @@ jobs: . .github .vscode + + yamlfmt: + timeout-minutes: 15 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + - name: Install yamlfmt + run: go install github.com/google/yamlfmt/cmd/yamlfmt@v0.12.1 # TODO: Apply selfup after https://github.com/google/yamlfmt/pull/180 + - run: yamlfmt -lint . diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 23a959e..ee75fed 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,7 @@ "editorconfig.editorconfig", "tekumara.typos-vscode", "dprint.dprint", + "kachick.vscode-yamlfmt", "jnoortheen.nix-ide" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 8dbba70..7b93331 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,12 @@ { "editor.defaultFormatter": "dprint.dprint", "editor.formatOnSave": true, + "[yaml]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, + "[github-actions-workflow]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, "[nix]": { "editor.defaultFormatter": "jnoortheen.nix-ide" }, diff --git a/Taskfile.yml b/Taskfile.yml index f9b34df..224dcd8 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -19,10 +19,12 @@ tasks: cmds: - typos . .github .vscode --write-changes - dprint fmt + - yamlfmt . - nixpkgs-fmt ./*.nix lint: cmds: - dprint check + - yamlfmt -lint . - typos . .github .vscode - nixpkgs-fmt --check ./*.nix deps: @@ -31,6 +33,7 @@ tasks: - nil --version - task --version - dprint --version + - yamlfmt -version - typos --version - tesseract --version - img2pdf --version diff --git a/dprint.json b/dprint.json index 28d6e0f..ddf9f27 100644 --- a/dprint.json +++ b/dprint.json @@ -1,13 +1,8 @@ { "json": {}, "markdown": {}, - "prettier": { - "printWidth": 120, - "singleQuote": true - }, "plugins": [ "https://plugins.dprint.dev/json-0.19.2.wasm", - "https://plugins.dprint.dev/markdown-0.16.4.wasm", - "https://plugins.dprint.dev/prettier-0.39.0.json@896b70f29ef8213c1b0ba81a93cee9c2d4f39ac2194040313cd433906db7bc7c" + "https://plugins.dprint.dev/markdown-0.16.4.wasm" ] } diff --git a/flake.nix b/flake.nix index fba2f0b..2eda58d 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ nil nixpkgs-fmt dprint + yamlfmt typos go-task diff --git a/yamlfmt.yml b/yamlfmt.yml new file mode 100644 index 0000000..417bd4f --- /dev/null +++ b/yamlfmt.yml @@ -0,0 +1,7 @@ +gitignore_excludes: true +line_ending: lf +formatter: + type: basic + retain_line_breaks_single: true + # https://github.com/google/yamlfmt/issues/182 + scan_folded_as_literal: true From 4f406d3765c4ae324a0293fcda8a168b8f1801f7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 20 May 2024 14:12:17 +0900 Subject: [PATCH 2/3] Enable renovatebot for updating dprint plugins --- .github/renovate.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/renovate.json diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..5a1330a --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>kachick/renovate-config-dprint#1.1.0" + ], + "labels": ["dependencies", "renovate"], + "nix": { + "enabled": false + } +} From c7826b3baf1e2a676ea2dacdf9a3db31929daf1b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 20 May 2024 14:15:23 +0900 Subject: [PATCH 3/3] `yamlfmt .` --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 224dcd8..be0fca1 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -24,7 +24,7 @@ tasks: lint: cmds: - dprint check - - yamlfmt -lint . + - yamlfmt -lint . - typos . .github .vscode - nixpkgs-fmt --check ./*.nix deps: