style: enable no-non-null-assertion rule (#2723)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
LongYinan
2023-06-08 15:23:20 +08:00
committed by GitHub
parent 1ad2e629ac
commit 18dc427bc3
16 changed files with 196 additions and 147 deletions

View File

@@ -10,9 +10,7 @@ export abstract class BaseSQLiteAdapter {
db: SqliteConnection | null = null;
abstract role: string;
constructor(public readonly path: string) {
logger.info(`[SQLiteAdapter]`, 'path:', path);
}
constructor(public readonly path: string) {}
async connectIfNeeded() {
if (!this.db) {

View File

@@ -100,6 +100,7 @@ function getWorkspaceDB$(id: string) {
)
);
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return db$Map.get(id)!;
}

View File

@@ -107,7 +107,6 @@ export class SecondaryWorkspaceSQLiteDB extends BaseSQLiteAdapter {
return;
}
this.firstConnected = true;
const { db } = this;
const onUpstreamUpdate = (update: Uint8Array, origin: YOrigin) => {
if (origin === 'renderer') {
@@ -118,8 +117,8 @@ export class SecondaryWorkspaceSQLiteDB extends BaseSQLiteAdapter {
const onSelfUpdate = (update: Uint8Array, origin: YOrigin) => {
// for self update from upstream, we need to push it to external DB
if (origin === 'upstream') {
this.addUpdateToUpdateQueue(db!, update);
if (origin === 'upstream' && this.db) {
this.addUpdateToUpdateQueue(this.db, update);
}
if (origin === 'self') {

View File

@@ -67,7 +67,7 @@ export const registerUpdater = async () => {
// register events for checkForUpdatesAndNotify
_autoUpdater.on('update-available', info => {
if (allowAutoUpdate) {
_autoUpdater!.downloadUpdate();
_autoUpdater?.downloadUpdate();
logger.info('Update available, downloading...', info);
}
updaterSubjects.updateAvailable.next({