From 75c633dcb503041647d7286eb57b6d0663758eee Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:46:53 -0800 Subject: [PATCH] frontend: cleanup * dummy commit * cleanup workflows * setup and run eslint * add linter to CI * use eslint for formatting * reorder rules * drop editor config --- .../{go.yaml => partial-backend.yaml} | 3 - .../{frontend.yaml => partial-frontend.yaml} | 4 + .github/workflows/publish.yaml | 4 +- .github/workflows/pull-requests.yaml | 4 +- README.md | 1 + frontend/.editorconfig | 12 - frontend/.eslintrc.js | 51 + frontend/.prettierrc | 10 - frontend/components/App/Header.vue | 28 +- frontend/components/App/Toast.vue | 2 +- frontend/components/Base/ActionsDivider.vue | 4 +- frontend/components/Base/Button.vue | 17 +- frontend/components/Base/Container.vue | 6 +- frontend/components/Base/Details.vue | 2 +- frontend/components/Base/Modal.vue | 10 +- frontend/components/Form/DatePicker.vue | 25 +- frontend/components/Form/Multiselect.vue | 17 +- frontend/components/Form/Select.vue | 14 +- frontend/components/Form/TextArea.vue | 19 +- frontend/components/Form/TextField.vue | 10 +- frontend/components/Icon.vue | 10 +- frontend/components/Item/Card.vue | 9 +- frontend/components/Item/CreateModal.vue | 30 +- frontend/components/Label/Chip.vue | 8 +- frontend/components/Label/CreateModal.vue | 24 +- frontend/components/Location/Card.vue | 2 +- frontend/components/Location/CreateModal.vue | 18 +- frontend/components/ModalConfirm.vue | 2 +- frontend/composables/use-api.ts | 12 +- frontend/composables/use-confirm.ts | 10 +- frontend/composables/use-ids.ts | 60 +- frontend/composables/use-notifier.ts | 82 +- frontend/composables/use-preferences.ts | 4 +- frontend/composables/use-strings.ts | 2 +- frontend/lib/api/__test__/public.test.ts | 22 +- frontend/lib/api/__test__/test-utils.ts | 30 +- frontend/lib/api/__test__/user/labels.test.ts | 30 +- .../lib/api/__test__/user/locations.test.ts | 24 +- frontend/lib/api/base/base-api.ts | 2 +- frontend/lib/api/base/index.test.ts | 30 +- frontend/lib/api/base/index.ts | 4 +- frontend/lib/api/base/urls.ts | 6 +- frontend/lib/api/classes/items.ts | 26 +- frontend/lib/api/classes/labels.ts | 20 +- frontend/lib/api/classes/locations.ts | 21 +- frontend/lib/api/public.ts | 8 +- frontend/lib/api/user.ts | 16 +- frontend/lib/requests/index.ts | 2 +- frontend/lib/requests/requests.ts | 20 +- frontend/nuxt.config.ts | 14 +- frontend/package.json | 12 + frontend/pages/[...all].vue | 12 +- frontend/pages/home.vue | 32 +- frontend/pages/index.vue | 62 +- frontend/pages/item/[id]/edit.vue | 86 +- frontend/pages/item/[id]/index.vue | 54 +- frontend/pages/item/new.vue | 70 +- frontend/pages/label/[id].vue | 56 +- frontend/pages/location/[id].vue | 54 +- frontend/pnpm-lock.yaml | 1413 ++++++++++++++++- frontend/postcss.config.js | 2 +- frontend/stores/auth.ts | 24 +- frontend/tailwind.config.js | 10 +- frontend/test/config.ts | 1 - frontend/test/setup.ts | 10 +- 65 files changed, 2048 insertions(+), 641 deletions(-) rename .github/workflows/{go.yaml => partial-backend.yaml} (87%) rename .github/workflows/{frontend.yaml => partial-frontend.yaml} (88%) delete mode 100644 frontend/.editorconfig create mode 100644 frontend/.eslintrc.js delete mode 100644 frontend/.prettierrc diff --git a/.github/workflows/go.yaml b/.github/workflows/partial-backend.yaml similarity index 87% rename from .github/workflows/go.yaml rename to .github/workflows/partial-backend.yaml index 98b140e..f01a0df 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/partial-backend.yaml @@ -32,6 +32,3 @@ jobs: - name: Test run: task api:coverage - - - name: Upload coverage to Codecov - run: cd backend && bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/frontend.yaml b/.github/workflows/partial-frontend.yaml similarity index 88% rename from .github/workflows/frontend.yaml rename to .github/workflows/partial-frontend.yaml index 9cab605..fcbfcbd 100644 --- a/.github/workflows/frontend.yaml +++ b/.github/workflows/partial-frontend.yaml @@ -32,5 +32,9 @@ jobs: run: pnpm install working-directory: frontend + - name: Run linter 👀 + run: pnpm lint + working-directory: "frontend" + - name: Run Integration Tests run: task test:ci diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b6d3b76..829b02f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -11,11 +11,11 @@ env: jobs: backend-tests: name: "Backend Server Tests" - uses: hay-kot/homebox/.github/workflows/go.yaml@main + uses: hay-kot/homebox/.github/workflows/partial-backend.yaml@main frontend-tests: name: "Frontend and End-to-End Tests" - uses: hay-kot/homebox/.github/workflows/frontend.yaml@main + uses: hay-kot/homebox/.github/workflows/partial-frontend.yaml@main deploy: name: "Deploy Nightly to Fly.io" diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 7c93e8c..1ccdec6 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -8,8 +8,8 @@ on: jobs: backend-tests: name: "Backend Server Tests" - uses: hay-kot/homebox/.github/workflows/go.yaml@main + uses: hay-kot/homebox/.github/workflows/partial-backend.yaml@main frontend-tests: name: "Frontend and End-to-End Tests" - uses: hay-kot/homebox/.github/workflows/frontend.yaml@main + uses: hay-kot/homebox/.github/workflows/partial-frontend.yaml@main diff --git a/README.md b/README.md index 08a776c..bd53229 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@

+ ## MVP Todo - [x] Locations diff --git a/frontend/.editorconfig b/frontend/.editorconfig deleted file mode 100644 index 9554c73..0000000 --- a/frontend/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true - -# Matches multiple files with brace expansion notation -[*.{js,jsx,html,sass,vue,ts,tsx,json}] -charset = utf-8 -indent_style = tab -indent_size = 4 -trim_trailing_whitespace = true diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js new file mode 100644 index 0000000..fa57669 --- /dev/null +++ b/frontend/.eslintrc.js @@ -0,0 +1,51 @@ +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + }, + extends: [ + "eslint:recommended", + "plugin:vue/essential", + "plugin:@typescript-eslint/recommended", + "@nuxtjs/eslint-config-typescript", + "plugin:vue/vue3-recommended", + "plugin:prettier/recommended", + ], + parserOptions: { + ecmaVersion: "latest", + parser: "@typescript-eslint/parser", + sourceType: "module", + }, + plugins: ["vue", "@typescript-eslint"], + rules: { + "no-console": 0, + "no-unused-vars": "off", + "vue/multi-word-component-names": "off", + "vue/no-setup-props-destructure": 0, + "vue/no-multiple-template-root": 0, + "vue/no-v-model-argument": 0, + "@typescript-eslint/ban-ts-comment": 0, + "@typescript-eslint/no-unused-vars": [ + "error", + { + ignoreRestSiblings: true, + destructuredArrayIgnorePattern: "_", + caughtErrors: "none", + }, + ], + "prettier/prettier": [ + "warn", + { + arrowParens: "avoid", + semi: true, + tabWidth: 2, + useTabs: false, + vueIndentScriptAndStyle: true, + singleQuote: false, + trailingComma: "es5", + printWidth: 120, + }, + ], + }, +}; diff --git a/frontend/.prettierrc b/frontend/.prettierrc deleted file mode 100644 index b12bbd4..0000000 --- a/frontend/.prettierrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "arrowParens": "avoid", - "semi": true, - "tabWidth": 2, - "useTabs": false, - "vueIndentScriptAndStyle": true, - "singleQuote": true, - "trailingComma": "es5", - "printWidth": 120 -} \ No newline at end of file diff --git a/frontend/components/App/Header.vue b/frontend/components/App/Header.vue index 54d2e0f..ca876df 100644 --- a/frontend/components/App/Header.vue +++ b/frontend/components/App/Header.vue @@ -1,5 +1,5 @@ diff --git a/frontend/components/Base/ActionsDivider.vue b/frontend/components/Base/ActionsDivider.vue index e943c05..c1199bd 100644 --- a/frontend/components/Base/ActionsDivider.vue +++ b/frontend/components/Base/ActionsDivider.vue @@ -1,11 +1,11 @@