Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"react-hooks/rules-of-hooks": "off",
"guard-for-in": "error",
"symbol-description": "error",
"no-unneeded-ternary": "error",
"prefer-object-has-own": "error",
"no-redeclare": "error",
"no-multi-assign": "error",
"prefer-object-spread": "error",
"react/jsx-no-target-blank": "error",
"trigger/no-thrown-unawaited-redirect": "error",
"trigger-prisma/no-unbounded-list-filter": "error",
Expand All @@ -75,6 +80,12 @@
"trigger-prisma/no-unbounded-list-filter": "off",
"trigger-prisma/no-unbounded-list-filter-in-args-helper": "off"
}
},
{
"files": ["internal-packages/tsql/**"],
"rules": {
"prefer-object-has-own": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion apps/webapp/app/components/billing/UsageBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type LegendProps = {

function Legend({ text, value, position, percentage, tooltipContent }: LegendProps) {
const flipLegendPositionValue = 80;
const flipLegendPosition = percentage > flipLegendPositionValue ? true : false;
const flipLegendPosition = percentage > flipLegendPositionValue;
return (
<div
className={cn(
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/components/primitives/TreeView/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function applyVisibility<TData>(tree: FlatTree<TData>, state: NodesState)
const parent = node.parentId
? acc[node.parentId]
: { selected: defaultSelected, expanded: defaultExpanded, visible: true };
const visible = parent.expanded && parent.visible === true ? true : false;
const visible = parent.expanded && parent.visible === true;
acc[node.id] = { ...nodeState, visible };

return acc;
Expand Down
3 changes: 2 additions & 1 deletion apps/webapp/app/hooks/useThemeColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { useEffect, useState } from "react";
*/
function toRgb(color: string): string {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 1;
canvas.width = 1;
canvas.height = 1;
const ctx = canvas.getContext("2d");
if (!ctx) return color;
ctx.fillStyle = color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ export const ApiErrorListSearchParams = z.object({
const statuses = value.split(",");
// hasOwnProperty, not `in`: `in` walks the prototype chain, so
// `filter[status]=toString` would pass and map to a function.
const invalid = statuses.filter(
(status) => !Object.prototype.hasOwnProperty.call(API_STATUS_TO_DB, status)
);
const invalid = statuses.filter((status) => !Object.hasOwn(API_STATUS_TO_DB, status));

if (invalid.length > 0) {
ctx.addIssue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export const ApiWebhookDeliveryListSearchParams = z.object({
.transform((value, ctx) => {
if (!value) return undefined;
const statuses = value.split(",");
const invalid = statuses.filter(
(s) => !Object.prototype.hasOwnProperty.call(API_STATUS_TO_DB, s)
);
const invalid = statuses.filter((s) => !Object.hasOwn(API_STATUS_TO_DB, s));
if (invalid.length > 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/v3/eventRepository/common.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function removePrivateProperties(

export function isEmptyObject(obj: object) {
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
if (Object.hasOwn(obj, prop)) {
return false;
}
}
Expand Down
12 changes: 5 additions & 7 deletions apps/webapp/app/v3/eventRepository/eventRepository.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1692,13 +1692,11 @@ function parseStyleField(style: Prisma.JsonValue): TaskEventStyle {
}

if (typeof unsafe === "object") {
return Object.assign(
{
icon: undefined,
variant: undefined,
},
unsafe
) as TaskEventStyle;
return {
icon: undefined,
variant: undefined,
...unsafe,
} as TaskEventStyle;
}

return {};
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/v3/eventRepository/traceExport.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const FORMATS: Record<TraceExportFormatName, TraceExportFormat> = {

/** Resolve a `?format=` value to a format, defaulting to `log`. */
export function getTraceExportFormat(name: string | null | undefined): TraceExportFormat {
if (name && Object.prototype.hasOwnProperty.call(FORMATS, name)) {
if (name && Object.hasOwn(FORMATS, name)) {
return FORMATS[name as TraceExportFormatName];
}
return logFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class CreateAlertChannelService extends BaseService {
properties: await this.#createProperties(options.channel),
enabled: true,
deduplicationKey: options.deduplicationKey,
userProvidedDeduplicationKey: options.deduplicationKey ? true : false,
userProvidedDeduplicationKey: Boolean(options.deduplicationKey),
environmentTypes,
},
});
Expand Down
10 changes: 6 additions & 4 deletions apps/webapp/memory-leak-detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ class MemoryLeakDetector {
const snapshot3 = this.results.snapshots[2]; // after second load test

let analysis = {};
let heapGrowth;
let heapGrowthPercent;

// Handle different snapshot types
if (
Expand Down Expand Up @@ -592,8 +594,8 @@ class MemoryLeakDetector {
};

// Use total growth for recommendations
var heapGrowth = totalGrowth;
var heapGrowthPercent = totalGrowthPercent;
heapGrowth = totalGrowth;
heapGrowthPercent = totalGrowthPercent;
} else if (snapshot1.processMemory && snapshot2.processMemory && snapshot3.processMemory) {
// Traditional process memory analysis with 3 snapshots
const heap1 = snapshot1.processMemory.heapUsed;
Expand Down Expand Up @@ -632,8 +634,8 @@ class MemoryLeakDetector {
snapshots: this.results.snapshots.length,
};

var heapGrowth = totalHeapGrowth;
var heapGrowthPercent = (totalHeapGrowth / heap1) * 100;
heapGrowth = totalHeapGrowth;
heapGrowthPercent = (totalHeapGrowth / heap1) * 100;
} else {
this.log("Mixed or incompatible snapshot types - cannot analyze memory growth", "warn");
analysis = {
Expand Down
2 changes: 1 addition & 1 deletion internal-packages/run-store/src/PostgresRunStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ export class PostgresRunStore implements RunStore {
?.filter((c) => c.index !== undefined)
.sort((a, b) => a.index! - b.index!)
.map((w) => w.id),
isValid: error ? false : true,
isValid: !error,
error,
},
include: { checkpoint: true },
Expand Down
2 changes: 1 addition & 1 deletion internal-packages/tsql/src/query/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ export class TSQLParseTreeConverter implements TSQLParserVisitor<any> {
}

const args: Expression[] = ctx._columnArgList ? this.visitExprList(ctx._columnArgList) : [];
const distinct = ctx.DISTINCT() ? true : false;
const distinct = ctx.DISTINCT() !== undefined;
return { expression_type: "call", name, params: parameters, args, distinct };
}

Expand Down
8 changes: 4 additions & 4 deletions packages/cli-v3/src/deploy/buildImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,11 +1158,11 @@ function shouldPush(imageTag: string, push?: boolean) {
return false;
}
case undefined: {
return imageTag.startsWith("localhost") ||
return !(
imageTag.startsWith("localhost") ||
imageTag.startsWith("127.0.0.1") ||
imageTag.startsWith("0.0.0.0")
? false
: true;
);
}
default: {
assertExhaustive(push);
Expand All @@ -1180,7 +1180,7 @@ function shouldLoad(load?: boolean, push?: boolean) {
return false;
}
case undefined: {
return push ? false : true;
return !push;
}
default: {
assertExhaustive(load);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/v3/apiClient/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export function isEmptyObj(obj: object | null | undefined): boolean {

// https://eslint.org/docs/latest/rules/no-prototype-builtins
export function hasOwn(obj: object, key: string): boolean {
return Object.prototype.hasOwnProperty.call(obj, key);
return Object.hasOwn(obj, key);
}

// If the requestInit has a header x-trigger-worker = true, then we will do
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/v3/workers/populateEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function populateEnv(

// Set process.env values
for (const key of Object.keys(envObject)) {
if (Object.prototype.hasOwnProperty.call(process.env, key)) {
if (Object.hasOwn(process.env, key)) {
if (override) {
process.env[key] = envObject[key];

Expand All @@ -57,7 +57,7 @@ export function populateEnv(
if (previousEnv) {
// if there are any keys in previousEnv that are not in envObject, remove them from process.env
for (const key of Object.keys(previousEnv)) {
if (!Object.prototype.hasOwnProperty.call(envObject, key)) {
if (!Object.hasOwn(envObject, key)) {
delete process.env[key];
}
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/recover-stuck-runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async function main() {
? {
tls: {
// If connecting via localhost tunnel to a remote Redis, disable cert verification
rejectUnauthorized: redisReadUrlObj.hostname === "localhost" ? false : true,
rejectUnauthorized: redisReadUrlObj.hostname !== "localhost",
},
}
: {}),
Expand All @@ -165,7 +165,7 @@ async function main() {
? {
tls: {
// If connecting via localhost tunnel to a remote Redis, disable cert verification
rejectUnauthorized: redisWriteUrlObj.hostname === "localhost" ? false : true,
rejectUnauthorized: redisWriteUrlObj.hostname !== "localhost",
},
}
: {}),
Expand Down
Loading