From da98cfb144297f3cb90f408eb04b771c0945f1d0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 17 May 2024 00:17:31 +0900 Subject: [PATCH] Replace dprint prettier plugin with yamlfmt --- .github/workflows/lint.yml | 11 +++++++++++ .vscode/extensions.json | 1 + .vscode/settings.json | 6 ++++++ Rakefile | 2 ++ dprint.json | 8 +------- flake.nix | 1 + yamlfmt.yml | 7 +++++++ 7 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 yamlfmt.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d01de14d..6274e260 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,3 +40,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 280fae58..c4e8e6f9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,6 +6,7 @@ "soutaro.steep-vscode", "soutaro.rbs-syntax", "dprint.dprint", + "kachick.vscode-yamlfmt", "rubocop.vscode-rubocop", "jnoortheen.nix-ide" ] diff --git a/.vscode/settings.json b/.vscode/settings.json index c0f526ad..f25cecf1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,12 @@ "[ruby]": { "editor.defaultFormatter": "rubocop.vscode-rubocop" }, + "[yaml]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, + "[github-actions-workflow]": { + "editor.defaultFormatter": "kachick.vscode-yamlfmt" + }, "[nix]": { "editor.defaultFormatter": "jnoortheen.nix-ide" }, diff --git a/Rakefile b/Rakefile index 923942f2..fa858daa 100644 --- a/Rakefile +++ b/Rakefile @@ -134,11 +134,13 @@ task :deps do sh('dprint --version') sh('tree --version') sh('typos --version') + sh('yamlfmt -version') end desc 'Tests except ruby' task :check_non_ruby do Rake::Task['dprint'].invoke sh('typos . .github .vscode') + sh('yamlfmt -lint .') sh('nixpkgs-fmt --check ./*.nix') end diff --git a/dprint.json b/dprint.json index d9333698..ddf4b9f2 100644 --- a/dprint.json +++ b/dprint.json @@ -3,22 +3,16 @@ }, "markdown": { }, - "prettier": { - "printWidth": 120, - "singleQuote": true - }, "excludes": [ ".git", "**/*lock.json", "docs", "doc", - "steep_expectations.yml", "vendor", "test/**/fixtures/**" ], "plugins": [ "https://plugins.dprint.dev/json-0.19.1.wasm", - "https://plugins.dprint.dev/markdown-0.16.3.wasm", - "https://plugins.dprint.dev/prettier-0.32.1.json@19aa403ef0862ba8c41164e3dc6f84c0b7a66c2b11e42726b23dd25e6302ada9" + "https://plugins.dprint.dev/markdown-0.16.3.wasm" ] } diff --git a/flake.nix b/flake.nix index b799d0b3..c6f1d73d 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,7 @@ nil nixpkgs-fmt typos + yamlfmt ]; }; diff --git a/yamlfmt.yml b/yamlfmt.yml new file mode 100644 index 00000000..b0e4b5e7 --- /dev/null +++ b/yamlfmt.yml @@ -0,0 +1,7 @@ +gitignore_excludes: true +exclude: + - 'steep_expectations.yml' +line_ending: lf +formatter: + type: basic + retain_line_breaks_single: true