Skip to content

Commit

Permalink
Use @total-typescript/tsconfig/bundler/dom
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed May 15, 2024
1 parent e54c834 commit 8d2080f
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .storybook/decorators.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Decorator } from '@storybook/react'
import { type Decorator } from '@storybook/react'
import { Layout } from '#app/layout'

export const PageDecorator: Decorator = (Story) => {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestRunnerConfig, getStoryContext } from '@storybook/test-runner'
import { type TestRunnerConfig, getStoryContext } from '@storybook/test-runner'
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'

const DEFAULT_VIEWPORT_SIZE = { width: 1280, height: 720 }
Expand Down
2 changes: 1 addition & 1 deletion app/note/[id]/page.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import { cookies } from '@storybook/nextjs/headers.mock'
import { http } from 'msw'
import { getWorker } from 'msw-storybook-addon'
Expand Down
2 changes: 1 addition & 1 deletion app/note/edit/[id]/page.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, fireEvent, userEvent, waitFor, within } from '@storybook/test'
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import { cookies } from '@storybook/nextjs/headers.mock'
import Page from './page'
import { deleteNote, saveNote } from '#app/actions.mock'
Expand Down
2 changes: 1 addition & 1 deletion app/note/edit/page.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, fireEvent, userEvent, within } from '@storybook/test'
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import { cookies } from '@storybook/nextjs/headers.mock'
import Page from './page'
import { saveNote, deleteNote } from '#app/actions.mock'
Expand Down
2 changes: 1 addition & 1 deletion components/auth-button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import AuthButton from './auth-button'
import { getUserFromSession } from '#lib/session.mock'

Expand Down
2 changes: 1 addition & 1 deletion components/auth-button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from 'react'
import { type ReactNode } from 'react'
import Link from 'next/link'
import Image from 'next/image'
import { getUserFromSession } from '#lib/session'
Expand Down
2 changes: 1 addition & 1 deletion components/logout-button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import LogoutButton from './logout-button'
import { cookies } from '@storybook/nextjs/headers.mock'
import { createUserCookie, userCookieKey } from '#lib/session'
Expand Down
2 changes: 1 addition & 1 deletion components/note-editor.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import NoteEditor from "./note-editor";

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion components/note-list-skeleton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import NoteListSkeleton from "./note-list-skeleton";

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion components/note-list.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import NoteList from '#components/note-list'
import { createNotes } from '#mocks/notes'

Expand Down
2 changes: 1 addition & 1 deletion components/note-preview.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import NotePreview from "./note-preview";

const meta = {
Expand Down
8 changes: 4 additions & 4 deletions components/note-ui.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, fireEvent, userEvent, within } from '@storybook/test'
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import { cookies } from '@storybook/nextjs/headers.mock'
import { saveNote, deleteNote } from '#app/actions.mock'
import NoteUI from '#components/note-ui'
Expand All @@ -20,18 +20,18 @@ type Story = StoryObj<typeof meta>
const notes = createNotes()

export const Default: Story = {
args: { isEditing: false, note: notes[0] },
args: { isEditing: false, note: notes[0]! },
}

export const EditMode: Story = {
args: { isEditing: true, note: notes[0] },
args: { isEditing: true, note: notes[0]! },
}

export const EditModeFlow: Story = {
name: 'Edit Mode Flow ▶',
args: {
isEditing: true,
note: notes[0],
note: notes[0]!,
},
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement)
Expand Down
2 changes: 1 addition & 1 deletion components/search.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getRouter } from '@storybook/nextjs/navigation.mock'
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import Search from './search'
import { expect, fireEvent, userEvent, within } from '@storybook/test'

Expand Down
17 changes: 8 additions & 9 deletions components/sidebar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { type Meta, type StoryObj } from '@storybook/react'
import Sidebar from './sidebar'
import { createNotes } from '#mocks/notes'
import { expect, fireEvent, userEvent, within, waitFor } from '@storybook/test'
Expand Down Expand Up @@ -33,8 +33,7 @@ export const NotesExpanded: Story = {
},
}


const changeNoteGate = Promise.withResolvers<void>();
const changeNoteGate = Promise.withResolvers<void>()

export const NoteChangedAnimation: Story = {
render: () => {
Expand All @@ -44,20 +43,20 @@ export const NoteChangedAnimation: Story = {
setNotes((prevNotes) => {
return [
{
...prevNotes[0],
...prevNotes[0]!,
title: 'New title',
},
...prevNotes.slice(1),
]
})
changeNoteGate.resolve();
changeNoteGate.resolve()
}, 1000)
}, [])
return <Sidebar notes={notes} />
},
play: async () => {
await changeNoteGate.promise;
}
await changeNoteGate.promise
},
}

export const ToggleSidebarOnMobile: Story = {
Expand All @@ -79,8 +78,8 @@ export const ToggleSidebarOnMobile: Story = {
await step('Select note', async () => {
const note = canvas.getAllByRole('button', {
name: /Open note for preview/i,
})[0]
note.click()
})[0]!
await userEvent.click(note)
})

await waitFor(function sidebarIsNotVisible() {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@storybook/react": "^8.1.0",
"@storybook/test": "^8.1.0",
"@storybook/test-runner": "^0.17.0",
"@total-typescript/tsconfig": "^1.0.4",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand All @@ -84,7 +85,7 @@
"storybook": "^8.1.0",
"ts-node": "^10.9.2",
"tsx": "^4.7.1",
"typescript": "^5.4.3",
"typescript": "^5.4.5",
"wait-on": "^7.2.0"
},
"prettier": {
Expand Down

0 comments on commit 8d2080f

Please sign in to comment.