Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace dprint prettier plugin with yamlfmt #196

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ jobs:
with:
dprint-version: '0.45.1' # selfup { "regex": "\\d[^']+", "script": "dprint --version | cut -d ' ' -f 2" }

yamlfmt:
timeout-minutes: 15
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install mise
run: |
curl https://mise.jdx.dev/install.sh | sh
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
- name: Install yamlfmt
# TODO: Apply selfup after https://github.com/google/yamlfmt/pull/180
run: mise use -g yamlfmt@0.12.1
- run: yamlfmt -lint .

typos:
timeout-minutes: 15
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"github.vscode-github-actions",
"tekumara.typos-vscode",
"rubocop.vscode-rubocop",
"dprint.dprint"
"dprint.dprint",
"kachick.vscode-yamlfmt"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "dprint.dprint",
"[yaml]": {
"editor.defaultFormatter": "kachick.vscode-yamlfmt"
},
"[github-actions-workflow]": {
"editor.defaultFormatter": "kachick.vscode-yamlfmt"
},
"[ruby]": {
"editor.defaultFormatter": "rubocop.vscode-rubocop"
},
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ desc 'Print dependencies'
task :deps do
sh('ruby --version')
sh('dprint --version')
sh('yamlfmt -version')
sh('tree --version')
sh('typos --version')
end
Expand All @@ -58,5 +59,6 @@ desc 'Tests except ruby'
task :linters do
sh('typos . .github .vscode')
sh('dprint check')
sh('yamlfmt -lint .')
sh('nixpkgs-fmt --check ./*.nix')
end
7 changes: 1 addition & 6 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
},
"markdown": {
},
"prettier": {
"printWidth": 120,
"singleQuote": true
},
"excludes": [
".git",
"**/*lock.json",
Expand All @@ -17,7 +13,6 @@
],
"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"
]
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
libyaml

dprint
yamlfmt
tree
nil
nixpkgs-fmt
Expand Down
7 changes: 7 additions & 0 deletions yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -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