chore: add vitest/globals types, remove redundant vitest imports, fix pre-existing lint issues
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './client';
|
||||
export * from './types';
|
||||
|
||||
@@ -21,14 +21,13 @@ export type BaseRecord = {
|
||||
/**
|
||||
* Record last update timestamp (ISO 8601)
|
||||
*/
|
||||
updated: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* PocketBase collection for simple text blocks (Intro, Bio).
|
||||
*/
|
||||
export type PageContentRecord = BaseRecord & {
|
||||
updated: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* PocketBase collection for simple text blocks (Intro, Bio).
|
||||
*/
|
||||
export type PageContentRecord = BaseRecord & {
|
||||
/**
|
||||
* Slug corresponding to the parent section
|
||||
*/
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
export * from './ui';
|
||||
export * from './lib';
|
||||
export * from './api';
|
||||
export * from './lib';
|
||||
export * from './ui';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { cn } from './cn';
|
||||
|
||||
describe('cn', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { type ClassValue, clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { formatYearRange } from './formatDate';
|
||||
|
||||
describe('formatYearRange', () => {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { Badge } from './ui/Badge';
|
||||
export type { BadgeVariant } from './ui/Badge';
|
||||
export { Badge } from './ui/Badge';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Badge } from './Badge';
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export type { ButtonSize, ButtonVariant } from './ui/Button';
|
||||
export { Button } from './ui/Button';
|
||||
export type { ButtonVariant, ButtonSize } from './ui/Button';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { Button } from './Button';
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './ui/Card';
|
||||
export type { CardBackground } from './ui/Card';
|
||||
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './ui/Card';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './Card';
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './Card';
|
||||
|
||||
const meta: Meta<typeof Card> = {
|
||||
title: 'Shared/Card',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './Card';
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './Card';
|
||||
|
||||
describe('Card', () => {
|
||||
describe('rendering', () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Input, Textarea } from './Input';
|
||||
|
||||
@@ -35,7 +34,7 @@ describe('Input', () => {
|
||||
const input = screen.getByRole('textbox');
|
||||
const errorId = input.getAttribute('aria-describedby');
|
||||
expect(errorId).toBeTruthy();
|
||||
expect(document.getElementById(errorId!)).toHaveTextContent('Required');
|
||||
expect(document.getElementById(errorId as string)).toHaveTextContent('Required');
|
||||
});
|
||||
it('no aria-describedby when no error', () => {
|
||||
render(<Input />);
|
||||
@@ -100,7 +99,7 @@ describe('Textarea', () => {
|
||||
const textarea = screen.getByRole('textbox');
|
||||
const errorId = textarea.getAttribute('aria-describedby');
|
||||
expect(errorId).toBeTruthy();
|
||||
expect(document.getElementById(errorId!)).toHaveTextContent('Too short');
|
||||
expect(document.getElementById(errorId as string)).toHaveTextContent('Too short');
|
||||
});
|
||||
it('no aria-describedby when no error', () => {
|
||||
render(<Textarea />);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useId, type InputHTMLAttributes, type TextareaHTMLAttributes } from 'react';
|
||||
import { type InputHTMLAttributes, type TextareaHTMLAttributes, useId } from 'react';
|
||||
import { cn } from '$shared/lib';
|
||||
|
||||
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { Section, Container } from './ui/Section';
|
||||
export type { SectionBackground, ContainerSize } from './ui/Section';
|
||||
export type { ContainerSize, SectionBackground } from './ui/Section';
|
||||
export { Container, Section } from './ui/Section';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
||||
import { Section, Container } from './Section';
|
||||
import { Container, Section } from './Section';
|
||||
|
||||
const meta: Meta<typeof Section> = {
|
||||
title: 'Shared/Section',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Section, Container } from './Section';
|
||||
import { Container, Section } from './Section';
|
||||
|
||||
describe('Section', () => {
|
||||
describe('rendering', () => {
|
||||
@@ -36,13 +35,13 @@ describe('Section', () => {
|
||||
describe('bordered', () => {
|
||||
it('no border classes by default', () => {
|
||||
const { container } = render(<Section>x</Section>);
|
||||
const el = container.querySelector('section')!;
|
||||
const el = container.querySelector('section') as HTMLElement;
|
||||
expect(el).not.toHaveClass('brutal-border-top');
|
||||
expect(el).not.toHaveClass('brutal-border-bottom');
|
||||
});
|
||||
it('adds top and bottom borders when bordered=true', () => {
|
||||
const { container } = render(<Section bordered>x</Section>);
|
||||
const el = container.querySelector('section')!;
|
||||
const el = container.querySelector('section') as HTMLElement;
|
||||
expect(el).toHaveClass('brutal-border-top');
|
||||
expect(el).toHaveClass('brutal-border-bottom');
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
||||
import { TechStackGrid, TechStackBrick } from './TechStack';
|
||||
import { TechStackBrick, TechStackGrid } from './TechStack';
|
||||
|
||||
const meta: Meta<typeof TechStackGrid> = {
|
||||
title: 'Shared/TechStack',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { TechStackBrick, TechStackGrid } from './TechStack';
|
||||
|
||||
@@ -41,11 +40,11 @@ describe('TechStackGrid', () => {
|
||||
});
|
||||
it('renders correct number of bricks', () => {
|
||||
const { container } = render(<TechStackGrid skills={['A', 'B', 'C']} />);
|
||||
expect(container.firstChild!.childNodes).toHaveLength(3);
|
||||
expect(container.firstChild?.childNodes).toHaveLength(3);
|
||||
});
|
||||
it('renders empty grid with no skills', () => {
|
||||
const { container } = render(<TechStackGrid skills={[]} />);
|
||||
expect(container.firstChild!.childNodes).toHaveLength(0);
|
||||
expect(container.firstChild?.childNodes).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ export function TechStackGrid({ skills, className }: TechStackGridProps) {
|
||||
<div
|
||||
className={cn('grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4', className)}
|
||||
>
|
||||
{skills.map((skill, index) => (
|
||||
<TechStackBrick key={index} name={skill} />
|
||||
{skills.map((skill) => (
|
||||
<TechStackBrick key={skill} name={skill} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user