From 58621d3da489c447f858f2a31ac5103d0d13f50b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 5 Dec 2021 23:51:44 +0100 Subject: [PATCH] chore(ui): Fix code formatting --- .eslintrc.js | 18 +++---- package.json | 2 +- src/components/Widget.vue | 4 +- src/components/management/EditEvent.vue | 19 +++---- src/components/management/EditJobSlot.vue | 10 ++-- src/components/management/ManageTypes.vue | 50 ++++++++++++------- src/components/management/RecurrenceRule.vue | 2 +- src/components/overview/ListView.vue | 2 +- .../overview/slots/TransferInviteDialog.vue | 2 +- src/pages/EventOverview.vue | 6 +-- 10 files changed, 59 insertions(+), 56 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ab9cd5e..04a4ce8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,11 +17,11 @@ module.exports = { project: resolve(__dirname, './tsconfig.json'), tsconfigRootDir: __dirname, ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features - sourceType: 'module' // Allows for the use of imports + sourceType: 'module', // Allows for the use of imports }, env: { - browser: true + browser: true, }, // Rules order is important, please avoid shuffling them @@ -44,7 +44,7 @@ module.exports = { // https://github.com/prettier/eslint-config-prettier#installation // usage with Prettier, provided by 'eslint-config-prettier'. - 'prettier', //'plugin:prettier/recommended' + 'plugin:prettier/recommended' ], plugins: [ @@ -54,10 +54,6 @@ module.exports = { // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file // required to lint *.vue files 'vue', - - // https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674 - // Prettier has not been included as plugin to avoid performance impact - // add it as an extension for your IDE ], // add your custom rules here @@ -66,10 +62,8 @@ module.exports = { // TypeScript quotes: ['warn', 'single', { avoidEscape: true }], - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', // allow debugger during development only - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' - } -} + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + }, +}; diff --git a/package.json b/package.json index 3a6bc5f..e48be8a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "main": "src/index.ts", "types": "src/api.d.ts", "scripts": { - "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'", + "format": "prettier --config ./package.json --write '{,!(node_modules|backend)/**/}*.{js,ts,vue}'", "lint": "eslint --ext .js,.ts,.vue ./src" }, "dependencies": { diff --git a/src/components/Widget.vue b/src/components/Widget.vue index 139616d..8a075ae 100644 --- a/src/components/Widget.vue +++ b/src/components/Widget.vue @@ -2,9 +2,9 @@
- +
-
+
Anstehende Dienste
{{ jobs }}
Nächster Dienst
diff --git a/src/components/management/EditEvent.vue b/src/components/management/EditEvent.vue index 70c954d..b148395 100644 --- a/src/components/management/EditEvent.vue +++ b/src/components/management/EditEvent.vue @@ -140,16 +140,6 @@ export default defineComponent({ }, setup(props, { emit }) { const store = useEventStore(); - const startDate = computed(() => { - const d = date.buildDate({ milliseconds: 0, seconds: 0, minutes: 0, hours: 0 }); - if (!props.date || !date.isValid(props.date)) return d; - const split = props.date.split('-'); - return date.adjustDate(d, { - year: parseInt(split[0]), - month: parseInt(split[1]), - date: parseInt(split[2]), - }); - }); const active = ref(0); const activeJob = ref<{ validate: () => Promise }>(); @@ -166,9 +156,12 @@ export default defineComponent({ void store.getTemplates(); }); - watch(props, (n, o) => { - if (event.value?.id !== n.modelValue?.id) reset(); - }); + watch( + () => props.modelValue, + (newModelValue) => { + if (event.value?.id !== newModelValue?.id) reset(); + } + ); function addJob() { if (!activeJob.value) event.value.jobs.push(emptyJob()); diff --git a/src/components/management/EditJobSlot.vue b/src/components/management/EditJobSlot.vue index c4291ac..1c83610 100644 --- a/src/components/management/EditJobSlot.vue +++ b/src/components/management/EditJobSlot.vue @@ -57,7 +57,12 @@ - + @@ -126,7 +131,7 @@ export default defineComponent({ } expose({ - validate: () => form.value?.validate() || Promise.resolve(true) + validate: () => form.value?.validate() || Promise.resolve(true), }); return { @@ -140,7 +145,6 @@ export default defineComponent({ }; }, }); - diff --git a/src/components/management/ManageTypes.vue b/src/components/management/ManageTypes.vue index a40851d..2cd2ef1 100644 --- a/src/components/management/ManageTypes.vue +++ b/src/components/management/ManageTypes.vue @@ -3,14 +3,27 @@ -
Editere {{title}} {{ actualType.name }}
+
Editere {{ title }} {{ actualType.name }}
- + - +
@@ -33,11 +46,7 @@ @@ -56,9 +65,9 @@ import { useQuasar, QInput } from 'quasar'; export default defineComponent({ name: 'ManageTypes', components: {}, - props:{ - type: {type: String as PropType<'EventType' | 'JobType'>, required: true}, - title: {type: String, required: true} + props: { + type: { type: String as PropType<'EventType' | 'JobType'>, required: true }, + title: { type: String, required: true }, }, setup(props) { const store = useEventStore(); @@ -69,17 +78,16 @@ export default defineComponent({ const actualType = ref(emptyType); const input = ref(); const dialogInput = ref(); - const storeName = computed(() => props.type == 'EventType' ? 'eventTypes' : 'jobTypes') + const storeName = computed(() => (props.type == 'EventType' ? 'eventTypes' : 'jobTypes')); onBeforeMount(async () => await store[`get${props.type}s`]()); - const rows = computed(() => <(FG.EventType|FG.JobType)[]>store[storeName.value]); + const rows = computed(() => <(FG.EventType | FG.JobType)[]>store[storeName.value]); const rules = [ (s: unknown) => !!s || 'Darf nicht leer sein!', (s: string) => - rows.value.find((e) => e.name === s) === undefined || - 'Der Name wird bereits verwendet', + rows.value.find((e) => e.name === s) === undefined || 'Der Name wird bereits verwendet', ]; const columns = [ @@ -100,8 +108,7 @@ export default defineComponent({ function addType() { if (input.value === undefined || input.value.validate()) - store - [`add${props.type}`](actualType.value.name) + store[`add${props.type}`](actualType.value.name) .then(() => { actualType.value.name = ''; }) @@ -121,12 +128,17 @@ export default defineComponent({ function editType(id: number) { dialogOpen.value = true; - actualType.value = Object.assign({}, rows.value.find((v) => v.id === id)); + actualType.value = Object.assign( + {}, + rows.value.find((v) => v.id === id) + ); } function saveChanges() { if (dialogInput.value === undefined || dialogInput.value.validate()) - void store[`rename${props.type}`](actualType.value.id, actualType.value.name).then(() => discardChanges()); + void store[`rename${props.type}`](actualType.value.id, actualType.value.name).then(() => + discardChanges() + ); } function discardChanges() { diff --git a/src/components/management/RecurrenceRule.vue b/src/components/management/RecurrenceRule.vue index cc52dee..d0132fc 100644 --- a/src/components/management/RecurrenceRule.vue +++ b/src/components/management/RecurrenceRule.vue @@ -63,7 +63,7 @@ export default defineComponent({ const rule = new Proxy(props.modelValue, { get(target, prop) { if (typeof prop === 'string') { - return ((props.modelValue as unknown) as Record)[prop]; + return (props.modelValue as unknown as Record)[prop]; } }, set(target, prop, value) { diff --git a/src/components/overview/ListView.vue b/src/components/overview/ListView.vue index 0ec9e9e..fd47f2d 100644 --- a/src/components/overview/ListView.vue +++ b/src/components/overview/ListView.vue @@ -18,7 +18,7 @@
-
+
diff --git a/src/components/overview/slots/TransferInviteDialog.vue b/src/components/overview/slots/TransferInviteDialog.vue index bd4cc1e..d28f513 100644 --- a/src/components/overview/slots/TransferInviteDialog.vue +++ b/src/components/overview/slots/TransferInviteDialog.vue @@ -81,4 +81,4 @@ export default defineComponent({ }; }, }); - \ No newline at end of file + diff --git a/src/pages/EventOverview.vue b/src/pages/EventOverview.vue index 769183c..fd85bd6 100644 --- a/src/pages/EventOverview.vue +++ b/src/pages/EventOverview.vue @@ -54,10 +54,10 @@ export default defineComponent({ setup() { const quasar = useQuasar(); - const tabs = computed(() => ([ + const tabs = computed(() => [ { name: 'listView', label: 'Liste' }, - { name: 'agendaView', label: 'Kalendar' } - ])); + { name: 'agendaView', label: 'Kalendar' }, + ]); const drawer = ref(false);