From d0eed94649ab3851bf5b2a28ee5426f1157b8de0 Mon Sep 17 00:00:00 2001 From: Aishen Date: Sun, 6 Aug 2023 13:49:58 +0800 Subject: [PATCH] Github CA (Formatting Check) --- .github/workflows/format_check.yml | 36 ++++++++ packages/react-todo/package.json | 3 +- packages/svelte-todo/package.json | 3 +- packages/vanilla-todo/css/style.css | 138 ++++++++++++++-------------- packages/vanilla-todo/index.html | 4 +- packages/vanilla-todo/package.json | 3 +- packages/vue-todo/package.json | 3 +- 7 files changed, 115 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/format_check.yml diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml new file mode 100644 index 0000000..03b6d08 --- /dev/null +++ b/.github/workflows/format_check.yml @@ -0,0 +1,36 @@ +name: Format Check + +on: + push: + branches: + - main + - format_ca + pull_request: + branches: + - main + - format_ca + +jobs: + prettier-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Node.js and pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Format check on react-todo + run: cd packages/react-todo && pnpm install && pnpm run check + + - name: Format check on svelte-todo + run: cd packages/svelte-todo && pnpm install && pnpm run check + + - name: Format check on vanilla-todo + run: cd packages/vanilla-todo && pnpm install && pnpm run check + + - name: Format check on vue-todo + run: cd packages/vue-todo && pnpm install && pnpm run check \ No newline at end of file diff --git a/packages/react-todo/package.json b/packages/react-todo/package.json index 8e53efb..7de0c79 100644 --- a/packages/react-todo/package.json +++ b/packages/react-todo/package.json @@ -8,7 +8,8 @@ "build": "vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", - "format": "pnpm exec -- npx prettier --write ." + "format": "pnpm exec -- npx prettier --write .", + "check": "pnpm exec -- npx prettier --check ." }, "dependencies": { "react": "^18.2.0", diff --git a/packages/svelte-todo/package.json b/packages/svelte-todo/package.json index 646d184..a19cfb8 100644 --- a/packages/svelte-todo/package.json +++ b/packages/svelte-todo/package.json @@ -11,6 +11,7 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --plugin-search-dir . --check . && eslint .", "format": "prettier --plugin-search-dir . --write .", + "prettier:check": "pnpm exec -- npx prettier --plugin-search-dir . --check .", "test:integration": "playwright test", "test:unit": "vitest" }, @@ -33,4 +34,4 @@ "vitest": "^0.32.2" }, "type": "module" -} +} \ No newline at end of file diff --git a/packages/vanilla-todo/css/style.css b/packages/vanilla-todo/css/style.css index d756cec..3e23e91 100644 --- a/packages/vanilla-todo/css/style.css +++ b/packages/vanilla-todo/css/style.css @@ -1,117 +1,117 @@ body { - background: #fff; - color: #333; - font-family: Lato, sans-serif; + background: #fff; + color: #333; + font-family: Lato, sans-serif; } .container { - display: block; - width: 400px; - margin: 100px auto 0; + display: block; + width: 400px; + margin: 100px auto 0; } ul { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } li { - float: left; + float: left; } -li, h3 { - clear:both; - list-style:none; +li, +h3 { + clear: both; + list-style: none; } -input, button { - outline: none; +input, +button { + outline: none; } button { - background: none; - border: 0px; - color: #888; - font-size: 15px; - width: 60px; - margin: 10px 0 0; - font-family: Lato, sans-serif; - cursor: pointer; + background: none; + border: 0px; + color: #888; + font-size: 15px; + width: 60px; + margin: 10px 0 0; + font-family: Lato, sans-serif; + cursor: pointer; } button:hover { - color: #333; + color: #333; } h3, -label[for='new-task'] { - color: #333; - font-weight: 700; - font-size: 15px; - border-bottom: 2px solid #333; - padding: 30px 0 10px; - margin: 0; - text-transform: uppercase; +label[for="new-task"] { + color: #333; + font-weight: 700; + font-size: 15px; + border-bottom: 2px solid #333; + padding: 30px 0 10px; + margin: 0; + text-transform: uppercase; } input[type="text"] { - margin: 0; - font-size: 18px; - line-height: 18px; - height: 18px; - padding: 10px; - border: 1px solid #ddd; - background: #fff; - border-radius: 6px; - font-family: Lato, sans-serif; - color: #888; + margin: 0; + font-size: 18px; + line-height: 18px; + height: 18px; + padding: 10px; + border: 1px solid #ddd; + background: #fff; + border-radius: 6px; + font-family: Lato, sans-serif; + color: #888; } input[type="text"]:focus { - color: #333; + color: #333; } -label[for='new-task'] { - display: block; - margin: 0 0 20px; +label[for="new-task"] { + display: block; + margin: 0 0 20px; } input#new-task { - float: left; - width: 318px; + float: left; + width: 318px; } p > button:hover { - color: #0FC57C; + color: #0fc57c; } -/ Task list / -li { - overflow: hidden; - padding: 20px 0; - border-bottom: 1px solid #eee; +/ Task list / li { + overflow: hidden; + padding: 20px 0; + border-bottom: 1px solid #eee; } li > input[type="checkbox"] { - margin: 0 10px; - position: relative; - top: 15px; + margin: 0 10px; + position: relative; + top: 15px; } li > label { - font-size: 18px; - line-height: 40px; - width: 237px; - padding: 0 0 0 11px; + font-size: 18px; + line-height: 40px; + width: 237px; + padding: 0 0 0 11px; } -li > input[type="text"] { - width: 226px; +li > input[type="text"] { + width: 226px; } li > .delete:hover { - color: #CF2323; + color: #cf2323; } - #completed-tasks label { - text-decoration: line-through; - color: #888; + text-decoration: line-through; + color: #888; } ul li input[type="text"] { - display: none; + display: none; } ul li.editMode input[type="text"] { - display: block; + display: block; } ul li.editMode label { - display: none; + display: none; } diff --git a/packages/vanilla-todo/index.html b/packages/vanilla-todo/index.html index 56092d5..474d0c2 100644 --- a/packages/vanilla-todo/index.html +++ b/packages/vanilla-todo/index.html @@ -1,4 +1,4 @@ - + Todo App @@ -54,4 +54,4 @@

Completed

- \ No newline at end of file + diff --git a/packages/vanilla-todo/package.json b/packages/vanilla-todo/package.json index 508c98c..91c8e18 100644 --- a/packages/vanilla-todo/package.json +++ b/packages/vanilla-todo/package.json @@ -7,7 +7,8 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "format": "pnpm exec -- npx prettier --write ." + "format": "pnpm exec -- npx prettier --write .", + "check": "pnpm exec -- npx prettier --check ." }, "devDependencies": { "vite": "^4.4.5" diff --git a/packages/vue-todo/package.json b/packages/vue-todo/package.json index 3edd80c..25a1786 100644 --- a/packages/vue-todo/package.json +++ b/packages/vue-todo/package.json @@ -7,7 +7,8 @@ "dev": "vite", "build": "vue-tsc && vite build", "preview": "vite preview", - "format": "pnpm exec -- npx prettier --write ." + "format": "pnpm exec -- npx prettier --write .", + "check": "pnpm exec -- npx prettier --check ." }, "dependencies": { "vue": "^3.3.4"