A minimal Vite + React + TypeScript starter app.
- Node.js (recommended >= 18)
- npm (bundled with Node) or yarn/pnpm if you prefer
npm install
# or
# yarn
# pnpm install
npm run format:check # verify formatting
npm run lint # verify lintingnpm run dev— start Vite dev server (hot reload)npm run build— run TypeScript check and build production assets (tsc && vite build)npm run preview— preview the production build locallynpm run lint— run ESLint over the codebasenpm run format— run Prettier to format filesnpm test— run Vitest tests
ESLint is configured using .eslintrc.cjs with overrides that run type-aware linting for configuration files where appropriate. If ESLint flags those config files in your editor, restart the ESLint server or the editor so the overrides and tsconfig.json are picked up.
Run tests with:
npm testVitest is configured to use the jsdom environment and loads vitest.setup.ts for setup.
- If
npx tsc --noEmitfails, ensure you have the localtypescriptinstalled (npm install) and your editor's TypeScript service is configured to use the workspace version of TypeScript. - If ESLint in VS Code still flags
vitest.config.ts, reload the window or run the ESLint: Restart Server command.
package.jsonincludes aformat:checkscript (Prettier) in addition toformat..prettierignoreadded to skippackage-lock.json,node_modules/,dist/and/.vite/.
- Project TypeScript configuration lives in
tsconfig.jsonat the repo root. typesincludesvitest/globalsandincludeincludesvitest.setup.tsso testing globals and@testing-library/jest-domtypes are available. ESLint uses.eslintrc.cjswith per-file overrides; overrides point type-aware linting totsconfig.jsonwhere applicable.
If your editor uses a workspace TypeScript version, reload the window to pick up the updated tsconfig layout.
If you plan to upgrade to ESLint 9 and migrate to the newer Flat Config (eslint.config.*) there are a few caveats to be aware of:
-
DevDependency compatibility: upgrade
eslintand all related plugins and parsers together. For example,@typescript-eslint/parserand@typescript-eslint/eslint-pluginshould be compatible with ESLint 9. -
Flat config format change: your current
.eslintrc.cjsis in the legacy hierarchical format. Converting toeslint.config.cjs(Flat Config) requires re-declaring all rules, plugins and overrides programmatically. Don't rush this in the middle of active development. -
Typed linting: you rely on type-aware rules via
parserOptions.projectand per-file overrides. Flat Config supports typed rules but you'll need to translate the scopedparserOptions.projectusage to the new config API — ensuretsconfigRootDiris set when using project-based parsing. -
Editor/CI changes: editors and CI runners may need a restart or updated ESLint extension settings to pick up the new Flat Config filename and API.
-
Test environment: add Vitest test overrides (
env: { vitest: true }) or useplugin:vitest/recommendedif you install that plugin to avoid spurious rule failures in tests.
Recommended migration approach:
- Step 1: Upgrade devDependencies to ESLint 9-compatible versions but keep the legacy config file. Run lint and fix all issues.
- Step 2: Create
eslint.config.cjsin a branch, port rules and overrides incrementally, and run ESLint in CI to see the differences. - Step 3: Update editor settings and inform contributors. Merge when green.