Skip to content

Commit

Permalink
chore: lint codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
typotter committed Jan 31, 2025
1 parent abd99b7 commit 1ad6761
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 22 deletions.
5 changes: 4 additions & 1 deletion src/cache/tlru-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { LRUCache } from './lru-cache';
**/
export class TLRUCache extends LRUCache {
private readonly cacheEntriesTTLRegistry = new Map<string, Date>();
constructor(readonly maxSize: number, readonly ttl: number) {
constructor(
readonly maxSize: number,
readonly ttl: number,
) {
super(maxSize);
}

Expand Down
5 changes: 4 additions & 1 deletion src/events/batch-event-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const MAX_BATCH_SIZE = 10_000;
export default class BatchEventProcessor {
private readonly batchSize: number;

constructor(private readonly eventQueue: NamedEventQueue<Event>, batchSize: number) {
constructor(
private readonly eventQueue: NamedEventQueue<Event>,
batchSize: number,
) {
// clamp batch size between min and max
this.batchSize = Math.max(MIN_BATCH_SIZE, Math.min(MAX_BATCH_SIZE, batchSize));
}
Expand Down
5 changes: 4 additions & 1 deletion src/events/event-delivery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export type EventDeliveryResult = {
};

export default class EventDelivery {
constructor(private readonly sdkKey: string, private readonly ingestionUrl: string) {}
constructor(
private readonly sdkKey: string,
private readonly ingestionUrl: string,
) {}

/**
* Delivers a batch of events to the ingestion URL endpoint. Returns the UUIDs of any events from
Expand Down
2 changes: 1 addition & 1 deletion src/flag-evaluation-details-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class FlagEvaluationDetailsBuilder {
key: allocation.key,
allocationEvaluationCode: AllocationEvaluationCode.UNEVALUATED,
orderPosition: unevaluatedStartOrderPosition + i,
} as AllocationEvaluation),
}) as AllocationEvaluation,
);
};
}
11 changes: 9 additions & 2 deletions src/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export interface IQueryParamsWithSubject extends IQueryParams {
}

export class HttpRequestError extends Error {
constructor(public message: string, public status: number, public cause?: Error) {
constructor(
public message: string,
public status: number,
public cause?: Error,
) {
super(message);
if (cause) {
this.cause = cause;
Expand Down Expand Up @@ -53,7 +57,10 @@ export interface IHttpClient {
}

export default class FetchHttpClient implements IHttpClient {
constructor(private readonly apiEndpoints: ApiEndpoints, private readonly timeout: number) {}
constructor(
private readonly apiEndpoints: ApiEndpoints,
private readonly timeout: number,
) {}

async getUniversalFlagConfiguration(): Promise<IUniversalFlagConfigResponse | undefined> {
const url = this.apiEndpoints.ufcEndpoint();
Expand Down
32 changes: 16 additions & 16 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ function evaluateCondition(subjectAttributes: Record<string, any>, condition: Co
condition.operator === OperatorType.GTE
? semverGte
: condition.operator === OperatorType.GT
? semverGt
: condition.operator === OperatorType.LTE
? semverLte
: semverLt;
? semverGt
: condition.operator === OperatorType.LTE
? semverLte
: semverLt;
return compareSemVer(value, condition.value, comparator);
}

const comparator = (a: number, b: number) =>
condition.operator === OperatorType.GTE
? a >= b
: condition.operator === OperatorType.GT
? a > b
: condition.operator === OperatorType.LTE
? a <= b
: a < b;
? a > b
: condition.operator === OperatorType.LTE
? a <= b
: a < b;
return compareNumber(value, condition.value, comparator);
}
case OperatorType.MATCHES:
Expand Down Expand Up @@ -229,21 +229,21 @@ function evaluateObfuscatedCondition(
condition.operator === ObfuscatedOperatorType.GTE
? semverGte
: condition.operator === ObfuscatedOperatorType.GT
? semverGt
: condition.operator === ObfuscatedOperatorType.LTE
? semverLte
: semverLt;
? semverGt
: condition.operator === ObfuscatedOperatorType.LTE
? semverLte
: semverLt;
return compareSemVer(value, conditionValue, comparator);
}

const comparator = (a: number, b: number) =>
condition.operator === ObfuscatedOperatorType.GTE
? a >= b
: condition.operator === ObfuscatedOperatorType.GT
? a > b
: condition.operator === ObfuscatedOperatorType.LTE
? a <= b
: a < b;
? a > b
: condition.operator === ObfuscatedOperatorType.LTE
? a <= b
: a < b;
return compareNumber(value, Number(conditionValue), comparator);
}
case ObfuscatedOperatorType.MATCHES:
Expand Down

0 comments on commit 1ad6761

Please sign in to comment.