diff --git a/.eslintrc.js b/.eslintrc.js index 93c1775a..7b221393 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,17 @@ module.exports = { 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'plugin:prettier/recommended', ], + overrides: [ + { + files: ['*.vue'], + rules: { + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + }, + }, + ], ignorePatterns: [ '*.mjs', '.eslintrc.js', @@ -46,5 +57,6 @@ module.exports = { '*.spec.ts', 'vite.config.ts', 'postcss.config.js', + 'src/components/**/*.vue', // Incrementally fix these ], }; diff --git a/fyo/core/dbHandler.ts b/fyo/core/dbHandler.ts index 7610024b..a49489ea 100644 --- a/fyo/core/dbHandler.ts +++ b/fyo/core/dbHandler.ts @@ -305,7 +305,7 @@ export class DatabaseHandler extends DatabaseBase { )) as IncomeExpense; } - async getTotalCreditAndDebit(): Promise { + async getTotalCreditAndDebit(): Promise { return (await this.#demux.callBespoke( 'getTotalCreditAndDebit' )) as TotalCreditAndDebit[]; diff --git a/src/App.vue b/src/App.vue index 5e03cd09..58a95371 100644 --- a/src/App.vue +++ b/src/App.vue @@ -116,12 +116,12 @@ export default defineComponent({ }, }, watch: { - language(value) { + language(value: string) { this.languageDirection = getLanguageDirection(value); }, }, async mounted() { - this.setInitialScreen(); + await this.setInitialScreen(); }, methods: { async setInitialScreen(): Promise { @@ -209,7 +209,8 @@ export default defineComponent({ } if (actionSymbol === dbErrorActionSymbols.SelectFile) { - return await this.databaseSelector?.existingDatabase(); + await this.databaseSelector?.existingDatabase(); + return; } throw error; @@ -219,9 +220,9 @@ export default defineComponent({ const { hideGetStarted } = await fyo.doc.getDoc('SystemSettings'); if (hideGetStarted || onboardingComplete) { - routeTo('/'); + await routeTo('/'); } else { - routeTo('/get-started'); + await routeTo('/get-started'); } }, async showDbSelector(): Promise { diff --git a/src/components/FilterDropdown.vue b/src/components/FilterDropdown.vue index 7917964d..49fd5f9b 100644 --- a/src/components/FilterDropdown.vue +++ b/src/components/FilterDropdown.vue @@ -93,7 +93,7 @@ fieldname: 'value', fieldtype: 'Data', }" - :value="filter.value" + :value="String(filter.value)" @change="(value) => (filter.value = value)" /> @@ -127,7 +127,7 @@ diff --git a/src/pages/CommonForm/CommonForm.vue b/src/pages/CommonForm/CommonForm.vue index 0fac81e2..c093809c 100644 --- a/src/pages/CommonForm/CommonForm.vue +++ b/src/pages/CommonForm/CommonForm.vue @@ -81,13 +81,13 @@
(); } return group; @@ -361,7 +361,7 @@ export default defineComponent({ return getGroupedActionsForDoc(this.doc); }, }, - async beforeMount() { + beforeMount() { this.useFullWidth = !!this.fyo.singles.Misc?.useFullWidth; }, async mounted() { @@ -438,14 +438,14 @@ export default defineComponent({ this.name ); }, - async replacePathAfterSync() { + replacePathAfterSync() { if (!this.hasDoc || this.doc.inserted) { return; } - this.doc.once('afterSync', () => { + this.doc.once('afterSync', async () => { const route = getFormRoute(this.schemaName, this.doc.name!); - this.$router.replace(route); + await this.$router.replace(route); }); }, async showRowEditForm(doc: Doc) { diff --git a/src/pages/CommonForm/CommonFormSection.vue b/src/pages/CommonForm/CommonFormSection.vue index 903391cb..702c94bf 100644 --- a/src/pages/CommonForm/CommonFormSection.vue +++ b/src/pages/CommonForm/CommonFormSection.vue @@ -56,6 +56,7 @@
diff --git a/src/pages/Dashboard/Cashflow.vue b/src/pages/Dashboard/Cashflow.vue index b63b1890..5d6a428e 100644 --- a/src/pages/Dashboard/Cashflow.vue +++ b/src/pages/Dashboard/Cashflow.vue @@ -42,7 +42,7 @@ /> - diff --git a/src/pages/Dashboard/PeriodSelector.vue b/src/pages/Dashboard/PeriodSelector.vue index 93d68c3d..db9f7237 100644 --- a/src/pages/Dashboard/PeriodSelector.vue +++ b/src/pages/Dashboard/PeriodSelector.vue @@ -35,27 +35,30 @@ - diff --git a/src/pages/Dashboard/ProfitAndLoss.vue b/src/pages/Dashboard/ProfitAndLoss.vue index bb3e12a6..73c2a2a5 100644 --- a/src/pages/Dashboard/ProfitAndLoss.vue +++ b/src/pages/Dashboard/ProfitAndLoss.vue @@ -29,7 +29,7 @@ - diff --git a/src/pages/Dashboard/UnpaidInvoices.vue b/src/pages/Dashboard/UnpaidInvoices.vue index fa071f56..c5fbe059 100644 --- a/src/pages/Dashboard/UnpaidInvoices.vue +++ b/src/pages/Dashboard/UnpaidInvoices.vue @@ -89,11 +89,17 @@ import { getDatesAndPeriodList } from 'src/utils/misc'; import { PeriodKey } from 'src/utils/types'; import { routeTo } from 'src/utils/ui'; import { safeParseFloat } from 'utils/index'; -import { defineComponent } from 'vue'; +import { PropType, defineComponent } from 'vue'; import BaseDashboardChart from './BaseDashboardChart.vue'; import PeriodSelector from './PeriodSelector.vue'; import SectionHeader from './SectionHeader.vue'; +// Linting broken in this file cause of `extends: ...` +/* + eslint-disable @typescript-eslint/no-unsafe-argument, + @typescript-eslint/restrict-template-expressions, + @typescript-eslint/no-unsafe-return +*/ export default defineComponent({ name: 'UnpaidInvoices', components: { @@ -103,7 +109,7 @@ export default defineComponent({ }, extends: BaseDashboardChart, props: { - schemaName: { type: String, required: true }, + schemaName: { type: String as PropType, required: true }, }, data() { return { @@ -211,7 +217,7 @@ export default defineComponent({ }, async newInvoice() { const doc = fyo.doc.getNewDoc(this.schemaName); - await routeTo(`/edit/${this.schemaName}/${doc.name}`); + await routeTo(`/edit/${this.schemaName}/${doc.name!}`); }, async getCounts(schemaName: string, fromDate: DateTime, toDate: DateTime) { diff --git a/src/pages/DatabaseSelector.vue b/src/pages/DatabaseSelector.vue index 0665949d..3ae57d21 100644 --- a/src/pages/DatabaseSelector.vue +++ b/src/pages/DatabaseSelector.vue @@ -280,7 +280,7 @@ export default defineComponent({ }, async deleteDb(i: number) { const file = this.files[i]; - const vm = this; + const setFiles = this.setFiles.bind(this); await showDialog({ title: t`Delete ${file.companyName}?`, @@ -291,13 +291,15 @@ export default defineComponent({ label: this.t`Yes`, async action() { await deleteDb(file.dbPath); - await vm.setFiles(); + await setFiles(); }, isPrimary: true, }, { label: this.t`No`, - action() {}, + action() { + return null; + }, isEscape: true, }, ], @@ -305,7 +307,7 @@ export default defineComponent({ }, async createDemo() { if (!fyo.store.isDevelopment) { - this.startDummyInstanceSetup(); + await this.startDummyInstanceSetup(); } else { this.openModal = true; } @@ -363,14 +365,14 @@ export default defineComponent({ const filePath = (await getSelectedFilePath())?.filePaths?.[0]; this.emitFileSelected(filePath); }, - async selectFile(file: ConfigFilesWithModified) { + selectFile(file: ConfigFilesWithModified) { if (this.creatingDemo) { return; } - await this.emitFileSelected(file.dbPath); + this.emitFileSelected(file.dbPath); }, - async emitFileSelected(filePath: string, isNew?: boolean) { + emitFileSelected(filePath: string, isNew?: boolean) { if (!filePath) { return; } diff --git a/src/pages/Desk.vue b/src/pages/Desk.vue index ac925e54..9ae4e42b 100644 --- a/src/pages/Desk.vue +++ b/src/pages/Desk.vue @@ -5,6 +5,7 @@ import { toggleSidebar } from 'src/utils/ui'; - diff --git a/src/pages/ImportWizard.vue b/src/pages/ImportWizard.vue index 05ca39b7..012722cc 100644 --- a/src/pages/ImportWizard.vue +++ b/src/pages/ImportWizard.vue @@ -384,10 +384,10 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue'; import FormHeader from 'src/components/FormHeader.vue'; import Modal from 'src/components/Modal.vue'; import PageHeader from 'src/components/PageHeader.vue'; -import { getColumnLabel, Importer, TemplateField } from 'src/importer'; +import { Importer, TemplateField, getColumnLabel } from 'src/importer'; import { fyo } from 'src/initFyo'; import { showDialog } from 'src/utils/interactive'; -import { getSavePath, saveData, selectFile } from 'src/utils/ipcCalls'; +import { getSavePath, saveData } from 'src/utils/ipcCalls'; import { docsPathMap } from 'src/utils/misc'; import { docsPathRef } from 'src/utils/refs'; import { selectTextFile } from 'src/utils/ui'; @@ -603,7 +603,7 @@ export default defineComponent({ component: { template: `{{ "${selectFileLabel}" }}`, }, - action: this.selectFile, + action: this.selectFile.bind(this), }); } @@ -620,7 +620,7 @@ export default defineComponent({ component: { template: '{{ t`Cancel` }}', }, - action: this.clear, + action: this.clear.bind(this), }; actions.push(pickColumnsAction, cancelAction); @@ -668,8 +668,8 @@ export default defineComponent({ }, pickedArray(): string[] { return [...this.importer.templateFieldsPicked.entries()] - .filter(([_, picked]) => picked) - .map(([key, _]) => key); + .filter(([, picked]) => picked) + .map(([key]) => key); }, }, watch: { @@ -750,7 +750,11 @@ export default defineComponent({ return; } - for (const idx in this.importer.assignedTemplateFields) { + for ( + let idx = 0; + idx < this.importer.assignedTemplateFields.length; + idx++ + ) { this.importer.assignedTemplateFields[idx] = null; } @@ -764,10 +768,10 @@ export default defineComponent({ idx += 1; } }, - showMe(): void { + async showMe(): Promise { const schemaName = this.importer.schemaName; this.clear(); - this.$router.push(`/list/${schemaName}`); + await this.$router.push(`/list/${schemaName}`); }, clear(): void { this.file = null; @@ -821,7 +825,7 @@ export default defineComponent({ title, type: 'error', detail: this.t`Following links do not exist: ${absentLinks - .map((l) => `(${l.schemaLabel}, ${l.name})`) + .map((l) => `(${l.schemaLabel ?? l.schemaName}, ${l.name})`) .join(', ')}.`, }); return false; @@ -883,7 +887,9 @@ export default defineComponent({ }, { label: this.t`No`, - action() {}, + action() { + return null; + }, isEscape: true, }, ], diff --git a/src/pages/ListView/List.vue b/src/pages/ListView/List.vue index 5470f5d7..8d3baea8 100644 --- a/src/pages/ListView/List.vue +++ b/src/pages/ListView/List.vue @@ -37,7 +37,7 @@
-
+

@@ -56,7 +56,7 @@ 'text-end': isNumeric(column.fieldtype), 'pe-4': c === columns.length - 1, }" - :row="row" + :row="(row as RenderData)" :column="column" /> @@ -93,14 +93,16 @@

-