ci: Setup biome and pre-commit hooks for formatting (no-changelog) (#10795)

Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-17 14:10:22 +02:00
committed by GitHub
parent 57836cc17a
commit 6a35812f92
85 changed files with 701 additions and 465 deletions

View File

@@ -12,6 +12,7 @@ import { UserRepository } from '@/databases/repositories/user.repository';
import { Patch, Post, RestController } from '@/decorators';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import type { BooleanLicenseFeature, NumericLicenseFeature } from '@/interfaces';
import type { FeatureReturnType } from '@/license';
import { License } from '@/license';
import { Logger } from '@/logger';
import { MfaService } from '@/mfa/mfa.service';
@@ -115,10 +116,18 @@ export class E2EController {
) {
license.isFeatureEnabled = (feature: BooleanLicenseFeature) =>
this.enabledFeatures[feature] ?? false;
// @ts-expect-error Overriding method
// eslint-disable-next-line @typescript-eslint/unbound-method
license.getFeatureValue<NumericLicenseFeature> = (feature: NumericLicenseFeature) =>
this.numericFeatures[feature] ?? UNLIMITED_LICENSE_QUOTA;
// Ugly hack to satisfy biome parser
const getFeatureValue = <T extends keyof FeatureReturnType>(
feature: T,
): FeatureReturnType[T] => {
if (feature in this.numericFeatures) {
return this.numericFeatures[feature as NumericLicenseFeature] as FeatureReturnType[T];
} else {
return UNLIMITED_LICENSE_QUOTA as FeatureReturnType[T];
}
};
license.getFeatureValue = getFeatureValue;
license.getPlanName = () => 'Enterprise';
}