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 #596

Merged
merged 2 commits into from
May 16, 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
4 changes: 1 addition & 3 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ jobs:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: [get-meta, minimize-old-comments]
if: >-
(! failure()) &&
((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-staging')) ||
(github.event_name != 'pull_request'))
(! failure()) && ((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-staging')) || (github.event_name != 'pull_request'))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,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/[email protected] # TODO: Apply selfup after https://github.com/google/yamlfmt/pull/180
- 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 @@ -2,6 +2,7 @@
"recommendations": [
"editorconfig.editorconfig",
"dprint.dprint",
"kachick.vscode-yamlfmt",
"tekumara.typos-vscode",
"github.vscode-github-actions",
"timonwong.shellcheck",
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"
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
Expand Down
1 change: 1 addition & 0 deletions cmd/deps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func main() {
{Path: "makers", Args: []string{"--version"}},
{Path: "nix", Args: []string{"--version"}},
{Path: "dprint", Args: []string{"--version"}},
{Path: "yamlfmt", Args: []string{"-version"}},
{Path: "shellcheck", Args: []string{"--version"}},
{Path: "shfmt", Args: []string{"--version"}},
{Path: "typos", Args: []string{"--version"}},
Expand Down
1 change: 1 addition & 0 deletions cmd/fmt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func main() {
// Do not cover the same files in another formatter for parallel processing
cmds := runner.Commands{
{Path: "dprint", Args: []string{"fmt"}},
{Path: "yamlfmt", Args: []string{"."}},
{Path: "shfmt", Args: append([]string{"--language-dialect", "bash", "--write"}, bashPaths...)},
}

Expand Down
1 change: 1 addition & 0 deletions cmd/lint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func main() {

cmds := runner.Commands{
{Path: "dprint", Args: []string{"check"}},
{Path: "yamlfmt", Args: []string{"-lint", "."}},
{Path: "shfmt", Args: append([]string{"--language-dialect", "bash", "--diff"}, bashPaths...)},
{Path: "shellcheck", Args: bashPaths},
// nix fmt doesn't have check option: https://github.com/NixOS/nix/issues/6918, so do not include here
Expand Down
7 changes: 1 addition & 6 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
},
"toml": {
},
"prettier": {
"printWidth": 120,
"singleQuote": true
},
"excludes": [
".git",
".direnv",
Expand All @@ -19,7 +15,6 @@
"plugins": [
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.17.0.wasm",
"https://plugins.dprint.dev/toml-0.6.1.wasm",
"https://plugins.dprint.dev/prettier-0.35.0.json@0df49c4d878bb1051af2fa1d1f69ba6400f4b78633f49baa1f38954a6fd32b40"
"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 @@ -63,6 +63,7 @@
cargo-make

edge-pkgs.dprint
edge-pkgs.yamlfmt
edge-pkgs.typos
edge-pkgs.go_1_22
edge-pkgs.goreleaser
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
exclude:
- '.goreleaser.yaml'
line_ending: lf
formatter:
type: basic
retain_line_breaks_single: true
Loading