Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v6.2.0
with:
node-version: 20.9.0
node-version: 24.15.0

- name: Install dependencies
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9.0
24.15.0
3 changes: 2 additions & 1 deletion components/RegexHighlightText.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ReactElement } from "react";
import {
HoverCard,
HoverCardContent,
Expand All @@ -14,7 +15,7 @@ export default function RegexHighlightText(props: RegexHighlightTextProps) {
return <pre className="whitespace-pre-wrap break-words">{props.text}</pre>;
}

const parts: JSX.Element[] = [];
const parts: ReactElement[] = [];
const newLine = (
<>
↵<br />
Expand Down
9 changes: 6 additions & 3 deletions components/SearchHighlightText.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ReactElement } from "react";

interface SearchHighlightTextProps {
text: string;
searchQuery: string;
Expand All @@ -17,14 +19,14 @@ export default function SearchHighlightText({
return <span className={className}>{text}</span>;
}

const parts: JSX.Element[] = [];
const parts: ReactElement[] = [];
const lowerText = text.toLowerCase();
const lowerQuery = searchQuery.toLowerCase();

let lastIndex = 0;
let currentIndex = 0;
let currentIndex = lowerText.indexOf(lowerQuery, lastIndex);

while ((currentIndex = lowerText.indexOf(lowerQuery, lastIndex)) !== -1) {
while (currentIndex !== -1) {
// Add text before match
if (currentIndex > lastIndex) {
parts.push(
Expand All @@ -45,6 +47,7 @@ export default function SearchHighlightText({
);

lastIndex = currentIndex + lowerQuery.length;
currentIndex = lowerText.indexOf(lowerQuery, lastIndex);
}

// Add remaining text
Expand Down
3 changes: 2 additions & 1 deletion components/ds/ButtonComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const buttonVariants = cva(
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
extends
React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion components/ds/CommandMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Command = React.forwardRef<
));
Command.displayName = CommandPrimitive.displayName;

interface CommandDialogProps extends DialogProps {}
type CommandDialogProps = DialogProps;

const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
Expand Down
3 changes: 2 additions & 1 deletion components/ds/ImageUploadComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
import type { ReactElement } from "react";
import { DragEvent, useCallback, useMemo, useRef, useState } from "react";
import UploadIcon from "@/components/icons/UploadIcon";

Expand Down Expand Up @@ -115,7 +116,7 @@ const StatusComponent = ({
</div>
);

const statusComponents: Record<Status, (maxSize: string) => JSX.Element> = {
const statusComponents: Record<Status, (maxSize: string) => ReactElement> = {
idle: (maxSize) => (
<StatusComponent
title="Drag and drop your image here, or click to select"
Expand Down
3 changes: 1 addition & 2 deletions components/ds/InputComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import { cn } from "@/lib/utils";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
Expand Down
3 changes: 2 additions & 1 deletion components/ds/MultiFileUploadComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
import type { ReactElement } from "react";
import { DragEvent, useCallback, useMemo, useRef, useState } from "react";
import UploadIcon from "@/components/icons/UploadIcon";

Expand Down Expand Up @@ -174,7 +175,7 @@ const StatusComponent = ({

const statusComponents: Record<
Status,
(maxSize: string, fileType: string, multiple: boolean) => JSX.Element
(maxSize: string, fileType: string, multiple: boolean) => ReactElement
> = {
idle: (maxSize, fileType, multiple) => (
<StatusComponent
Expand Down
3 changes: 2 additions & 1 deletion components/ds/SVGUploadComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
import type { ReactElement } from "react";
import { DragEvent, useCallback, useMemo, useRef, useState } from "react";
import UploadIcon from "@/components/icons/UploadIcon";

Expand Down Expand Up @@ -162,7 +163,7 @@ const StatusComponent = ({
</div>
);

const statusComponents: Record<Status, (maxSize: string) => JSX.Element> = {
const statusComponents: Record<Status, (maxSize: string) => ReactElement> = {
idle: (maxSize) => (
<StatusComponent
title="Drag and drop your SVG file here, or click to select"
Expand Down
3 changes: 1 addition & 2 deletions components/ds/TextareaComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import { cn } from "@/lib/utils";

export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;

const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
Expand Down
2 changes: 1 addition & 1 deletion components/har-waterfall/HarWaterfall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const HarWaterfall: React.FC<HarWaterfallProps> = ({
if (isBase64(contentToSearch)) {
try {
contentToSearch = atob(contentToSearch);
} catch (e) {
} catch {
// If decode fails, search in original
}
}
Expand Down
6 changes: 4 additions & 2 deletions components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"use client";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import {
ThemeProvider as NextThemesProvider,
type ThemeProviderProps,
} from "next-themes";

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
Expand Down
3 changes: 1 addition & 2 deletions components/utils/csv-logs-viewer.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,7 @@ export function buildSmartFacets(
const cardinalityRatio = totalRows > 0 ? uniqueCount / totalRows : 1;

// Determine if this column should be a facet
let shouldInclude = false;

let shouldInclude: boolean;
// Always include facet-friendly columns if they have reasonable cardinality
if (isFacetFriendlyColumn(header)) {
shouldInclude = uniqueCount <= 100 && uniqueCount > 1;
Expand Down
8 changes: 4 additions & 4 deletions components/utils/har-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getFilterType(entry: HarEntry): FilterType {
return "Errors";
}

const { mimeType } = entry.response.content;
const mimeType = entry.response.content.mimeType ?? "";

if (
entry.request.url.includes("xhr") ||
Expand Down Expand Up @@ -100,15 +100,15 @@ export function getFilterType(entry: HarEntry): FilterType {
export function isBase64(str: string) {
try {
return btoa(atob(str)) === str;
} catch (err) {
} catch {
return false;
}
}

export function tryParseJSON(str: string) {
try {
return JSON.parse(str);
} catch (e) {
} catch {
return str;
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ export function getMatchCategories(
if (isBase64(contentToSearch)) {
try {
contentToSearch = atob(contentToSearch);
} catch (e) {
} catch {
// If decode fails, search in original
}
}
Expand Down
8 changes: 5 additions & 3 deletions components/utils/hash-generator.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export const generateHash = (

return hash.update(data).digest(encoding);
} catch (error) {
throw new Error(
`Failed to generate hash: ${error instanceof Error ? error.message : "An unknown error occurred"}`
);
const innerMessage =
error instanceof Error ? error.message : "An unknown error occurred";
throw new Error(`Failed to generate hash: ${innerMessage}`, {
cause: error,
});
}
};
6 changes: 4 additions & 2 deletions components/utils/json-to-csv.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export function convertJSONtoCSV(input: string | object): string {
return csv;
} catch (error) {
if (error instanceof Error) {
throw new Error(error.message);
throw new Error(error.message, { cause: error });
} else {
throw new Error("Failed to convert JSON to CSV: Unknown error");
throw new Error("Failed to convert JSON to CSV: Unknown error", {
cause: error,
});
}
}
}
4 changes: 3 additions & 1 deletion components/utils/json-to-tsv.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function convertJSONtoTSV(input: string | object): string {
if (error instanceof Error) {
throw error;
} else {
throw new Error("Failed to convert JSON to TSV: Unknown error");
throw new Error("Failed to convert JSON to TSV: Unknown error", {
cause: error,
});
}
}
}
4 changes: 2 additions & 2 deletions components/utils/jwt-parser.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function base64UrlDecode(str: string): string {
const decoded = fromBase64(base64);
if (!decoded) throw new Error();
return decoded;
} catch (error) {
} catch {
throw new Error("Invalid token");
}
}
Expand All @@ -28,7 +28,7 @@ function decodeJWT(token: string): {
payload: JSON.parse(base64UrlDecode(payload)),
signature,
};
} catch (error) {
} catch {
throw new Error("Invalid token");
}
}
Expand Down
8 changes: 4 additions & 4 deletions components/utils/regex-tester.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export const createRegex = (pattern: string): RegExp => {
throw new Error("Pattern must be a non-empty string");
}

let patternBody = "";
let flags = "";
let patternBody: string;
let flags: string = "";

if (pattern.startsWith("/")) {
const lastSlashIndex = pattern.lastIndexOf("/");
Expand Down Expand Up @@ -152,7 +152,7 @@ export const createRegex = (pattern: string): RegExp => {
return new RegExp(patternBody, flags);
} catch (error) {
if (error instanceof SyntaxError) {
throw new Error(error.message);
throw new Error(error.message, { cause: error });
}
throw error;
}
Expand Down Expand Up @@ -398,7 +398,7 @@ export const explainPattern = (pattern: string): PatternComponent[] => {
while (j < patternBody.length && patternBody[j] !== "}") j++;
const quantifier = patternBody.slice(i, j + 1);
const inner = quantifier.slice(1, -1);
let explanation = "";
let explanation: string;

if (inner.includes(",")) {
const [min, max] = inner.split(",");
Expand Down
7 changes: 6 additions & 1 deletion components/utils/sql-minifier.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ export function minifySQL(sql: string): string {
return result.trim();
} catch (error) {
throw new Error(
`Failed to minify SQL: ${error instanceof Error ? error.message : "Unknown error"}`
`Failed to minify SQL: ${
error instanceof Error ? error.message : "Unknown error"
}`,
{
cause: error,
}
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/utils/url-encoder.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function decode(input: string): string {
} else {
return decodeURIComponent(input);
}
} catch (error) {
} catch {
return "Failed to decode string";
}
}
75 changes: 75 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import reactPlugin from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import importPlugin from "eslint-plugin-import";

export default [
{
ignores: [
".next/**",
"node_modules/**",
"dist/**",
"build/**",
"coverage/**",
],
},

js.configs.recommended,

...tseslint.configs.recommended,

{
files: ["**/*.{js,jsx,ts,tsx}"],

languageOptions: {
parser: tseslint.parser,

parserOptions: {
project: ["./tsconfig.json"],
tsconfigRootDir: import.meta.dirname,
ecmaVersion: "latest",
sourceType: "module",

ecmaFeatures: {
jsx: true,
},
},

globals: {
...globals.browser,
...globals.node,
},
},

plugins: {
react: reactPlugin,
import: importPlugin,
"react-hooks": reactHooks,
"@typescript-eslint": tseslint.plugin,
},

settings: {
react: {
version: "detect",
},

"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.json",
},
},
},

rules: {
"react/jsx-uses-react": "off",
"react/jsx-uses-vars": "error",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"import/no-named-as-default-member": "off",
"react/no-unescaped-entities": "off",
},
},
];
Loading