Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
pellicceama committed Oct 28, 2024
1 parent 457583d commit 1729a96
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 36 deletions.
6 changes: 1 addition & 5 deletions gateway/src/batcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ type BatcherEnv = Bindings;
export class Batcher extends DurableObject<BatcherEnv> {
private batchedEvents: DestinationEvent[] = [];

constructor(state: DurableObjectState, env: BatcherEnv) {
super(state, env);
}

private async resetAlarm() {
await this.ctx.storage.deleteAlarm();
}
Expand All @@ -21,7 +17,7 @@ export class Batcher extends DurableObject<BatcherEnv> {
const currentAlarm = await this.ctx.storage.getAlarm();
if (currentAlarm == null) {
await this.ctx.storage.setAlarm(
Date.now() + config.batch.flushIntervalMs
Date.now() + config.batch.flushIntervalMs,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function getConfig(): Promise<GatewayConfig> {
}
});

// @ts-ignore
// @ts-expect-error
config.destinations = await Promise.all(handlerPromises);
return config;
}
6 changes: 3 additions & 3 deletions gateway/src/connectors/mixpanel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const transformTrackEvent = (
config: MixpanelConfig,
event: DestinationTrackEvent
) => {
let properties = transformBaseEvent(config, event);
const properties = transformBaseEvent(config, event);

return {
event: event.event,
Expand All @@ -152,7 +152,7 @@ const transformIdentifyEvent = (
config: MixpanelConfig,
event: DestinationIdentifyEvent
) => {
let payload = constructPayload(event, mapping.identify);
const payload = constructPayload(event, mapping.identify);

if (!payload.$name && payload.$first_name && payload.$last_name) {
payload.$name = `${payload.$first_name} ${payload.$last_name}`;
Expand All @@ -171,7 +171,7 @@ const transformPageOrScreenEvent = (
config: MixpanelConfig,
event: DestinationPageEvent | DestinationScreenEvent
) => {
let properties = transformBaseEvent(config, event);
const properties = transformBaseEvent(config, event);

if (event.name) {
properties.name = event.name;
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export async function checkCloudflareQueuesConfiguration(): Promise<
data.result.map((queue) => [queue.queue_name, queue])
);

// @ts-ignore
// @ts-expect-error
const errors: Record<DestinationType, string[]> = {};

config.destinations.forEach((dest) => {
Expand Down
4 changes: 2 additions & 2 deletions gateway/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ async function handleAnalyticsJsMethod(
)
)
: Array.isArray(body)
? body.map((b) => formatEvent(b, c, type!!))
: [formatEvent(body, c, type!!)];
? body.map((b) => formatEvent(b, c, type!))
: [formatEvent(body, c, type!)];
} catch (e: any) {
console.error('Error parsing request body: ', JSON.stringify(e));
return c.json({ error: 'Error parsing request body' }, { status: 400 });
Expand Down
8 changes: 4 additions & 4 deletions gateway/src/schema/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ export const getLocationFromCFData = (
};

export const getEventExtraParams = (event: Event, type: EventType) => {
var extraProperties = {};
var extraTraits = {};
var eventContextExtra = {};
var eventCampaignExtra = {};
let extraProperties = {};
let extraTraits = {};
let eventContextExtra = {};
let eventCampaignExtra = {};

if (type === 'page' && event.properties) {
extraProperties = removeKeysFromObject(
Expand Down
4 changes: 2 additions & 2 deletions gateway/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function removeKeysFromObject(
* @returns The object with the keys mapped
**/
export function mapKeys(keyMap: Record<string, any>, obj: Record<string, any>) {
let res: Record<string, any> = {};
for (let key of Object.keys(obj)) {
const res: Record<string, any> = {};
for (const key of Object.keys(obj)) {
if (key in keyMap) {
res[keyMap[key]] = obj[key]; //this is ES7 changes issue - will fix later
} else {
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"generate:docs": "pnpm run --filter app-config dev",
"generate:connectorsList": "npx tsx apps/app-config/_generateConnectorLists.ts",
"docs": "cd docs && mintlify dev",
"lint": "eslint --ext .js,.ts,.tsx --cache .",
"lint": "eslint --ext .js,.ts,.tsx --cache . --quiet --ignore-pattern /gateway",
"mitm": "mitmweb --listen-port 3010 --web-port 3011 --mode reverse:http://localhost:3000",
"preinstall": "npx only-allow pnpm",
"test::ci": "NODE_OPTIONS=--experimental-vm-modules pnpm run test --ci --forceExit --detectOpenHandles --runInBand",
Expand Down Expand Up @@ -78,6 +78,14 @@
"node": "20"
},
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {
"slonik": "30"
}
},
"neverBuiltDependencies": [
"libpq"
],
"allowedDeprecatedVersions": {
"core-js": "3.6.5",
"resolve-url": "0.2.1",
Expand All @@ -87,33 +95,25 @@
"source-map-url": "0.4.1",
"urix": "0.1.0"
},
"neverBuiltDependencies": [
"libpq"
],
"overrides": {
"@tanstack/react-query": "4.28.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@tanstack/react-query": "4.28.0",
"axios": "0.21.1",
"esbuild": "0.17.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"slonik": "30.3.1",
"esbuild": "0.17.5"
"slonik": "30.3.1"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@jsonurl/[email protected]": "patches/@[email protected]",
"@lilyrose2798/[email protected]": "patches/@[email protected]",
"@nangohq/[email protected]": "patches/@[email protected]",
"@stoplight/[email protected]": "patches/@[email protected]",
"@lilyrose2798/[email protected]": "patches/@[email protected]"
},
"peerDependencyRules": {
"allowedVersions": {
"slonik": "30"
}
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "gateway"]
}

0 comments on commit 1729a96

Please sign in to comment.