Skip to content

Commit

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

* Add some dprint plugins for HTML and CSS
  • Loading branch information
kachick authored May 16, 2024
1 parent df6a19b commit 705dae9
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 16 deletions.
7 changes: 5 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>kachick/renovate-config-dprint#1.1.0"
],
"dependencyDashboard": true,
"labels": ["dependencies", "renovate"],
"enabledManagers": ["nix"],
"enabledManagers": ["regex", "nix"],
"nix": {
"enabled": true
"enabled": false
},
"packageRules": [
{
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,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 .
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"editorconfig.editorconfig",
"tekumara.typos-vscode",
"dprint.dprint",
"kachick.vscode-yamlfmt",
"stylelint.vscode-stylelint",
"jnoortheen.nix-ide"
]
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"
},
"[elm]": {
"editor.defaultFormatter": "elmTooling.elm-ls-vscode"
},
Expand Down
9 changes: 6 additions & 3 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
},
"json": {},
"markdown": {},
"prettier": {
"singleQuote": true
"malva": {
"quotes": "preferSingle"
},
"markup": {
},
"excludes": ["**/node_modules", "**/*-lock.json", "lib/**", "dist/**", "elm-stuff", "review", "elm.json"],
"plugins": [
"https://plugins.dprint.dev/typescript-0.89.3.wasm",
"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/g-plane/malva-v0.3.1.wasm",
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.8.0.wasm"
]
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
nil
nixpkgs-fmt
dprint
yamlfmt
nodejs_20
elmPackages.elm-json
deno
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"lint": "deno lint && elm-review && npm run stylelint:check",
"check": "typos && npm run format:check && npm run typecheck && npm test && npm run lint",
"preview": "vite preview",
"format:check": "dprint check && npx elm-format --validate src",
"format:fix": "dprint fmt && npx elm-format src",
"format:check": "dprint check && yamlfmt -lint . && npx elm-format --validate src",
"format:fix": "dprint fmt && yamlfmt . && npx elm-format src",
"stylelint:check": "npx stylelint '{src,public}/**/*.css'",
"stylelint:fix": "npx stylelint '{src,public}/**/*.css' --fix",
"typecheck": "tsc",
Expand Down
13 changes: 5 additions & 8 deletions public/main.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
:root {
--page-height: 100dvh;
--content-height: 90dvh;
--non-content-max-height: calc((var(--page-height) - var(--content-height)));
--header-height: minmax(
30px,
calc(((var(--non-content-max-height) / 3) * 2))
);
--footer-height: minmax(20px, calc(((var(--non-content-max-height) / 3))));
--non-content-max-height: calc(var(--page-height) - var(--content-height));
--header-height: minmax(30px, calc(var(--non-content-max-height) / 3 * 2));
--footer-height: minmax(20px, calc(var(--non-content-max-height) / 3));
--brand-base-color: #6a8372;
--brand-dark-color: #43676b;
--user-image-width: 32px;
Expand Down Expand Up @@ -44,8 +41,8 @@ a {
#page {
grid-template:
'head' var(--header-height)
'timer-panel' max(calc((var(--content-height) / 3)))
'users-panel' min(calc((var(--content-height) / 3) * 2))
'timer-panel' max(calc(var(--content-height) / 3))
'users-panel' min(calc(var(--content-height) / 3 * 2))
'foot' var(--footer-height) / 1fr;
}
}
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

0 comments on commit 705dae9

Please sign in to comment.