Narrow linting rules and fix for eslintrc for js files

This commit is contained in:
hensm
2022-04-27 22:28:38 +01:00
parent 5e2d9a2fbc
commit dececa46c3
27 changed files with 298 additions and 246 deletions

View File

@@ -3,7 +3,7 @@
export class Logger {
constructor(private prefix: string) {}
public log(message: string, data?: any) {
public log(message: string, data?: unknown) {
const formattedMessage = `${this.prefix} (Log): ${message}`;
if (data) {
// eslint-disable-next-line no-console
@@ -13,7 +13,7 @@ export class Logger {
console.log(formattedMessage);
}
}
public info(message: string, data?: any) {
public info(message: string, data?: unknown) {
const formattedMessage = `${this.prefix} (Info): ${message}`;
if (data) {
console.info(formattedMessage, data);
@@ -21,7 +21,7 @@ export class Logger {
console.info(formattedMessage);
}
}
public warn(message: string, data?: any) {
public warn(message: string, data?: unknown) {
const formattedMessage = `${this.prefix} (Warning): ${message}`;
if (data) {
console.warn(formattedMessage, data);
@@ -29,7 +29,7 @@ export class Logger {
console.warn(formattedMessage);
}
}
public error(message: string, data?: any) {
public error(message: string, data?: unknown) {
const formattedMessage = `${this.prefix} (Error): ${message}`;
if (data) {
console.error(formattedMessage, data);

View File

@@ -32,7 +32,6 @@ function connectNative(application: string): Port {
// Port proxy API
const portObject: Port = {
error: null as any,
name: "",
onDisconnect: {
@@ -150,7 +149,7 @@ function connectNative(application: string): Port {
}
});
port.onMessage.addListener((message: any) => {
port.onMessage.addListener((message: Message) => {
if (!isNativeHostStatusKnown) {
isNativeHostStatusKnown = true;
messageQueue = [];
@@ -177,8 +176,6 @@ async function sendNativeMessage(application: string, message: Message) {
);
}
const port = await options.get("bridgeBackupPort");
return await new Promise((resolve, reject) => {
const ws = new WebSocket(
`ws://${bridgeBackupHost}:${bridgeBackupPort}`

View File

@@ -1,7 +1,5 @@
"use strict";
import logger from "./logger";
import { ReceiverSelectorMediaType } from "../background/receiverSelector";
export function getNextEllipsis(ellipsis: string): string {
@@ -18,7 +16,7 @@ export function getNextEllipsis(ellipsis: string): string {
*/
export function stringify(
templateStrings: TemplateStringsArray,
...substitutions: any[]
...substitutions: unknown[]
) {
let formattedString = "";