Fix ESLint warnings and and enable max warnings 0 to fail builds (#2101)
This commit is contained in:
@@ -23,8 +23,10 @@ interface OllamaBattleGameProps {
|
||||
}
|
||||
|
||||
export function OllamaBattleGame({ onComplete, _requiredKeys }: OllamaBattleGameProps) {
|
||||
// Use type assertion for audioRef to avoid DOM lib dependency
|
||||
const audioRef = useRef<any>(null);
|
||||
// Use Audio element type for audioRef
|
||||
const audioRef = useRef<{ play: () => Promise<void>; pause: () => void; volume: number } | null>(
|
||||
null
|
||||
);
|
||||
const [isMuted, setIsMuted] = useState(false);
|
||||
|
||||
const [battleState, setBattleState] = useState<BattleState>({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { IpcRendererEvent } from 'electron';
|
||||
import { ScrollArea } from '../ui/scroll-area';
|
||||
import { Settings as SettingsType } from './types';
|
||||
import {
|
||||
@@ -13,7 +14,7 @@ import { ConfigureBuiltInExtensionModal } from './extensions/ConfigureBuiltInExt
|
||||
import BackButton from '../ui/BackButton';
|
||||
import { RecentModelsRadio } from './models/RecentModels';
|
||||
import { ExtensionItem } from './extensions/ExtensionItem';
|
||||
import type { View } from '../../App';
|
||||
import { View, ViewOptions } from '../../App';
|
||||
import { ModeSelection } from './basic/ModeSelection';
|
||||
import SessionSharingSection from './session/SessionSharingSection';
|
||||
import { toastSuccess } from '../../toasts';
|
||||
@@ -59,7 +60,7 @@ export default function SettingsView({
|
||||
viewOptions,
|
||||
}: {
|
||||
onClose: () => void;
|
||||
setView: (view: View) => void;
|
||||
setView: (view: View, viewOptions?: ViewOptions) => void;
|
||||
viewOptions: SettingsViewOptions;
|
||||
}) {
|
||||
const [settings, setSettings] = React.useState<SettingsType>(() => {
|
||||
@@ -92,7 +93,7 @@ export default function SettingsView({
|
||||
|
||||
// Listen for settings updates from extension storage
|
||||
useEffect(() => {
|
||||
const handleSettingsUpdate = (_: any) => {
|
||||
const handleSettingsUpdate = (_event: IpcRendererEvent) => {
|
||||
const saved = localStorage.getItem('user_settings');
|
||||
if (saved) {
|
||||
let currentSettings = JSON.parse(saved);
|
||||
|
||||
@@ -101,8 +101,18 @@ export async function getProvidersList(): Promise<Provider[]> {
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
interface ProviderItem {
|
||||
id: string;
|
||||
details?: {
|
||||
name?: string;
|
||||
description?: string;
|
||||
models?: string[];
|
||||
required_keys?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
// Format the response into an array of providers
|
||||
return data.map((item: any) => ({
|
||||
return data.map((item: ProviderItem) => ({
|
||||
id: item.id, // Root-level ID
|
||||
name: item.details?.name || 'Unknown Provider', // Nested name in details
|
||||
description: item.details?.description || 'No description available.', // Nested description
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Button } from '../../ui/button';
|
||||
import { Input } from '../../ui/input';
|
||||
import { FullExtensionConfig, DEFAULT_EXTENSION_TIMEOUT } from '../../../extensions';
|
||||
import { Select } from '../../ui/Select';
|
||||
import { createDarkSelectStyles, darkSelectTheme } from '../../ui/select-styles';
|
||||
import { getApiUrl, getSecretKey } from '../../../config';
|
||||
import { toastError } from '../../../toasts';
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Model } from './ModelContext';
|
||||
|
||||
export const openai_models = ['gpt-4o-mini', 'gpt-4o', 'gpt-4-turbo', 'o1'];
|
||||
|
||||
export const anthropic_models = [
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { Check, Plus, Settings, X, Rocket } from 'lucide-react';
|
||||
import { Button } from '../../ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui/Tooltip';
|
||||
import { Portal } from '@radix-ui/react-portal';
|
||||
import { required_keys } from '../models/hardcoded_stuff';
|
||||
import { useActiveKeys } from '../api_keys/ActiveKeysContext';
|
||||
import { getActiveProviders } from '../api_keys/utils';
|
||||
|
||||
// Common interfaces and helper functions
|
||||
interface Provider {
|
||||
@@ -67,7 +65,6 @@ function BaseProviderCard({
|
||||
}: BaseProviderCardProps) {
|
||||
const numRequiredKeys = required_keys[name]?.length || 0;
|
||||
const tooltipText = numRequiredKeys === 1 ? `Add ${name} API Key` : `Add ${name} API Keys`;
|
||||
const { activeKeys, setActiveKeys } = useActiveKeys();
|
||||
|
||||
return (
|
||||
<div className="relative h-full p-[2px] overflow-hidden rounded-[9px] group/card bg-borderSubtle hover:bg-transparent hover:duration-300">
|
||||
|
||||
@@ -4,7 +4,6 @@ import { BaseProviderGrid, getProviderDescription } from './BaseProviderGrid';
|
||||
import { supported_providers, provider_aliases, required_keys } from '../models/hardcoded_stuff';
|
||||
import { ProviderSetupModal } from '../ProviderSetupModal';
|
||||
import { getApiUrl, getSecretKey } from '../../../config';
|
||||
import { toast } from 'react-toastify';
|
||||
import { getActiveProviders, isSecretKey } from '../api_keys/utils';
|
||||
import { useModel } from '../models/ModelContext';
|
||||
import { Button } from '../../ui/button';
|
||||
|
||||
Reference in New Issue
Block a user