Skip to content

Commit

Permalink
Replace dprint prettier plugin with yamlfmt (#807)
Browse files Browse the repository at this point in the history
* Replace dprint prettier plugin with yamlfmt

* Do not use typos as a formatter, it may detect false positive

* Enable yamlfmt in task

* `makers fmt`
  • Loading branch information
kachick committed May 16, 2024
1 parent d1a9b6d commit 2fb8d19
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
3 changes: 1 addition & 2 deletions .github/workflows/merge-bot-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
4 changes: 3 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand All @@ -22,6 +22,7 @@ category = "Tools"
description = "Run linters without changes"
script = [
"dprint check",
"yamlfmt -lint .",
"deno lint",
"typos . .github .vscode",
"gitleaks detect",
Expand Down Expand Up @@ -71,6 +72,7 @@ script = [
"deno --version",
"makers --version",
"dprint --version",
"yamlfmt -version",
"nixfmt --version",
"typos --version",
"gh --version",
Expand Down
7 changes: 1 addition & 6 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
edge-pkgs.deno
edge-pkgs.dprint
edge-pkgs.typos
edge-pkgs.yamlfmt

# Helper for writing and linting actions
#
Expand Down
5 changes: 5 additions & 0 deletions yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
gitignore_excludes: true
line_ending: lf
formatter:
type: basic
retain_line_breaks_single: true

0 comments on commit 2fb8d19

Please sign in to comment.