update code to prevent of eslint escapes

This commit is contained in:
Abhinav 2023-02-10 10:24:11 +05:30
parent 9c613f42ef
commit 2e3b0bb242
3 changed files with 12 additions and 16 deletions

View file

@ -120,7 +120,6 @@ export default function SearchInput(props: Iprops) {
// unwanted side effect: placeholder is not shown on focus/click // unwanted side effect: placeholder is not shown on focus/click
// https://github.com/JedWatson/react-select/issues/1879 // https://github.com/JedWatson/react-select/issues/1879
// for correct fix AsyncSelect can be extended to support default options reloading on focus/click // for correct fix AsyncSelect can be extended to support default options reloading on focus/click
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleOnFocus = () => { const handleOnFocus = () => {
refreshDefaultOptions(); refreshDefaultOptions();
}; };

View file

@ -38,8 +38,7 @@ class MLWorkManager {
}); });
this.mlSearchEnabled = false; this.mlSearchEnabled = false;
// eslint-disable-next-line @typescript-eslint/unbound-method eventBus.on(Events.LOGOUT, this.logoutHandler.bind(this), this);
eventBus.on(Events.LOGOUT, this.logoutHandler, this);
this.debouncedLiveSyncIdle = debounce( this.debouncedLiveSyncIdle = debounce(
() => this.onLiveSyncIdle(), () => this.onLiveSyncIdle(),
LIVE_SYNC_IDLE_DEBOUNCE_SEC * 1000 LIVE_SYNC_IDLE_DEBOUNCE_SEC * 1000
@ -58,8 +57,11 @@ class MLWorkManager {
logQueueStats(this.liveSyncQueue, 'livesync'); logQueueStats(this.liveSyncQueue, 'livesync');
this.liveSyncQueue.on('idle', this.debouncedLiveSyncIdle, this); this.liveSyncQueue.on('idle', this.debouncedLiveSyncIdle, this);
// eslint-disable-next-line @typescript-eslint/unbound-method eventBus.on(
eventBus.on(Events.FILE_UPLOADED, this.fileUploadedHandler, this); Events.FILE_UPLOADED,
this.fileUploadedHandler.bind(this),
this
);
eventBus.on( eventBus.on(
Events.LOCAL_FILES_UPDATED, Events.LOCAL_FILES_UPDATED,
this.debouncedFilesUpdated, this.debouncedFilesUpdated,
@ -75,8 +77,7 @@ class MLWorkManager {
eventBus.removeListener( eventBus.removeListener(
Events.FILE_UPLOADED, Events.FILE_UPLOADED,
// eslint-disable-next-line @typescript-eslint/unbound-method this.fileUploadedHandler.bind(this),
this.fileUploadedHandler,
this this
); );
eventBus.removeListener( eventBus.removeListener(
@ -85,8 +86,7 @@ class MLWorkManager {
this this
); );
// eslint-disable-next-line @typescript-eslint/await-thenable this.stopSyncJob();
await this.stopSyncJob();
} }
} }
@ -103,8 +103,7 @@ class MLWorkManager {
private async logoutHandler() { private async logoutHandler() {
addLogLine('logoutHandler'); addLogLine('logoutHandler');
try { try {
// eslint-disable-next-line @typescript-eslint/await-thenable this.stopSyncJob();
await this.stopSyncJob();
this.mlSyncJob = undefined; this.mlSyncJob = undefined;
await this.terminateLiveSyncWorker(); await this.terminateLiveSyncWorker();
await mlIDbStorage.clearMLDB(); await mlIDbStorage.clearMLDB();

View file

@ -72,15 +72,13 @@ class MLIDbStorage {
} }
private openDB(): Promise<IDBPDatabase<MLDb>> { private openDB(): Promise<IDBPDatabase<MLDb>> {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const mlIDbStorage = this;
return openDB<MLDb>(MLDATA_DB_NAME, 3, { return openDB<MLDb>(MLDATA_DB_NAME, 3, {
async terminated() { terminated: async () => {
console.error('ML Indexed DB terminated'); console.error('ML Indexed DB terminated');
logError(new Error(), 'ML Indexed DB terminated'); logError(new Error(), 'ML Indexed DB terminated');
mlIDbStorage._db = undefined; this._db = undefined;
// TODO: remove if there is chance of this going into recursion in some case // TODO: remove if there is chance of this going into recursion in some case
await mlIDbStorage.db; await this.db;
}, },
blocked() { blocked() {
// TODO: make sure we dont allow multiple tabs of app // TODO: make sure we dont allow multiple tabs of app