feat: fixed eslint and resolved all eslint issues

This commit is contained in:
Akhil Mohan
2024-01-30 22:30:42 +05:30
parent 7c4dd5000f
commit 5855cc660a
147 changed files with 1165 additions and 938 deletions
@@ -39,7 +39,7 @@ export const setupLicenceRequestWithStore = (
let token: string;
const licenceReq = axios.create({
baseURL,
timeout: 35 * 1000,
timeout: 35 * 1000
// signal: AbortSignal.timeout(60 * 1000)
});
@@ -47,7 +47,7 @@ export const setupLicenceRequestWithStore = (
const appCfg = getConfig();
const {
data: { token: authToken }
} = await request.post(
} = await request.post<{ token: string }>(
refreshUrl,
{},
{
@@ -75,18 +75,18 @@ export const setupLicenceRequestWithStore = (
licenceReq.interceptors.response.use(
(response) => response,
async (err) => {
const originalRequest = err.config;
const originalRequest = (err as AxiosError).config;
// eslint-disable-next-line
if ((err as AxiosError)?.response?.status === 401 && !originalRequest._retry) {
if ((err as AxiosError)?.response?.status === 401 && !(originalRequest as any)._retry) {
// eslint-disable-next-line
originalRequest._retry = true;
(originalRequest as any)._retry = true; // injected
// refresh
await refreshLicence();
licenceReq.defaults.headers.common.Authorization = `Bearer ${token}`;
return licenceReq(originalRequest);
return licenceReq(originalRequest!);
}
return Promise.reject(err);
@@ -13,7 +13,7 @@ export const licenseDALFactory = (db: TDbClient) => {
.where({ status: OrgMembershipStatus.Accepted })
.andWhere((bd) => {
if (orgId) {
bd.where({ orgId });
void bd.where({ orgId });
}
})
.count();
@@ -1,3 +1,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
// eslint-disable @typescript-eslint/no-unsafe-assignment
// TODO(akhilmhdh): With tony find out the api structure and fill it here
import { ForbiddenError } from "@casl/ability";
import NodeCache from "node-cache";
@@ -92,7 +98,7 @@ export const licenseServiceFactory = ({
// else it would reach catch statement
isValidLicense = true;
} catch (error) {
logger.error(`init-license: encountered an error when init license [error=${error}]`);
logger.error(`init-license: encountered an error when init license [error]`, error);
}
};
@@ -119,7 +125,10 @@ export const licenseServiceFactory = ({
return currentPlan;
}
} catch (error) {
logger.error(`getPlan: encountered an error when fetching pan [orgId=${orgId}] [projectId=${projectId}] [error=${error}]`);
logger.error(
`getPlan: encountered an error when fetching pan [orgId=${orgId}] [projectId=${projectId}] [error]`,
error
);
return onPremFeatures;
}
return onPremFeatures;
@@ -136,7 +145,7 @@ export const licenseServiceFactory = ({
if (instanceType === InstanceType.Cloud) {
const {
data: { customerId }
} = await licenseServerCloudApi.request.post(
} = await licenseServerCloudApi.request.post<{ customerId: string }>(
"/api/license-server/v1/customers",
{
email,