From 5793e2349e86ba423e9a374ef5fdab6d44cc4026 Mon Sep 17 00:00:00 2001 From: Aiden-Jeon Date: Thu, 9 Dec 2021 14:08:14 +0900 Subject: [PATCH 1/2] pre-commit hook Signed-off-by: Aiden-Jeon --- .editorconfig | 2 +- .eslintignore | 2 +- .eslintrc.json | 2 +- .gitignore | 2 +- .markdownlint.json | 2 +- .markdownlintignore | 2 +- .pre-commit-config.yaml | 11 +++++++++++ .stylelintignore | 2 +- .stylelintrc.json | 2 +- archetypes/docs.md | 2 +- babel.config.js | 2 +- i18n/en.toml | 2 +- i18n/nl.toml | 2 +- layouts/404.html | 2 +- layouts/_default/baseof.html | 2 +- layouts/_default/index.js | 2 +- layouts/_default/index.json | 2 +- layouts/_default/list.html | 2 +- layouts/_default/section.sitemap.xml | 2 +- layouts/blog/list.html | 2 +- layouts/blog/single.html | 2 +- layouts/contributors/list.html | 2 +- layouts/docs/list.html | 2 +- layouts/index.headers | 2 +- layouts/partials/footer/footer.html | 2 +- layouts/partials/footer/script-footer.html | 2 +- layouts/partials/head/head.html | 2 +- layouts/partials/head/resource-hints.html | 2 +- layouts/partials/head/script-header.html | 2 +- layouts/partials/head/structured-data.html | 2 +- layouts/partials/head/stylesheet.html | 2 +- layouts/partials/head/twitter_cards.html | 2 +- layouts/partials/main/blog-meta.html | 2 +- layouts/partials/main/breadcrumb.html | 2 +- layouts/partials/main/docs-navigation.html | 2 +- layouts/partials/sidebar/docs-menu.html | 2 +- layouts/shortcodes/email.html | 2 +- layouts/shortcodes/img-simple.html | 2 +- static/doks.svg | 2 +- static/logo-doks.svg | 2 +- static/site.webmanifest | 2 +- 41 files changed, 51 insertions(+), 40 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.editorconfig b/.editorconfig index dad6b582..cf8d7fa6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,4 +8,4 @@ indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true -insert_final_newline = true \ No newline at end of file +insert_final_newline = true diff --git a/.eslintignore b/.eslintignore index 57d00579..b5bec9d9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ assets/js/index.js assets/js/katex.js assets/js/vendor -node_modules \ No newline at end of file +node_modules diff --git a/.eslintrc.json b/.eslintrc.json index c926994d..265d63b7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,4 +28,4 @@ } ] } -} \ No newline at end of file +} diff --git a/.gitignore b/.gitignore index 8f187f04..c61bf75d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ public resources # Local Netlify folder .netlify -TODO \ No newline at end of file +TODO diff --git a/.markdownlint.json b/.markdownlint.json index 5879dc35..d71cc4ce 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -6,4 +6,4 @@ "no-duplicate-heading": false, "no-bare-urls": false, "MD029": false -} \ No newline at end of file +} diff --git a/.markdownlintignore b/.markdownlintignore index a0380d65..12c80c89 100644 --- a/.markdownlintignore +++ b/.markdownlintignore @@ -1,3 +1,3 @@ node_modules CHANGELOG.md -README.md \ No newline at end of file +README.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..06fb8665 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + - id: check-added-large-files + args: ["--maxkb=1000"] diff --git a/.stylelintignore b/.stylelintignore index 3972095a..8ee369bd 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -1,3 +1,3 @@ assets/scss/components/_syntax.scss assets/scss/vendor -node_modules \ No newline at end of file +node_modules diff --git a/.stylelintrc.json b/.stylelintrc.json index 1490802c..715daa45 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -31,4 +31,4 @@ } ] } -} \ No newline at end of file +} diff --git a/archetypes/docs.md b/archetypes/docs.md index bb609d26..d2a6282b 100644 --- a/archetypes/docs.md +++ b/archetypes/docs.md @@ -6,7 +6,7 @@ date: {{ .Date }} lastmod: {{ .Date }} draft: true images: [] -menu: +menu: docs: parent: "" weight: 999 diff --git a/babel.config.js b/babel.config.js index ce9c9de0..59472e6c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -14,4 +14,4 @@ module.exports = { } ] ] -}; \ No newline at end of file +}; diff --git a/i18n/en.toml b/i18n/en.toml index cb52685f..962936d8 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,2 +1,2 @@ [get-started] - other = "Get Started" \ No newline at end of file + other = "Get Started" diff --git a/i18n/nl.toml b/i18n/nl.toml index f80323ee..1ddda41c 100644 --- a/i18n/nl.toml +++ b/i18n/nl.toml @@ -1,2 +1,2 @@ [get-started] - other = "Aan de slag" \ No newline at end of file + other = "Aan de slag" diff --git a/layouts/404.html b/layouts/404.html index f1fe6bff..a4f589b1 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -7,4 +7,4 @@

Page not found :(

-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 887373d6..af1af83e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -24,4 +24,4 @@ {{ partial "footer/footer.html" . }} {{ partial "footer/script-footer.html" . }} - \ No newline at end of file + diff --git a/layouts/_default/index.js b/layouts/_default/index.js index 9f764f91..dcda49e3 100644 --- a/layouts/_default/index.js +++ b/layouts/_default/index.js @@ -7,4 +7,4 @@ var docs = [ href: "{{ .URL | relURL }}" }, {{ end -}} -]; \ No newline at end of file +]; diff --git a/layouts/_default/index.json b/layouts/_default/index.json index 68428715..b3061a97 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -2,4 +2,4 @@ {{- range .Site.RegularPages -}} {{- $.Scratch.Add "index" (dict "title" .Title "description" .Params.description "contents" .Plain "RelPermalink" .RelPermalink) -}} {{- end -}} -{{- $.Scratch.Get "index" | jsonify -}} \ No newline at end of file +{{- $.Scratch.Get "index" | jsonify -}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 1401ccdf..a43b6e8f 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -10,4 +10,4 @@

{{ .Title }}

{{ template "_internal/pagination.html" . }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/_default/section.sitemap.xml b/layouts/_default/section.sitemap.xml index 701951d6..afeebb8d 100644 --- a/layouts/_default/section.sitemap.xml +++ b/layouts/_default/section.sitemap.xml @@ -43,4 +43,4 @@ {{ end -}} {{ end -}} {{ end -}} - \ No newline at end of file + diff --git a/layouts/blog/list.html b/layouts/blog/list.html index 9695387c..6267d4bc 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -21,4 +21,4 @@

{{ -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 48fdb82a..f965e20c 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -11,4 +11,4 @@

{{ .Title }}

-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/contributors/list.html b/layouts/contributors/list.html index adc53aad..d8e0d0a2 100644 --- a/layouts/contributors/list.html +++ b/layouts/contributors/list.html @@ -20,4 +20,4 @@

{{ -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/docs/list.html b/layouts/docs/list.html index c860531b..225bbcc5 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -19,4 +19,4 @@

{{ .Title }}

-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/index.headers b/layouts/index.headers index 8926db56..8398ea7f 100644 --- a/layouts/index.headers +++ b/layouts/index.headers @@ -7,4 +7,4 @@ Referrer-Policy: strict-origin Feature-Policy: geolocation 'self' Cache-Control: public, max-age=31536000 - Access-Control-Allow-Origin: * \ No newline at end of file + Access-Control-Allow-Origin: * diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html index bd260306..44a305a3 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/layouts/partials/footer/script-footer.html b/layouts/partials/footer/script-footer.html index 159ad3ff..e1d36063 100644 --- a/layouts/partials/footer/script-footer.html +++ b/layouts/partials/footer/script-footer.html @@ -102,4 +102,4 @@ {{ if and (.Site.Params.options.flexSearch) (eq .Section "docs") -}} {{ end -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index 9c1ecb35..fddee8dc 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -7,4 +7,4 @@ {{ block "head/stylesheet" . }}{{ partial "head/stylesheet.html" . }}{{ end }} {{ block "head/seo" . }}{{ partial "head/seo.html" . }}{{ end }} {{ block "head/favicons" . }}{{ partial "head/favicons.html" . }}{{ end }} - \ No newline at end of file + diff --git a/layouts/partials/head/resource-hints.html b/layouts/partials/head/resource-hints.html index 3baa7116..a6b83532 100644 --- a/layouts/partials/head/resource-hints.html +++ b/layouts/partials/head/resource-hints.html @@ -3,4 +3,4 @@ {{ if .Site.Params.options.kaTex -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/head/script-header.html b/layouts/partials/head/script-header.html index 0155989a..4d019166 100644 --- a/layouts/partials/head/script-header.html +++ b/layouts/partials/head/script-header.html @@ -1,4 +1,4 @@ {{ if .Site.Params.options.darkMode -}} {{ $darkModeInit := resources.Get "js/darkmode-init.js" | js.Build | minify -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/head/structured-data.html b/layouts/partials/head/structured-data.html index 1f153a35..e2eed77d 100644 --- a/layouts/partials/head/structured-data.html +++ b/layouts/partials/head/structured-data.html @@ -207,4 +207,4 @@ ] } - \ No newline at end of file + diff --git a/layouts/partials/head/stylesheet.html b/layouts/partials/head/stylesheet.html index 4dc25c01..3c861143 100644 --- a/layouts/partials/head/stylesheet.html +++ b/layouts/partials/head/stylesheet.html @@ -8,4 +8,4 @@ {{ $secureCSS := $css | resources.Fingerprint "sha512" -}} {{ end -}} - \ No newline at end of file + diff --git a/layouts/partials/head/twitter_cards.html b/layouts/partials/head/twitter_cards.html index fdf581c4..a6df98d3 100644 --- a/layouts/partials/head/twitter_cards.html +++ b/layouts/partials/head/twitter_cards.html @@ -21,4 +21,4 @@ {{ end -}} {{ end -}} {{ end -}} - \ No newline at end of file + diff --git a/layouts/partials/main/blog-meta.html b/layouts/partials/main/blog-meta.html index a9eb4387..51a47d85 100644 --- a/layouts/partials/main/blog-meta.html +++ b/layouts/partials/main/blog-meta.html @@ -1 +1 @@ -

Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }} and {{ end }}{{ . }}{{ end -}}{{ end -}} ‐ {{ .ReadingTime -}} min read

\ No newline at end of file +

Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }} and {{ end }}{{ . }}{{ end -}}{{ end -}} ‐ {{ .ReadingTime -}} min read

diff --git a/layouts/partials/main/breadcrumb.html b/layouts/partials/main/breadcrumb.html index 7c7d8fb7..8e3a4b7e 100644 --- a/layouts/partials/main/breadcrumb.html +++ b/layouts/partials/main/breadcrumb.html @@ -1,4 +1,4 @@ {{ with .Parent -}} {{ partial "main/breadcrumb.html" . -}}

-{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/main/docs-navigation.html b/layouts/partials/main/docs-navigation.html index e6a5668a..50a95808 100644 --- a/layouts/partials/main/docs-navigation.html +++ b/layouts/partials/main/docs-navigation.html @@ -21,4 +21,4 @@ {{ end -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index cd383bbf..9718aa7e 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -36,4 +36,4 @@

{{ .Name }}

{{ end -}} {{ end -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/layouts/shortcodes/email.html b/layouts/shortcodes/email.html index 88674fcc..64427eed 100644 --- a/layouts/shortcodes/email.html +++ b/layouts/shortcodes/email.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/layouts/shortcodes/img-simple.html b/layouts/shortcodes/img-simple.html index 117bc816..20a068c1 100644 --- a/layouts/shortcodes/img-simple.html +++ b/layouts/shortcodes/img-simple.html @@ -4,4 +4,4 @@ {{ else -}} -{{ end -}} \ No newline at end of file +{{ end -}} diff --git a/static/doks.svg b/static/doks.svg index 4631bc53..a3c4ead9 100644 --- a/static/doks.svg +++ b/static/doks.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/static/logo-doks.svg b/static/logo-doks.svg index 4631bc53..a3c4ead9 100644 --- a/static/logo-doks.svg +++ b/static/logo-doks.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/static/site.webmanifest b/static/site.webmanifest index d641eb71..b272d8fd 100644 --- a/static/site.webmanifest +++ b/static/site.webmanifest @@ -1 +1 @@ -{"name":"Doks Theme","short_name":"Doks","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#fff","background_color":"#fff","display":"standalone"} \ No newline at end of file +{"name":"Doks Theme","short_name":"Doks","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#fff","background_color":"#fff","display":"standalone"} From 7b898d3d41f8156c2d10621e3076716a7011f77d Mon Sep 17 00:00:00 2001 From: Aiden-Jeon Date: Thu, 9 Dec 2021 14:11:09 +0900 Subject: [PATCH 2/2] add test to how-to-contribute --- content/en/docs/help/how-to-contribute.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/content/en/docs/help/how-to-contribute.md b/content/en/docs/help/how-to-contribute.md index b7db0c30..14eafc38 100644 --- a/content/en/docs/help/how-to-contribute.md +++ b/content/en/docs/help/how-to-contribute.md @@ -63,3 +63,21 @@ title: "Jonh Doe" draft: false --- ``` + +## Before Commit + +프로젝트에서는 각 글들의 일관성을 위해서 여러 lint를 적용하고 있습니다. +다음 명령어를 실행해 test를 진행합니다. + +pre-commit을 통해 대부분의 test를 통과할 수 있습니다. + +```bash +pip install pre-commit +pre-commit run -a +``` + +pre-commit 후 test를 진행합니다. + +```bash +npm test +```