-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/component scaffold #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When: 2025-08-29T00:00:00Z Why: Provide a ready-to-use React component library scaffold with ESM-only build, tests, and a browser playground, while removing the previous CLI-oriented template pieces. What changed: - package.json: rename, add peer deps (react, react-dom), add dev deps (React, Vite, Testing Library), ESM-only exports, sideEffects: false, remove CLI bin, add dev/preview scripts. - rollup.config.ts: ESM-only output; remove CJS/IIFE and CLI builds; externalize react/jsx-runtime. - tsconfig.json: enable DOM libs and react-jsx runtime. - eslint.config.js: include *.test.tsx in vitest lint context. - src/index.ts: export HelloWorld component. - src/components/HelloWorld.tsx: new hello-world component. - src/components/HelloWorld.test.tsx: new tests using Testing Library. - playground/*: new Vite playground (vite.config.ts, index.html, src/main.tsx, src/App.tsx). - .stan/system/stan.project.md: record durable project rules. - .stan/system/stan.todo.md: update plan with completed items and next up. - Remove legacy CLI and foo: delete src/cli/mycli/*, src/foo.ts, src/foo.test.ts, src/util/packageName.ts.
When: 2025-08-29T00:00:00Z Why: Lint and TypeScript errors were caused by playground code being scanned, missing jest-dom setup, and implicit any/unsafe return types. Also stan:build referenced a non-existent file. What changed: - eslint.config.js: ignore playground/**; include *.test.tsx in vitest rules; normalize parserOptions block. - tsconfig.json: add DOM libs, add @testing-library/jest-dom to types, restrict include to src/** and vitest setup/config, exclude playground. - vitest.config.ts: add setupFiles for jest-dom; created vitest.setup.ts to register matchers. - src/components/HelloWorld.tsx: remove React import (react-jsx); type return as JSX.Element to satisfy no-unsafe-return. - src/components/HelloWorld.test.tsx: sort imports, rely on global jest-dom setup. - stan.config.yml: map build to standard Rollup build. - package.json: remove stan:build script. - stan.project.md: document playground exclusions and jest-dom setup. - stan.todo.md: update plan with completed fixes and next actions.
When: 2025-08-29T00:00:00Z Why: Linting errored on root TS files due to type-aware parsing with parserOptions.project; tests and playground caused typecheck/docs errors when dev deps weren’t installed. Move to TypeScript flat config, restrict scopes, and refine TS settings for a clean baseline. What changed: - eslint.config.ts: new TypeScript flat config; base JS/TS recommended, Vitest rules for tests, Prettier + simple-import-sort + TSDoc; ignore playground, .rollup.cache, dist, etc. - Removed eslint.config.js. - package.json: add tsx devDependency; run ESLint via node --loader tsx; keep existing scripts intact. - tsconfig.json: exclude tests and playground from typecheck; remove '@testing-library/jest-dom' from compiler types to avoid missing type errors during build/docs when not yet installed. - vitest.config.ts: exclude .rollup.cache to avoid stale compiled tests. - stan.project.md: document flat TS ESLint config and execution. - stan.todo.md: record completed changes and next steps (npm install, README refresh).
When: 2025-08-29T00:00:00Z Why: The project pivoted from a generic TS library/CLI template to a React 18 component library template. The README must reflect the new DX: Vite playground, ESM-only builds, Vitest + Testing Library, TypeScript ESLint flat config, and usage guidance. What changed: - README.md: new content covering features, getting started, component authoring, tests, Vite playground, build/publish, linting, typecheck, TypeDoc, and readiness notes. - .stan/system/stan.todo.md: record README update under Completed.
When: 2025-08-31T00:00:00Z
Why: Improve confidence in public exports and component behavior; make
coverage metrics reflect actual source instead of docs/build assets.
What changed:
- src/index.test.tsx: new test to validate library entry re-exports
- src/components/HelloWorld.edge-cases.test.tsx: edge cases for empty
string, '0', and emoji/unicode handling
- vitest.config.ts: exclude docs/, dist/, playground/ from coverage
- README.md: add example for testing library entry; coverage notes
- .stan/system/stan.todo.md: mark README update/tests complete; note
coverage tuning
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a significant and well-executed refactoring that transforms a generic TypeScript package template into a specialized one for React component libraries. The changes are comprehensive, introducing React 18, Vite for a development playground, Vitest with Testing Library for testing, and an ESM-only build process. The configuration files and documentation have been thoroughly updated to reflect this new focus. I've found one high-severity issue regarding an inconsistency in the package name across package.json, package-lock.json, and the generated documentation, which could cause dependency issues. Additionally, I've suggested a medium-severity improvement to the README to restore guidance on how to use this template, which would greatly improve its usability.
When: 2025-08-31T00:00:00Z
Why: Improve onboarding for new projects adopting the template, including
where to change placeholders and how to run the first release.
What changed:
- README.md: add section covering template usage (GitHub UI, degit,
shallow clone), placeholder fields to update, npm pkg set snippet,
and first-release steps (GITHUB_TOKEN, release-it)
- .stan/system/stan.todo.md: record README improvement in Completed
When: 2025-08-31T00:00:30Z
Why: ESLint failed on Windows due to a typescript-eslint parser bug
reporting an invalid tsconfigRootDir path format. Providing a
resolved absolute path avoids the issue and restores cross-OS
linting.
What changed:
- eslint.config.ts: add node:path import; set
languageOptions.parserOptions.tsconfigRootDir = path.resolve();
- .stan/system/stan.project.md: document Windows tsconfigRootDir note.
- .stan/system/stan.todo.md: record fix and add “re-run lint” next step.
When: 2025-08-31T00:18:00Z
Why: Lint/Prettier should cover all hand-written code, including
/playground. We will not add a new Lefthook script since Prettier
on save already keeps files normalized pre-commit.
What changed:
- eslint.config.ts: include playground; ignore only generated outputs;
add JS block with ESLint recommended; scope TS-only rules and keep
Windows tsconfigRootDir workaround.
- .stan/system/stan.project.md: document lint scope (include playground),
LF-only normalization guidance, and no new hook requirement.
- .stan/system/stan.todo.md: record decision and next verification step.
When: 2025-08-31T00:28:00Z
Why: Prettier and simple-import-sort rules were duplicated across JS/TS
blocks. Consolidating them reduces redundancy while keeping all
non-generated code (incl. playground) in scope.
What changed:
- eslint.config.ts: add shared JS/TS block for Prettier and import-sort;
keep JS base + TS recommended + TS-specific rules; expand Vitest test
globs to include JS.
- .stan/system/stan.todo.md: record change and update timestamp.
When: 2025-08-31T00:36:00Z
Why: Make the template more compelling and self-explanatory by listing
all batteries included (with links), and feature STAN explicitly.
Also fix lint errors from import order/newline in eslint.config.ts.
What changed:
- README.md: added STAN in top features; created “In The Box” section
with emoji-rich subsections and authoritative links; updated Contents.
- eslint.config.ts: sorted external imports per simple-import-sort and
ensured EOF newline to satisfy Prettier.
- .stan/system/stan.todo.md: recorded docs update and lint fix.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This is a comprehensive and well-executed pull request that successfully refactors the project from a generic TypeScript package template to a modern, feature-rich React component library template. The changes are consistent across all configuration files, scripts, and source code, adopting best practices like ESM-only output, correct peer dependency management for React, and a Vite-based playground for a great developer experience. The documentation has also been thoroughly updated to reflect these changes. My review includes a couple of minor suggestions to improve the new README file's clarity. Overall, this is an excellent update that provides a solid foundation for its new purpose.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
No description provided.