From 035253bd9870466f1c90f78b4e4279a9d38e213f Mon Sep 17 00:00:00 2001 From: phukon Date: Thu, 23 Nov 2023 21:54:10 +0000 Subject: [PATCH] chore(debt): Add prettier config - refractor code Signed-off-by: phukon --- .prettierignore | 27 ++++ .prettierrc | 8 + layouts/_default/_markup/render-image.html | 16 +- layouts/_default/baseof.html | 4 +- layouts/_default/list.html | 16 +- layouts/docs/baseof.html | 17 +-- layouts/home.html | 6 +- layouts/partials/favicon.html | 18 +-- layouts/partials/footer.html | 168 +++++++++++---------- layouts/partials/hotkey.html | 26 ++-- layouts/partials/image-modal.html | 49 +++--- layouts/shortcodes/version.html | 3 +- package-lock.json | 82 +++++++++- package.json | 3 +- 14 files changed, 280 insertions(+), 163 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..b8c560af --- /dev/null +++ b/.prettierignore @@ -0,0 +1,27 @@ +.github +Update hugo.yaml +archive +update +assets +content/en +static +.gitignore +.hugo_build.lock +.nvmrc +CNAME +CODE_OF_CONDUCT.md +CONTRIBUTING-gitflow.md +CONTRIBUTING.md +Dockerfile +LICENSE +Makefile +README.md +SECURITY.md +config.yaml +docker-compose.yaml +go.mod +go.sum +hugo.toml +netlify.toml +package-lock.json +package.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..203afc14 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": true, + "tabWidth": 2, + "printWidth": 100, + "singleQuote": true, + "trailingComma": "none", + "plugins": ["prettier-plugin-organize-imports"] +} diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 4e63d744..03c20e63 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -8,5 +8,17 @@
- {{ .Text }} -
\ No newline at end of file + {{ .Text }} + diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b1f48e98..e37014c5 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,9 +3,7 @@ {{ partial "head.html" . }} - +
{{ partial "navbar.html" . }}
{{ block "main" . }}{{ end }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 00dcfc2d..fd190f2c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,11 +1,11 @@ - - - {{ .Page.Title }} - + + + {{ .Page.Title }} + - - {{ .Content }} - - \ No newline at end of file + + {{ .Content }} + + diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 5487af3a..c1a9ee03 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -3,12 +3,8 @@ {{ partial "head.html" . }} {{ partial "favicon.html" . }} - -
- {{ partial "navbar.html" . }} -
+ +
{{ partial "navbar.html" . }}
@@ -16,13 +12,12 @@ {{ partial "sidebar.html" . }}
- {{ partial "version-banner.html" . }} {{ if not - .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . - }}{{ end }} {{ block "main" . }}{{ end }} + {{ partial "version-banner.html" . }} {{ if not .Site.Params.ui.breadcrumb_disable }}{{ + partial "breadcrumb.html" . }}{{ end }} {{ block "main" . }}{{ end }}
diff --git a/layouts/home.html b/layouts/home.html index b2e137af..f50bfca2 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,5 +1 @@ -{{ define "main" }} -{{ with .Content }} -{{ . }} -{{ end }} -{{ end }} \ No newline at end of file +{{ define "main" }} {{ with .Content }} {{ . }} {{ end }} {{ end }} diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html index 5252ddc7..2a1ac866 100644 --- a/layouts/partials/favicon.html +++ b/layouts/partials/favicon.html @@ -1,9 +1,9 @@ - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 646f857d..ffce224e 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,90 +1,94 @@
- - {{partial "hotkey.html" .}} - - -
\ No newline at end of file +
+
+ + + + diff --git a/layouts/partials/hotkey.html b/layouts/partials/hotkey.html index b42d3d46..d55590c3 100644 --- a/layouts/partials/hotkey.html +++ b/layouts/partials/hotkey.html @@ -19,36 +19,36 @@ \ No newline at end of file + diff --git a/layouts/partials/image-modal.html b/layouts/partials/image-modal.html index 03dc1a5a..7bd38f99 100644 --- a/layouts/partials/image-modal.html +++ b/layouts/partials/image-modal.html @@ -7,30 +7,35 @@ \ No newline at end of file + // Close the Modal + function closeModal() { + // prevents flashing last modal image while new id is loading on open + document.getElementById('modalPic').src = ''; + document.getElementById('myModal').style.display = 'none'; + // See note above regarding the footer + document.getElementById('site-footer').style.display = 'block'; + } + diff --git a/layouts/shortcodes/version.html b/layouts/shortcodes/version.html index 398e40a2..a300bed0 100644 --- a/layouts/shortcodes/version.html +++ b/layouts/shortcodes/version.html @@ -1,2 +1 @@ -{{.Get `color`}} -{{.Inner}} \ No newline at end of file +{{.Get `color`}} {{.Inner}} diff --git a/package-lock.json b/package-lock.json index 8b099527..ce461b57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,18 @@ { - "name": "docsy-example-site", - "version": "0.7.1", + "name": "Layer5 Docs", + "version": "0.7.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "docsy-example-site", - "version": "0.7.1", + "name": "Layer5 Docs", + "version": "0.7.0", "license": "Apache-2.0", "devDependencies": { "autoprefixer": "^10.4.14", "hugo-extended": "0.113.0", - "postcss-cli": "^10.1.0" + "postcss-cli": "^10.1.0", + "prettier-plugin-organize-imports": "^3.2.4" } }, "node_modules/@babel/code-frame": { @@ -1795,6 +1796,42 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "node_modules/prettier": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "dev": true, + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "peerDependencies": { + "@volar/vue-language-plugin-pug": "^1.0.4", + "@volar/vue-typescript": "^1.0.4", + "prettier": ">=2.0", + "typescript": ">=2.9" + }, + "peerDependenciesMeta": { + "@volar/vue-language-plugin-pug": { + "optional": true + }, + "@volar/vue-typescript": { + "optional": true + } + } + }, "node_modules/pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -2245,6 +2282,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typescript": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -3664,6 +3715,20 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "prettier": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "dev": true, + "peer": true + }, + "prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "requires": {} + }, "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -3986,6 +4051,13 @@ "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", "dev": true }, + "typescript": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "dev": true, + "peer": true + }, "unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", diff --git a/package.json b/package.json index 0da12768..96b1ec3e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "devDependencies": { "autoprefixer": "^10.4.14", "hugo-extended": "0.113.0", - "postcss-cli": "^10.1.0" + "postcss-cli": "^10.1.0", + "prettier-plugin-organize-imports": "^3.2.4" } }