Skip to content

Commit 923ff21

Browse files
committed
fix: fix floating-promises errors
1 parent 91f11c6 commit 923ff21

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
@@ -76,7 +76,7 @@ setLcpNativePluginPath(lcpNativePluginPath);
7676
initSessionsNoHTTP();
7777

7878
if (_VSCODE_LAUNCH === "true") {
79-
createStoreFromDi().then((store) => store.dispatch(appActions.initRequest.build()));
79+
void createStoreFromDi().then((store) => store.dispatch(appActions.initRequest.build()));
8080
} else {
8181
commandLineMainEntry(); // call main fct
8282
}

src/main/cli/index.ts

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

220220
// flush session because user ask to read a publication
221-
flushSession();
221+
await flushSession();
222222

223223
// pathArgv can be an url with deepLinkInvocation in windows
224224
// https://github.com/oikonomopo/electron-deep-linking-mac-win
@@ -305,7 +305,7 @@ export function commandLineMainEntry(
305305
debug("processArgv", processArgv, "arg", argFormated);
306306

307307
try {
308-
y.parse(argFormated);
308+
void y.parse(argFormated);
309309
} catch (e) {
310310
debug("YARGS ERROR !!!!!", e);
311311
}

src/main/redux/sagas/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function* opdsRequestMediaFlow({request, callback}: TregisterHttpProtocolHandler
225225
return ;
226226
}
227227

228-
httpGet(url, {
228+
void httpGet(url, {
229229
...request,
230230
}, (response) => {
231231

@@ -733,7 +733,7 @@ function createOpdsAuthenticationModalWin(url: string): BrowserWindow | undefine
733733
win.show();
734734
});
735735

736-
win.loadURL(url);
736+
void win.loadURL(url);
737737

738738
return win;
739739
}

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
@@ -161,7 +161,7 @@ export class LcpManager {
161161

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

167167
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
@@ -178,7 +178,7 @@ const streamProtocolHandlerTunnel = async (
178178

179179
debug("............... streamProtocolHandlerTunnel req.url", req.url);
180180
req.url = convertCustomSchemeToHttpUrl(req.url);
181-
streamProtocolHandler(req, callback);
181+
return streamProtocolHandler(req, callback);
182182
};
183183

184184
// 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)