Skip to content

Commit 11b8ac9

Browse files
committed
fix: fix floating-promises errors
1 parent fb33f10 commit 11b8ac9

File tree

13 files changed

+21
-22
lines changed

13 files changed

+21
-22
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = {
7878
"@typescript-eslint/no-base-to-string": 0,
7979
"@typescript-eslint/no-misused-promises": 0,
8080
"@typescript-eslint/require-await": 0,
81-
"@typescript-eslint/no-floating-promises": 0,
81+
"@typescript-eslint/no-floating-promises": "error",
8282
"@typescript-eslint/unbound-method": 0,
8383

8484
"@typescript-eslint/no-unsafe-enum-comparison": 0,

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ setLcpNativePluginPath(lcpNativePluginPath);
7575
initSessionsNoHTTP();
7676

7777
if (__TH__IS_VSCODE_LAUNCH__) {
78-
createStoreFromDi().then((store) => store.dispatch(appActions.initRequest.build()));
78+
void createStoreFromDi().then((store) => store.dispatch(appActions.initRequest.build()));
7979
} else {
8080
commandLineMainEntry(); // call main fct
8181
}

src/main/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const yargsInit = () =>
228228
if (openPublicationRequestedBool) {
229229

230230
// flush session because user ask to read a publication
231-
flushSession();
231+
await flushSession();
232232

233233
// pathArgv can be an url with deepLinkInvocation in windows
234234
// https://github.com/oikonomopo/electron-deep-linking-mac-win
@@ -316,7 +316,7 @@ export function commandLineMainEntry(
316316
debug("processArgv", processArgv, "arg", argFormated);
317317

318318
try {
319-
y.parse(argFormated);
319+
void y.parse(argFormated);
320320
} catch (e) {
321321
debug("YARGS ERROR !!!!!", e);
322322
}

src/main/redux/sagas/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function* opdsRequestMediaFlow({request, callback}: TregisterHttpProtocolHandler
247247
return ;
248248
}
249249

250-
httpGet(url, {
250+
void httpGet(url, {
251251
...request,
252252
}, (response) => {
253253

@@ -755,7 +755,7 @@ function createOpdsAuthenticationModalWin(url: string): BrowserWindow | undefine
755755
win.show();
756756
});
757757

758-
win.loadURL(url);
758+
void win.loadURL(url);
759759

760760
return win;
761761
}

src/main/services/device.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class DeviceIdManager implements IDeviceIDManager {
6565
const deviceConfig: DeviceConfig = {
6666
device_id: deviceId,
6767
};
68-
this.saveDeviceConfigJson(deviceConfig);
68+
await this.saveDeviceConfigJson(deviceConfig);
6969
debug(deviceConfig);
7070
}
7171

@@ -86,7 +86,7 @@ export class DeviceIdManager implements IDeviceIDManager {
8686
deviceConfig,
8787
);
8888
newDeviceConfig[deviceIdKey] = "_"; // deviceId
89-
this.saveDeviceConfigJson(newDeviceConfig);
89+
await this.saveDeviceConfigJson(newDeviceConfig);
9090

9191
debug("DeviceIdManager recordDeviceID:");
9292
debug(key);
@@ -104,7 +104,7 @@ export class DeviceIdManager implements IDeviceIDManager {
104104

105105
_cache = conf;
106106
const str = JSON.stringify(conf);
107-
fs.promises.writeFile(lcpLsdDevicesFilePath, str, { encoding: "utf-8" });
107+
return fs.promises.writeFile(lcpLsdDevicesFilePath, str, { encoding: "utf-8" });
108108
}
109109
private async getDeviceConfigJson(): Promise<DeviceConfig> {
110110

src/main/services/lcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class LcpManager {
160160

161161
const str = JSON.stringify(allSecrets);
162162
const encrypted = encryptPersist(str, CONFIGREPOSITORY_LCP_SECRETS, lcpHashesFilePath);
163-
fs.promises.writeFile(lcpHashesFilePath, encrypted);
163+
return fs.promises.writeFile(lcpHashesFilePath, encrypted);
164164
}
165165

166166
private async injectLcplIntoZip_(epubPath: string, lcpStr: string) {

src/main/streamer/streamerNoHttp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ const streamProtocolHandlerTunnel = async (
300300

301301
debug("............... streamProtocolHandlerTunnel req.url", req.url);
302302
req.url = convertCustomSchemeToHttpUrl(req.url);
303-
await streamProtocolHandler(req, callback);
303+
return streamProtocolHandler(req, callback);
304304
};
305305

306306
// super hacky!! :(

src/main/w3c/audiobooks/toc.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ if (require.main === module) {
520520
`;
521521

522522
const manifestParsed = JSON.parse(w3cManifest);
523-
w3cPublicationManifestToReadiumPublicationManifest(manifestParsed, (uniqueResources) => {
523+
void w3cPublicationManifestToReadiumPublicationManifest(manifestParsed, (uniqueResources) => {
524524
const toc = extract_TOC(el, uniqueResources);
525525

526526
console.log("TOC");
@@ -533,5 +533,4 @@ if (require.main === module) {
533533
return undefined;
534534

535535
});
536-
537536
}

src/renderer/common/apiSubscribe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function apiSubscribeFactory(storeCb: () => Store<any>) {
2222
const lastApiSuccess = store.getState().api[LAST_API_SUCCESS_ID];
2323
let lastSuccessTime = lastApiSuccess?.lastTime || 0;
2424

25-
cb();
25+
void cb();
2626

2727
return store.subscribe(() => {
2828
const state = store.getState();
@@ -34,7 +34,7 @@ export function apiSubscribeFactory(storeCb: () => Store<any>) {
3434
if (!data.error) {
3535
const path = `${data.moduleId}/${data.methodId}` as TApiMethodName;
3636
if (pathArrayToRefresh.includes(path)) {
37-
cb();
37+
void cb();
3838
}
3939
}
4040
}

src/renderer/library/components/dialog/publicationInfos/opdsControls/OpdsControls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class OpdsControls extends React.Component<IProps, undefined> {
9797
onClick={() => {
9898

9999
if (ln.type === ContentType.Html || ln.type === ContentType.Xhtml) {
100-
this.props.link(
100+
void this.props.link(
101101
ln,
102102
this.props.location,
103103
);
@@ -131,7 +131,7 @@ export class OpdsControls extends React.Component<IProps, undefined> {
131131
onClick={() => {
132132

133133
if (ln.type === ContentType.Html || ln.type === ContentType.Xhtml) {
134-
this.props.link(
134+
void this.props.link(
135135
ln,
136136
this.props.location,
137137
);

0 commit comments

Comments
 (0)