diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d0b7b203..0a5b0bb3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,3 +44,14 @@ jobs: . .github .vscode + + yamlfmt: + timeout-minutes: 15 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - name: Set up Go + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + - 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/179 + - run: yamlfmt -lint . diff --git a/.github/workflows/merge-bot-pr.yml b/.github/workflows/merge-bot-pr.yml index 4bab7406..bd253921 100644 --- a/.github/workflows/merge-bot-pr.yml +++ b/.github/workflows/merge-bot-pr.yml @@ -21,8 +21,7 @@ jobs: - name: Judge id: conclusion if: >- - steps.dependabot.outputs.update-type != 'version-update:semver-major' || - contains(steps.dependabot.outputs.dependency-names, 'DeterminateSystems') + steps.dependabot.outputs.update-type != 'version-update:semver-major' || contains(steps.dependabot.outputs.dependency-names, 'DeterminateSystems') run: echo -n 'merge=true' | tee -a "$GITHUB_OUTPUT" dependabot: needs: [judge-dependabot] diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ae693a5a..d82ad8ed 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "github.vscode-github-actions", "editorconfig.editorconfig", "dprint.dprint", + "kachick.vscode-yamlfmt", "tekumara.typos-vscode", "jnoortheen.nix-ide", "tamasfe.even-better-toml", diff --git a/.vscode/settings.json b/.vscode/settings.json index c8629298..63283558 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/Makefile.toml b/Makefile.toml index de0bbcf8..d4d380b6 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -13,7 +13,7 @@ category = "Tools" description = "Run formatters with changes" script = [ "dprint fmt", - "typos . .github .vscode --write-changes", + "yamlfmt .", "git ls-files '*.nix' | xargs nix fmt", ] @@ -22,6 +22,7 @@ category = "Tools" description = "Run linters without changes" script = [ "dprint check", + "yamlfmt -lint .", "deno lint", "typos . .github .vscode", "gitleaks detect", @@ -71,6 +72,7 @@ script = [ "deno --version", "makers --version", "dprint --version", + "yamlfmt -version", "nixfmt --version", "typos --version", "gh --version", diff --git a/dprint.json b/dprint.json index 271c0ee2..1b5c21be 100644 --- a/dprint.json +++ b/dprint.json @@ -11,16 +11,11 @@ "trailingCommas": "never" }, "markdown": {}, - "prettier": { - "printWidth": 120, - "singleQuote": true - }, "excludes": ["**/node_modules", "**/*-lock.json", "lib/**", "dist/**", "pnpm-lock.yaml", "logs/**"], "plugins": [ "https://plugins.dprint.dev/typescript-0.90.1.wasm", "https://plugins.dprint.dev/json-0.19.2.wasm", "https://plugins.dprint.dev/markdown-0.16.4.wasm", - "https://plugins.dprint.dev/toml-0.6.1.wasm", - "https://plugins.dprint.dev/prettier-0.39.0.json@896b70f29ef8213c1b0ba81a93cee9c2d4f39ac2194040313cd433906db7bc7c" + "https://plugins.dprint.dev/toml-0.6.1.wasm" ] } diff --git a/flake.nix b/flake.nix index fd88959b..c5771689 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ edge-pkgs.deno edge-pkgs.dprint edge-pkgs.typos + edge-pkgs.yamlfmt # Helper for writing and linting actions # diff --git a/yamlfmt.yml b/yamlfmt.yml new file mode 100644 index 00000000..64cfb26f --- /dev/null +++ b/yamlfmt.yml @@ -0,0 +1,5 @@ +gitignore_excludes: true +line_ending: lf +formatter: + type: basic + retain_line_breaks_single: true