Skip to content

Commit 52e6729

Browse files
authored
Merge pull request #14 from lambda-curry/codegen/sta-16-upgrade-biome-to-latest-version-starter
2 parents b034ea2 + 4299449 commit 52e6729

26 files changed

+109
-88
lines changed

apps/todo-app/app/components/__tests__/add-todo.test.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import { render, screen, fireEvent } from '@testing-library/react';
2-
import { describe, it, expect, vi } from 'vitest';
3-
import { AddTodo } from '../add-todo';
1+
import { fireEvent, render, screen } from '@testing-library/react';
42
import { createMemoryRouter, RouterProvider } from 'react-router-dom';
3+
import { describe, expect, it, vi } from 'vitest';
4+
import { AddTodo } from '../add-todo';
55

66
// Hoist regex to top-level to satisfy performance rule
77
const addRegex = /add/i;
88

99
function renderWithRouter(ui: React.ReactElement) {
10-
const router = createMemoryRouter([
11-
{ path: '/', element: ui }
12-
], { initialEntries: ['/'] });
10+
const router = createMemoryRouter([{ path: '/', element: ui }], { initialEntries: ['/'] });
1311
return render(<RouterProvider router={router} />);
1412
}
1513

apps/todo-app/app/components/add-todo.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { z } from 'zod';
21
import { zodResolver } from '@hookform/resolvers/zod';
3-
import { RemixFormProvider, useRemixForm } from 'remix-hook-form';
4-
import { Plus } from 'lucide-react';
5-
import { TextField, FormError } from '@lambdacurry/forms';
2+
import { FormError, TextField } from '@lambdacurry/forms';
63
import { Button } from '@lambdacurry/forms/ui';
4+
import { Plus } from 'lucide-react';
5+
import { RemixFormProvider, useRemixForm } from 'remix-hook-form';
6+
import { z } from 'zod';
77

88
const addTodoSchema = z.object({
99
text: z.string().min(1, 'Todo text is required').trim()

apps/todo-app/app/components/todo-item.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { useState } from 'react';
21
import { zodResolver } from '@hookform/resolvers/zod';
3-
import { RemixFormProvider, useRemixForm } from 'remix-hook-form';
4-
import { z } from 'zod';
5-
import { Trash2, Edit2, Check, X } from 'lucide-react';
6-
import { TextField, FormError } from '@lambdacurry/forms';
2+
import { FormError, TextField } from '@lambdacurry/forms';
73
import { Button } from '@lambdacurry/forms/ui';
84
import { Checkbox } from '@todo-starter/ui';
9-
import { cn } from '@todo-starter/utils';
105
import type { Todo } from '@todo-starter/utils';
6+
import { cn } from '@todo-starter/utils';
7+
import { Check, Edit2, Trash2, X } from 'lucide-react';
8+
import { useState } from 'react';
9+
import { RemixFormProvider, useRemixForm } from 'remix-hook-form';
10+
import { z } from 'zod';
1111

1212
const editTodoSchema = z.object({
1313
text: z.string().min(1, 'Todo text is required').trim()

apps/todo-app/app/lib/__tests__/todo-context.test.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { describe, it, expect } from 'vitest';
2-
import { render, screen, act } from '@testing-library/react';
3-
import { TodoProvider, useTodoStore, getFilteredTodos } from '../todo-context';
1+
import { act, render, screen } from '@testing-library/react';
42
import type { Todo } from '@todo-starter/utils';
3+
import { describe, expect, it } from 'vitest';
4+
import { getFilteredTodos, TodoProvider, useTodoStore } from '../todo-context';
55

66
// Mock crypto.randomUUID for consistent testing
77
Object.defineProperty(global, 'crypto', {
@@ -27,7 +27,11 @@ function TestComponent() {
2727
<button type="button" onClick={() => todos.length > 0 && deleteTodo(todos[0].id)} data-testid="delete-todo">
2828
Delete First Todo
2929
</button>
30-
<button type="button" onClick={() => todos.length > 0 && updateTodo(todos[0].id, 'Updated text')} data-testid="update-todo">
30+
<button
31+
type="button"
32+
onClick={() => todos.length > 0 && updateTodo(todos[0].id, 'Updated text')}
33+
data-testid="update-todo"
34+
>
3135
Update First Todo
3236
</button>
3337
<button type="button" onClick={() => setFilter('active')} data-testid="set-filter">
@@ -144,7 +148,9 @@ describe('todo-context', () => {
144148
// Suppress console.error for this test
145149
const originalError = console.error;
146150
// Provide a no-op replacement with a body to satisfy linter
147-
console.error = (..._args: unknown[]) => { /* intentionally empty */ };
151+
console.error = (..._args: unknown[]) => {
152+
/* intentionally empty */
153+
};
148154

149155
expect(() => {
150156
render(<TestComponent />);

apps/todo-app/app/lib/todo-context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createContext, useContext, useReducer, type ReactNode } from 'react';
21
import type { Todo, TodoFilter } from '@todo-starter/utils';
2+
import { createContext, type ReactNode, useContext, useReducer } from 'react';
33

44
// Define the action types for the reducer
55
type TodoAction =

apps/todo-app/app/root.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
2-
31
import type { MetaFunction } from 'react-router';
2+
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
43
import { TodoProvider } from '~/lib/todo-context';
54
import './globals.css';
65

apps/todo-app/app/routes/create-todo.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { MetaFunction, ActionFunctionArgs } from 'react-router';
21
import { zodResolver } from '@hookform/resolvers/zod';
3-
import { RemixFormProvider, useRemixForm, getValidatedFormData } from 'remix-hook-form';
4-
import { z } from 'zod';
5-
import { useFetcher, useNavigate } from 'react-router';
6-
import { TextField, Checkbox, RadioGroup, DatePicker, FormError } from '@lambdacurry/forms';
2+
import { Checkbox, DatePicker, FormError, RadioGroup, TextField } from '@lambdacurry/forms';
73
import { Button } from '@lambdacurry/forms/ui';
84
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@todo-starter/ui';
95
import type { Todo } from '@todo-starter/utils';
106
import { ArrowLeft, Plus } from 'lucide-react';
7+
import type { ActionFunctionArgs, MetaFunction } from 'react-router';
8+
import { useFetcher, useNavigate } from 'react-router';
9+
import { getValidatedFormData, RemixFormProvider, useRemixForm } from 'remix-hook-form';
10+
import { z } from 'zod';
1111

1212
const createTodoSchema = z.object({
1313
title: z.string().min(1, 'Title is required').max(100, 'Title must be less than 100 characters'),

apps/todo-app/app/routes/home.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { Button } from '@lambdacurry/forms/ui';
2+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@todo-starter/ui';
3+
import { Settings } from 'lucide-react';
14
import type { MetaFunction } from 'react-router';
25
import { Link } from 'react-router';
3-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@todo-starter/ui';
4-
import { Button } from '@lambdacurry/forms/ui';
56
import { AddTodo } from '~/components/add-todo';
6-
import { TodoItem } from '~/components/todo-item';
77
import { TodoFilters } from '~/components/todo-filters';
8-
import { useTodoStore, getFilteredTodos } from '~/lib/todo-context';
9-
import { Settings } from 'lucide-react';
8+
import { TodoItem } from '~/components/todo-item';
9+
import { getFilteredTodos, useTodoStore } from '~/lib/todo-context';
1010

1111
export const meta: MetaFunction = () => {
1212
return [

apps/todo-app/test/setup.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import '@testing-library/jest-dom/vitest';
2-
import { afterEach } from 'vitest';
32
import { cleanup } from '@testing-library/react';
3+
import { afterEach } from 'vitest';
44

55
// React Router's useRemixForm calls useHref; wrap renders in a Router for components that need it.
66
// For tests that require Router context, prefer rendering the component within a MemoryRouter in the test itself.
77

88
afterEach(() => {
99
cleanup();
1010
});
11-

apps/todo-app/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ interface ImportMetaEnv {
1111
interface ImportMeta {
1212
readonly env: ImportMetaEnv;
1313
}
14-

0 commit comments

Comments
 (0)