@@ -423,9 +423,14 @@ insertPragma: true # Insert @prettier pragma
423423
424424# ## File Structure Conventions
425425
426+ **TypeScript (REQUIRED for all new files):**
427+ - All new source files must be written in TypeScript (`.ts` / `.tsx`)
428+ - Use `.tsx` for React components, `.ts` for all other modules
429+ - Existing `.js` / `.jsx` files are not required to be migrated, but new code must not be added in plain JavaScript
430+
426431**Components:**
427432- Location : ` src/core/components/`
428- - Extension : ` .jsx ` (React components)
433+ - Extension : ` .tsx ` (React components — TypeScript )
429434- Format : PascalCase for component names
430435
431436**Styles:**
@@ -437,7 +442,7 @@ insertPragma: true # Insert @prettier pragma
437442**Tests:**
438443- Unit : ` test/unit/` (mirrors source structure)
439444- E2E : ` test/e2e-cypress/e2e/`
440- - Naming : ` *.test.js ` , `*.spec.js `, `*.cy.js ` (Cypress)
445+ - Naming : ` *.test.ts ` , `*.spec.ts `, `*.cy.ts ` (Cypress) — use `.tsx` variants when JSX is involved
441446
442447---
443448
@@ -764,7 +769,7 @@ dist/ # Build output (generated)
764769### Adding a New Component
765770
7667711 . Create component in ` src/core/components/ ` or appropriate plugin directory
767- 2 . Use ` .jsx ` extension
772+ 2 . Use ` .tsx ` extension (TypeScript — required for all new files)
7687733 . Add ` @prettier ` pragma
7697744 . Follow React best practices (functional components, hooks)
7707755 . Add PropTypes validation
@@ -774,7 +779,7 @@ dist/ # Build output (generated)
774779### Adding a New Plugin
775780
7767811 . Create directory in ` src/core/plugins/[plugin-name]/ `
777- 2 . Create ` index.js ` with plugin structure
782+ 2 . Create ` index.ts ` with plugin structure (TypeScript — required for all new files)
7787833 . Add actions, reducers, selectors as needed
7797844 . Register plugin in preset (e.g., ` src/core/presets/base.js ` )
7807855 . Add tests in ` test/unit/core/plugins/[plugin-name]/ `
@@ -863,40 +868,42 @@ dist/ # Build output (generated)
863868### DO's ✅
864869
8658701 . ** Always read files before modifying them**
866- 2 . ** Follow the no-semicolon convention**
867- 3 . ** Use double quotes for strings**
868- 4 . ** Add ` @prettier ` pragma to all new files**
869- 5 . ** Use ` .jsx ` extension for React components**
870- 6 . ** Write tests for new features and bug fixes**
871- 7 . ** Run linters before committing** (automatic via husky)
872- 8 . ** Use DOMPurify for HTML sanitization**
873- 9 . ** Follow conventional commit format**
874- 10 . ** Update documentation for user-facing changes**
875- 11 . ** Test with multiple OpenAPI spec versions**
876- 12 . ** Check browser compatibility** (see ` .browserslistrc ` )
877- 13 . ** Use the plugin architecture** - don't modify core unnecessarily
878- 14 . ** Preserve backward compatibility** unless explicitly breaking
879- 15 . ** Run full test suite before submitting PR**
880- 16 . ** Keep plugins self-contained** - avoid cross-plugin imports (see [ Cross-Plugin Import Guidelines] ( #cross-plugin-import-guidelines ) )
871+ 2 . ** Write all new files in TypeScript** - use ` .ts ` for modules, ` .tsx ` for React components
872+ 3 . ** Follow the no-semicolon convention**
873+ 4 . ** Use double quotes for strings**
874+ 5 . ** Add ` @prettier ` pragma to all new files**
875+ 6 . ** Use ` .tsx ` extension for new React components** (TypeScript JSX)
876+ 7 . ** Write tests for new features and bug fixes**
877+ 8 . ** Run linters before committing** (automatic via husky)
878+ 9 . ** Use DOMPurify for HTML sanitization**
879+ 10 . ** Follow conventional commit format**
880+ 11 . ** Update documentation for user-facing changes**
881+ 12 . ** Test with multiple OpenAPI spec versions**
882+ 13 . ** Check browser compatibility** (see ` .browserslistrc ` )
883+ 14 . ** Use the plugin architecture** - don't modify core unnecessarily
884+ 15 . ** Preserve backward compatibility** unless explicitly breaking
885+ 16 . ** Run full test suite before submitting PR**
886+ 17 . ** Keep plugins self-contained** - avoid cross-plugin imports (see [ Cross-Plugin Import Guidelines] ( #cross-plugin-import-guidelines ) )
881887
882888### DON'Ts ❌
883889
884- 1 . ** Don't use semicolons** - project convention
885- 2 . ** Don't use single quotes** - use double quotes
886- 3 . ** Don't skip the @prettier pragma** - required for formatting
887- 4 . ** Don't put React in ` .js ` files** - use ` .jsx `
888- 5 . ** Don't commit files in ` dev-helpers/ ` ** (except core files)
889- 6 . ** Don't commit build artifacts** (` dist/ ` is gitignored)
890- 7 . ** Don't skip tests** - they run in CI
891- 8 . ** Don't bypass ESLint** - pre-commit hook enforces
892- 9 . ** Don't use ` console.log ` ** - only ` console.warn ` and ` console.error `
893- 10 . ** Don't render unsanitized HTML** - XSS vulnerability
894- 11 . ** Don't modify ` package-lock.json ` manually**
895- 12 . ** Don't push directly to ` main ` or ` next ` **
896- 13 . ** Don't ignore Cypress test failures**
897- 14 . ** Don't add dependencies without justification**
898- 15 . ** Don't break the build** - verify with ` npm run build `
899- 16 . ** Don't import from other plugins** - create self-contained copies instead (e.g., don't import from ` oas31 ` in ` oas32 ` )
890+ 1 . ** Don't write new files in plain JavaScript** - all new files must be TypeScript (` .ts ` / ` .tsx ` )
891+ 2 . ** Don't use semicolons** - project convention
892+ 3 . ** Don't use single quotes** - use double quotes
893+ 4 . ** Don't skip the @prettier pragma** - required for formatting
894+ 5 . ** Don't put React in ` .ts ` files** - use ` .tsx ` for JSX
895+ 6 . ** Don't commit files in ` dev-helpers/ ` ** (except core files)
896+ 7 . ** Don't commit build artifacts** (` dist/ ` is gitignored)
897+ 8 . ** Don't skip tests** - they run in CI
898+ 9 . ** Don't bypass ESLint** - pre-commit hook enforces
899+ 10 . ** Don't use ` console.log ` ** - only ` console.warn ` and ` console.error `
900+ 11 . ** Don't render unsanitized HTML** - XSS vulnerability
901+ 12 . ** Don't modify ` package-lock.json ` manually**
902+ 13 . ** Don't push directly to ` main ` or ` next ` **
903+ 14 . ** Don't ignore Cypress test failures**
904+ 15 . ** Don't add dependencies without justification**
905+ 16 . ** Don't break the build** - verify with ` npm run build `
906+ 17 . ** Don't import from other plugins** - create self-contained copies instead (e.g., don't import from ` oas31 ` in ` oas32 ` )
900907
901908### When Working with AI Assistants
902909
0 commit comments