mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: replace ts-ignore with ts-expect-error for improved type safety in Handlebars helpers and test mocks
This commit is contained in:
@@ -42,10 +42,10 @@ loadPartials().catch((err: Error) => {
|
||||
|
||||
Handlebars.registerHelper("ifCond", function (v1, v2, options) {
|
||||
if (v1 === v2) {
|
||||
//@ts-ignore
|
||||
//@ts-expect-error - Handlebars uses dynamic this context for template helpers
|
||||
return options.fn(this);
|
||||
}
|
||||
//@ts-ignore
|
||||
//@ts-expect-error - Handlebars uses dynamic this context for template helpers
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
@@ -56,9 +56,9 @@ Handlebars.registerHelper("concat", (v1: any, v2: any) => {
|
||||
|
||||
Handlebars.registerHelper("ifNotCond", function (v1, v2, options) {
|
||||
if (v1 !== v2) {
|
||||
//@ts-ignore
|
||||
//@ts-expect-error - Handlebars uses dynamic this context for template helpers
|
||||
return options.fn(this);
|
||||
}
|
||||
//@ts-ignore
|
||||
//@ts-expect-error - Handlebars uses dynamic this context for template helpers
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
@@ -856,9 +856,9 @@ describe("BillingService", () => {
|
||||
|
||||
it("should successfully retrieve subscription items for a given subscription", async () => {
|
||||
mockSubscription.items.data = [
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock object for testing without all required Stripe SubscriptionItem properties
|
||||
{ id: "item_1", price: { id: "price_123" } },
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock object for testing without all required Stripe SubscriptionItem properties
|
||||
{ id: "item_2", price: { id: "price_456" } },
|
||||
];
|
||||
mockStripe.subscriptions.retrieve =
|
||||
@@ -1025,14 +1025,14 @@ describe("BillingService", () => {
|
||||
{
|
||||
id: "pm_123",
|
||||
type: "card",
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock card object for testing without all required Stripe card properties
|
||||
card: { last4: "4242", brand: "mastercard" },
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: "pm_456",
|
||||
type: "card",
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock card object for testing without all required Stripe card properties
|
||||
card: { last4: "4343", brand: "mastercard" },
|
||||
isDefault: true,
|
||||
},
|
||||
|
||||
@@ -68,7 +68,7 @@ const getStripeSubscription: GetStripeSubscriptionFunction =
|
||||
data: [
|
||||
{
|
||||
id: Faker.generateRandomObjectID().toString(),
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock price object for testing without all required Stripe Price properties
|
||||
price: {
|
||||
id: new BillingService().getMeteredPlanPriceId(
|
||||
ProductType.ActiveMonitoring,
|
||||
@@ -100,7 +100,7 @@ const getSubscriptionPlanData: GetSubscriptionPlanDataFunction =
|
||||
type GetStripeInvoiceFunction = () => Stripe.Invoice;
|
||||
|
||||
const getStripeInvoice: GetStripeInvoiceFunction = (): Stripe.Invoice => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error - Simplified mock invoice object for testing without all required Stripe Invoice properties
|
||||
return {
|
||||
id: Faker.generateRandomObjectID().toString(),
|
||||
amount_due: Faker.getNumberBetweenMinAndMax({ min: 1, max: 100 }),
|
||||
|
||||
@@ -4,7 +4,6 @@ import { IsDevelopment } from "Common/Server/EnvironmentConfig";
|
||||
import AcmeCertificateService from "Common/Server/Services/AcmeCertificateService";
|
||||
import BasicCron from "Common/Server/Utils/BasicCron";
|
||||
import LocalFile from "Common/Server/Utils/LocalFile";
|
||||
// @ts-ignore
|
||||
import logger from "Common/Server/Utils/Logger";
|
||||
import AcmeCertificate from "Common/Models/DatabaseModels/AcmeCertificate";
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { IsDevelopment } from "Common/Server/EnvironmentConfig";
|
||||
import StatusPageDomainService from "Common/Server/Services/StatusPageDomainService";
|
||||
import BasicCron from "Common/Server/Utils/BasicCron";
|
||||
import LocalFile from "Common/Server/Utils/LocalFile";
|
||||
// @ts-ignore
|
||||
import logger from "Common/Server/Utils/Logger";
|
||||
import StatusPageDomain from "Common/Models/DatabaseModels/StatusPageDomain";
|
||||
import QueryHelper from "Common/Server/Types/Database/QueryHelper";
|
||||
|
||||
@@ -59,7 +59,7 @@ export default tseslint.config(
|
||||
"@typescript-eslint/no-var-requires": "off", // TODO: Remove this rule
|
||||
"@typescript-eslint/no-duplicate-enum-values": "off", // TODO: Remove this rule
|
||||
"no-constant-binary-expression": "off", // TODO: Remove this rule
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"multiline-comment-style": "error",
|
||||
"@typescript-eslint/no-floating-promises": "off", // TODO: Remove this rule
|
||||
"no-fallthrough": "error",
|
||||
|
||||
Reference in New Issue
Block a user