Skip to content

Commit 25da774

Browse files
committed
fix: update license information in README and improve type definitions in tests
1 parent daa8162 commit 25da774

10 files changed

Lines changed: 20 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,5 @@ Contributions are welcome! Please feel free to submit a Pull Request.
209209

210210
## License
211211

212-
MIT License - see the LICENSE file for details.
212+
[GNU Affero General Public License v3.0 (AGPL-3.0)](LICENSE) see the LICENSE file for details.
213213
# opsledger

frontend/src/components/ChangeItem.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function setRole(role: 'admin' | 'editor' | 'viewer') {
1818
if (action === 'edit_changes') return role === 'admin' || role === 'editor';
1919
return true;
2020
},
21-
} as any);
21+
} as ReturnType<typeof useAuth>);
2222
}
2323

2424
function renderChangeItem(
2525
changeOverrides?: Partial<import('@/types/change').Change>,
26-
handlers?: { onEdit?: (c: any) => void; onDelete?: (c: any) => void },
26+
handlers?: { onEdit?: (c: import('@/types/change').Change) => void; onDelete?: (c: import('@/types/change').Change) => void },
2727
) {
2828
const change = mockChange(changeOverrides);
2929
return render(

frontend/src/components/EditChangeDialog.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('EditChangeDialog', () => {
5454
});
5555

5656
it('successful edit calls PUT with correct payload', async () => {
57-
let capturedBody: any = null;
57+
let capturedBody: unknown = null;
5858
server.use(
5959
http.put(`${API_URL}/api/changes/1`, async ({ request }) => {
6060
capturedBody = await request.json();

frontend/src/components/RequireAuth.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function renderWithAuth(
2727
logout: vi.fn(),
2828
register: vi.fn(),
2929
};
30-
mockUseAuth.mockReturnValue(authValue as any);
30+
mockUseAuth.mockReturnValue(authValue as ReturnType<typeof useAuth>);
3131

3232
return render(
3333
<MemoryRouter initialEntries={['/protected']}>

frontend/src/components/ui/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Command = React.forwardRef<
2121
));
2222
Command.displayName = CommandPrimitive.displayName;
2323

24-
interface CommandDialogProps extends DialogProps {}
24+
type CommandDialogProps = DialogProps;
2525

2626
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
2727
return (

frontend/src/components/ui/textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22

33
import { cn } from "@/lib/utils";
44

5-
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
5+
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
66

77
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(({ className, ...props }, ref) => {
88
return (

frontend/src/lib/api.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,17 @@ describe('api', () => {
6161

6262
// Mock window.location.href
6363
const originalHref = window.location.href;
64+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6465
delete (window as any).location;
66+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6567
(window as any).location = { href: originalHref };
6668

6769
await expect(api.get('/api/test')).rejects.toThrow('Unauthorized');
6870
expect(getToken()).toBeNull();
6971
expect(window.location.href).toBe('/login');
7072

7173
// Restore
74+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7275
(window as any).location = new URL(originalHref);
7376
});
7477

frontend/src/pages/AddChange.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('AddChange', () => {
107107
});
108108

109109
it('submit sends correct payload', async () => {
110-
let capturedBody: any = null;
110+
let capturedBody: unknown = null;
111111
server.use(
112112
http.post(`${API_URL}/api/changes`, async ({ request }) => {
113113
capturedBody = await request.json();

frontend/src/test/helpers.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@ export function mockChange(overrides?: Partial<import('@/types/change').Change>)
3838

3939
const ROLE_LEVEL: Record<UserRole, number> = { viewer: 1, editor: 2, admin: 3 };
4040

41+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4142
const AuthContext = React.createContext<any>(null);
4243

4344
// We dynamically import to get the actual context reference
45+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4446
let _realAuthContext: React.Context<any> | null = null;
4547

4648
async function getRealAuthContext() {
4749
if (!_realAuthContext) {
4850
const mod = await import('@/contexts/AuthContext');
4951
// The context is not exported, but useAuth reads from it.
5052
// We'll use a provider wrapper approach instead.
51-
_realAuthContext = (mod as any).__AuthContext;
53+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
54+
_realAuthContext = (mod as Record<string, unknown>).__AuthContext as React.Context<any>;
5255
}
5356
return _realAuthContext;
5457
}
@@ -120,7 +123,7 @@ export function createAuthValue(user: AuthUser | null) {
120123
interface WrapperOptions {
121124
user?: AuthUser | null;
122125
initialRoute?: string;
123-
authOverrides?: Record<string, any>;
126+
authOverrides?: Record<string, unknown>;
124127
}
125128

126129
/**
@@ -139,7 +142,8 @@ export function renderWithProviders(
139142

140143
// We need to provide this through the real context. We'll use the mock approach.
141144
// Set the mock return value before rendering.
142-
const { useAuth } = require('@/contexts/AuthContext');
145+
// eslint-disable-next-line @typescript-eslint/no-require-imports
146+
const { useAuth } = require('@/contexts/AuthContext') as { useAuth: { _isMockFunction?: boolean; mockReturnValue: (v: unknown) => void } };
143147
if (typeof useAuth === 'function' && useAuth._isMockFunction) {
144148
useAuth.mockReturnValue(authValue);
145149
}

frontend/tailwind.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Config } from "tailwindcss";
2+
import tailwindcssAnimate from "tailwindcss-animate";
23

34
export default {
45
darkMode: ["class"],
@@ -104,5 +105,5 @@ export default {
104105
},
105106
},
106107
},
107-
plugins: [require("tailwindcss-animate")],
108+
plugins: [tailwindcssAnimate],
108109
} satisfies Config;

0 commit comments

Comments
 (0)