Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-03-31
44 changes: 44 additions & 0 deletions openspec/changes/archive/2026-03-31-fix-showcase-issues/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Context

The Mori showcase is a Vite + React app inside `showcase/` used to visually verify all design-system components against Mori tokens. It is an internal devtool — not a published npm package.

Two problems were found:

1. **Missing `node_modules`** — The repo was cloned (or reset) without running `pnpm install`, so every `import` from `react`, `@types/react`, etc. resolves to nothing. TypeScript emits ~80+ TS2307 / TS7026 errors as a cascade. Running `pnpm install` resolves all of them.

2. **Lint violation in `BadgeSection.tsx`** — Line 7 declares a constant using `Array<T>` generic syntax, which is forbidden by the `@typescript-eslint/array-type` rule set to `"array"`. All other files in the repo consistently use `T[]`. This is a mechanical one-line fix.

## Goals / Non-Goals

**Goals:**
- `pnpm typecheck` exits 0 with no errors
- `pnpm lint` exits 0 with no errors
- `pnpm test` continues to pass
- The showcase renders correctly in the browser after `pnpm dev`

**Non-Goals:**
- Adding new showcase sections or components
- Changing any design token, component API, or spec
- Setting up CI automation for dependency installation (separate concern)

## Decisions

**Fix `Array<T>` → `T[]` in BadgeSection.tsx**

The ESLint rule `@typescript-eslint/array-type` is already configured to enforce `T[]` syntax project-wide. The `Array<T>` usage was a simple oversight. The fix is a single character-level edit with no functional impact.

Alternatives considered:
- Disable the rule for that line with `// eslint-disable-next-line` — rejected; the rule exists for a reason and the fix is trivial.
- Change the rule to `"generic"` — rejected; the rest of the codebase uses `T[]` and we won't change convention to match one outlier.

**No code change needed for the dependency issue**

`pnpm install` is the fix. The `package.json` already declares all correct dependencies (`react`, `@types/react`, `@types/react-dom`, etc.). The issue is purely environmental.

## Risks / Trade-offs

- [Risk] Future contributors may re-encounter the "missing node_modules" problem if they forget to install after cloning.
→ Mitigation: Out of scope for this change; a `postclone` script or README note is a separate improvement.

- [Risk] The lint fix is so small it could be missed in review.
→ Mitigation: Tasks doc calls it out explicitly by file and line number.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Why

The Mori showcase (`showcase/`) fails to build, typecheck, or lint because `node_modules` are not installed, and a secondary lint violation in `BadgeSection.tsx` prevents `pnpm lint` from passing even after installation. Fixing this now ensures contributors can run the showcase locally and that CI remains green.

## What Changes

- Document that `pnpm install` must be run before the showcase can operate (dependency state was missing entirely from the repo).
- Fix the lone lint error in `showcase/src/sections/BadgeSection.tsx`: replace the forbidden `Array<T>` generic syntax with the project-standard `T[]` array syntax.
- Verify `pnpm typecheck`, `pnpm lint`, and `pnpm test` all pass after fixes.

## Capabilities

### New Capabilities

_(none — this is a bug fix with no new user-facing capabilities)_

### Modified Capabilities

_(none — no spec-level behaviour changes)_

## Impact

- **File changed**: `showcase/src/sections/BadgeSection.tsx` (line 7 — array type syntax)
- **Environment**: `node_modules` must be present; no code change needed for this, but it is the root cause of cascading TS2307 errors
- **CI**: `pnpm lint` currently exits non-zero; will be green after the fix
- **No breaking changes**; showcase is an internal devtool, not a published package
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## ADDED Requirements

### Requirement: Showcase passes lint with zero errors
The showcase source files SHALL conform to all ESLint rules enforced by the project's `eslint.config.mjs`. Running `pnpm lint` MUST exit with code 0.

#### Scenario: Array type syntax is consistent
- **WHEN** `pnpm lint` is run on the repository
- **THEN** no `@typescript-eslint/array-type` violations are reported in any showcase file

### Requirement: Showcase passes typecheck with zero errors
All TypeScript files under `showcase/` SHALL resolve their imports correctly. Running `pnpm typecheck` MUST exit with code 0.

#### Scenario: React types are available
- **WHEN** `pnpm typecheck` is run after `pnpm install`
- **THEN** no TS2307 or TS7026 errors are reported for showcase source files

### Requirement: Tests pass after showcase fixes
Running `pnpm test` MUST exit with code 0 and no test suite SHALL regress as a result of changes in this fix.

#### Scenario: Existing test suite is unaffected
- **WHEN** `pnpm test` is run after the lint fix is applied
- **THEN** all previously passing tests continue to pass
21 changes: 21 additions & 0 deletions openspec/changes/archive/2026-03-31-fix-showcase-issues/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## 1. Install Dependencies

- [x] 1.1 Run `pnpm install` to restore `node_modules` (prerequisite for all checks below)
- [x] 1.2 Confirm `node_modules` exists and `pnpm typecheck` exits 0 with no errors

## 2. Fix Lint Violation

- [x] 2.1 In `showcase/src/sections/BadgeSection.tsx` line 7, change `Array<{ variant: BadgeVariant; label: string; desc: string }>` to `{ variant: BadgeVariant; label: string; desc: string }[]`
- [x] 2.2 Run `pnpm lint` and confirm it exits 0 with no errors

## 3. Verify Full Health

- [x] 3.1 Run `pnpm typecheck` — must exit 0
- [x] 3.2 Run `pnpm lint` — must exit 0
- [x] 3.3 Run `pnpm test` — all tests must pass
- [x] 3.4 Run `pnpm dev` (or `pnpm build:showcase`) and confirm the showcase renders without console errors

## 4. Commit and Push

- [x] 4.1 Commit the fix to `showcase/src/sections/BadgeSection.tsx` with a clear message (e.g. `fix(showcase): use T[] array syntax in BadgeSection`)
- [x] 4.2 Push to branch `claude/run-opsx-propose-k66iV`
20 changes: 20 additions & 0 deletions openspec/specs/showcase-health/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Requirement: Showcase passes lint with zero errors
The showcase source files SHALL conform to all ESLint rules enforced by the project's `eslint.config.mjs`. Running `pnpm lint` MUST exit with code 0.

#### Scenario: Array type syntax is consistent
- **WHEN** `pnpm lint` is run on the repository
- **THEN** no `@typescript-eslint/array-type` violations are reported in any showcase file

### Requirement: Showcase passes typecheck with zero errors
All TypeScript files under `showcase/` SHALL resolve their imports correctly. Running `pnpm typecheck` MUST exit with code 0.

#### Scenario: React types are available
- **WHEN** `pnpm typecheck` is run after `pnpm install`
- **THEN** no TS2307 or TS7026 errors are reported for showcase source files

### Requirement: Tests pass after showcase fixes
Running `pnpm test` MUST exit with code 0 and no test suite SHALL regress as a result of changes in this fix.

#### Scenario: Existing test suite is unaffected
- **WHEN** `pnpm test` is run after the lint fix is applied
- **THEN** all previously passing tests continue to pass
2 changes: 1 addition & 1 deletion showcase/src/sections/BadgeSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { BadgeVariant } from '@mori/components/ui/badge'
import { SectionWrapper } from '../components/SectionWrapper'
import { VarBlock } from '../components/VarBlock'

const BADGES: Array<{ variant: BadgeVariant; label: string; desc: string }> = [
const BADGES: { variant: BadgeVariant; label: string; desc: string }[] = [
{ variant: 'green', label: '承認済', desc: 'green — success' },
{ variant: 'amber', label: '保留中', desc: 'amber — warning' },
{ variant: 'red', label: 'エラー', desc: 'red — error' },
Expand Down
Loading