From 7fcd872c259f77ccfe733715c14a3422d9bf4de5 Mon Sep 17 00:00:00 2001 From: Yi Lei Feng Date: Wed, 17 May 2023 11:56:09 -0400 Subject: [PATCH] fix project TS warnings + add user alerts for navigating away from routes with unsaved editor work --- .eslintrc.js | 1 + src/app.vue | 2 +- src/components/editor/chart-editor.vue | 17 +- src/components/editor/dynamic-editor.vue | 74 ++++--- src/components/editor/editor.vue | 37 ++-- .../editor/helpers/chart-preview.vue | 17 +- .../editor/helpers/confirmation-modal.vue | 2 - .../editor/helpers/image-preview.vue | 2 +- .../editor/helpers/metadata-content.vue | 8 +- src/components/editor/image-editor.vue | 29 +-- src/components/editor/map-editor.vue | 39 ++-- src/components/editor/metadata-editor.vue | 201 ++++++++++-------- src/components/editor/preview.vue | 12 +- src/components/editor/slide-editor.vue | 83 +++++--- src/components/editor/slide-toc.vue | 83 +++++--- src/components/editor/text-editor.vue | 19 +- src/components/panels/audio-panel.vue | 2 +- src/components/panels/chart-panel.vue | 4 +- src/components/panels/dynamic-panel.vue | 2 +- src/components/panels/helpers/chart.vue | 4 +- src/components/panels/helpers/fullscreen.vue | 2 +- src/components/panels/helpers/scrollguard.vue | 2 +- src/components/panels/helpers/time-slider.vue | 4 +- src/components/panels/image-panel.vue | 2 +- src/components/panels/map-panel.vue | 4 +- src/components/panels/panel.vue | 4 +- src/components/panels/slideshow-panel.vue | 4 +- src/components/panels/video-panel.vue | 2 +- src/components/story/chapter-menu.vue | 2 +- src/components/story/introduction.vue | 2 +- src/components/story/mobile-menu.vue | 2 +- src/components/story/slide.vue | 2 +- src/components/story/story-content.vue | 2 +- src/definitions.ts | 38 ++++ src/shims-tsx.d.ts | 6 +- src/types.d.ts | 2 + 36 files changed, 439 insertions(+), 279 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index cecec45a..3d5ca672 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,6 +17,7 @@ module.exports = { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'prettier/prettier': ['error', { endOfLine: 'auto' }], + 'sort-imports': ['error', {"ignoreCase": true, "ignoreDeclarationSort": true }], '@typescript-eslint/no-var-requires': 'off' }, globals: { diff --git a/src/app.vue b/src/app.vue index 6827b179..dab2afd9 100644 --- a/src/app.vue +++ b/src/app.vue @@ -11,7 +11,7 @@ import { Route } from 'vue-router'; @Component({}) export default class App extends Vue { @Watch('$route', { immediate: true }) - onRouteUpdate(to: Route, from: Route) { + onRouteUpdate(to: Route): void { this.$i18n.locale = to.params.lang ?? 'en'; document.title = this.$t(to.meta?.title).toString(); } diff --git a/src/components/editor/chart-editor.vue b/src/components/editor/chart-editor.vue index b6c97b29..192a3ad3 100644 --- a/src/components/editor/chart-editor.vue +++ b/src/components/editor/chart-editor.vue @@ -59,8 +59,8 @@ diff --git a/src/components/editor/preview.vue b/src/components/editor/preview.vue index 3c25185f..906da9b2 100644 --- a/src/components/editor/preview.vue +++ b/src/components/editor/preview.vue @@ -46,8 +46,8 @@