mirror of
https://github.com/yamadashy/repomix.git
synced 2026-05-30 11:18:53 +02:00
fix(website): resolve lint errors and revert tooltip styling
- Replace 'any' with 'unknown' for better type safety - Convert forEach to for...of loop for better performance - Use proper type casting with unknown intermediate step - Revert tooltip colors back to original styling (#333 background, white text) - Fix all biome lint warnings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
import { FolderArchive, FolderOpen, Link2, RotateCcw } from 'lucide-vue-next';
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { usePackRequest } from '../../composables/usePackRequest';
|
||||
import { parseUrlParameters, updateUrlParameters, hasNonDefaultValues } from '../../utils/urlParams';
|
||||
import { hasNonDefaultValues, parseUrlParameters, updateUrlParameters } from '../../utils/urlParams';
|
||||
import { isValidRemoteValue } from '../utils/validation';
|
||||
import PackButton from './PackButton.vue';
|
||||
import TryItFileUpload from './TryItFileUpload.vue';
|
||||
@@ -148,7 +148,11 @@ const shouldShowReset = computed(() => {
|
||||
}
|
||||
|
||||
// Use utility function to check for non-default values
|
||||
return hasNonDefaultValues(inputUrl.value, packOptions, DEFAULT_PACK_OPTIONS);
|
||||
return hasNonDefaultValues(
|
||||
inputUrl.value,
|
||||
packOptions as unknown as Record<string, unknown>,
|
||||
DEFAULT_PACK_OPTIONS as unknown as Record<string, unknown>,
|
||||
);
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -360,8 +364,8 @@ onMounted(() => {
|
||||
transform: translateX(-50%);
|
||||
margin-bottom: 8px;
|
||||
padding: 8px 12px;
|
||||
background: var(--vp-c-bg-soft, #333);
|
||||
color: var(--vp-c-text-1, white);
|
||||
background: #333;
|
||||
color: white;
|
||||
font-size: 0.875rem;
|
||||
white-space: nowrap;
|
||||
border-radius: 4px;
|
||||
|
||||
@@ -33,12 +33,12 @@ export function usePackOptions() {
|
||||
const initialOptions = { ...DEFAULT_PACK_OPTIONS };
|
||||
|
||||
// Apply URL parameters to initial options
|
||||
(Object.keys(initialOptions) as Array<keyof PackOptions>).forEach((key) => {
|
||||
for (const key of Object.keys(initialOptions) as Array<keyof PackOptions>) {
|
||||
if (key in urlParams && urlParams[key] !== undefined) {
|
||||
// Type-safe assignment: only assign if the key is a valid PackOptions key
|
||||
initialOptions[key] = urlParams[key] as PackOptions[typeof key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const packOptions = reactive<PackOptions>(initialOptions);
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ function getUrlParamKey(internalKey: string): string {
|
||||
}
|
||||
|
||||
// Helper function to validate URL parameter values
|
||||
export function validateUrlParameters(params: Record<string, any>): { isValid: boolean; errors: string[] } {
|
||||
export function validateUrlParameters(params: Record<string, unknown>): { isValid: boolean; errors: string[] } {
|
||||
const errors: string[] = [];
|
||||
|
||||
|
||||
// Validate format parameter
|
||||
if (params.format && !VALID_FORMATS.includes(params.format)) {
|
||||
errors.push(`Invalid format: ${params.format}. Must be one of: ${VALID_FORMATS.join(', ')}`);
|
||||
}
|
||||
|
||||
|
||||
// Validate URL length to prevent browser limit issues
|
||||
const urlSearchParams = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
@@ -42,23 +42,25 @@ export function validateUrlParameters(params: Record<string, any>): { isValid: b
|
||||
urlSearchParams.set(key, String(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const maxUrlLength = 2000; // Conservative limit for browser compatibility
|
||||
if (urlSearchParams.toString().length > maxUrlLength) {
|
||||
errors.push(`URL parameters too long (${urlSearchParams.toString().length} chars). Maximum allowed: ${maxUrlLength}`);
|
||||
errors.push(
|
||||
`URL parameters too long (${urlSearchParams.toString().length} chars). Maximum allowed: ${maxUrlLength}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
isValid: errors.length === 0,
|
||||
errors
|
||||
errors,
|
||||
};
|
||||
}
|
||||
|
||||
// Helper function to check if any options differ from defaults
|
||||
export function hasNonDefaultValues(
|
||||
inputUrl: string,
|
||||
packOptions: Record<string, any>,
|
||||
defaultOptions: Record<string, any>
|
||||
packOptions: Record<string, unknown>,
|
||||
defaultOptions: Record<string, unknown>,
|
||||
): boolean {
|
||||
// Check if there's input URL
|
||||
if (inputUrl && inputUrl.trim() !== '') {
|
||||
@@ -96,13 +98,13 @@ export function parseUrlParameters(): Partial<PackOptions & { repo?: string }> {
|
||||
|
||||
// Format parameter
|
||||
const format = urlParams.get('format');
|
||||
if (format && VALID_FORMATS.includes(format as any)) {
|
||||
if (format && (VALID_FORMATS as readonly string[]).includes(format)) {
|
||||
params.format = format as (typeof VALID_FORMATS)[number];
|
||||
}
|
||||
|
||||
// Style parameter (alternative to format for backward compatibility)
|
||||
const style = urlParams.get('style');
|
||||
if (style && VALID_FORMATS.includes(style as any)) {
|
||||
if (style && (VALID_FORMATS as readonly string[]).includes(style)) {
|
||||
params.format = style as (typeof VALID_FORMATS)[number];
|
||||
}
|
||||
|
||||
@@ -130,7 +132,10 @@ export function parseUrlParameters(): Partial<PackOptions & { repo?: string }> {
|
||||
return params;
|
||||
}
|
||||
|
||||
export function updateUrlParameters(options: Partial<PackOptions & { repo?: string }>): { success: boolean; error?: string } {
|
||||
export function updateUrlParameters(options: Partial<PackOptions & { repo?: string }>): {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
} {
|
||||
if (typeof window === 'undefined') {
|
||||
return { success: false, error: 'Window object not available (SSR environment)' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user