@@ -39,19 +39,17 @@ TypeORM is a TypeScript-based Object-Relational Mapping (ORM) library that suppo
3939### Code Style
4040
4141- ** Formatting** : Use Prettier with these settings:
42- - No semicolons (` "semi": false ` )
43- - Arrow function parentheses always (` "arrowParens": "always" ` )
44- - Trailing commas everywhere (` "trailingComma": "all" ` )
42+ - No semicolons (` "semi": false ` )
4543- ** Linting** : ESLint with TypeScript support
46- - Use ` @typescript-eslint ` rules
47- - Warnings allowed for some ` @typescript-eslint/no-* ` rules
48- - Unused variables starting with ` _ ` are ignored
44+ - Use ` @typescript-eslint ` rules
45+ - Warnings allowed for some ` @typescript-eslint/no-* ` rules
46+ - Unused variables starting with ` _ ` are ignored
4947- ** Naming Conventions** :
50- - Classes: PascalCase (e.g., ` DataSource ` , ` EntityManager ` )
51- - Interfaces: PascalCase (e.g., ` ColumnOptions ` , ` RelationOptions ` )
52- - Variables/functions: camelCase
53- - Constants: UPPER_SNAKE_CASE for true constants
54- - Private members: Use standard camelCase (no underscore prefix)
48+ - Classes: PascalCase (e.g., ` DataSource ` , ` EntityManager ` )
49+ - Interfaces: PascalCase (e.g., ` ColumnOptions ` , ` RelationOptions ` )
50+ - Variables/functions: camelCase
51+ - Constants: UPPER_SNAKE_CASE for true constants
52+ - Private members: Use standard camelCase (no underscore prefix)
5553
5654### TypeScript Patterns
5755
@@ -67,6 +65,7 @@ TypeORM is a TypeScript-based Object-Relational Mapping (ORM) library that suppo
6765### Test Structure
6866
6967Tests are organized in ` test/ ` directory:
68+
7069- ** ` test/functional/ ` ** - Feature and integration tests organized by functionality (preferred)
7170- ** ` test/github-issues/ ` ** - Tests for specific GitHub issues
7271- ** ` test/unit/ ` ** - Unit tests for individual components
@@ -77,50 +76,62 @@ Tests are organized in `test/` directory:
7776### Test Writing Guidelines
7877
79781 . ** Use the standard test template** :
79+
8080``` typescript
81+ import { expect } from " chai"
8182import " reflect-metadata"
82- import { createTestingConnections , closeTestingConnections , reloadTestingDatabases } from " ../../utils/test-utils"
83+ import {
84+ closeTestingConnections ,
85+ createTestingConnections ,
86+ reloadTestingDatabases ,
87+ } from " ../../utils/test-utils"
8388import { DataSource } from " ../../../src/data-source/DataSource"
84- import { expect } from " chai"
8589
8690describe (" description of functionality" , () => {
8791 let dataSources: DataSource []
88- before (async () => dataSources = await createTestingConnections ({
89- entities: [__dirname + " /entity/*{.js,.ts}" ],
90- schemaCreate: true ,
91- dropSchema: true ,
92- }))
92+ before (
93+ async () =>
94+ (dataSources = await createTestingConnections ({
95+ entities: [__dirname + " /entity/*{.js,.ts}" ],
96+ schemaCreate: true ,
97+ dropSchema: true ,
98+ })),
99+ )
93100 beforeEach (() => reloadTestingDatabases (dataSources ))
94101 after (() => closeTestingConnections (dataSources ))
95102
96- it (" should do something specific" , () => Promise .all (dataSources .map (async dataSource => {
97- // Test implementation
98- })))
103+ it (" should do something specific" , () =>
104+ Promise .all (
105+ dataSources .map (async (dataSource ) => {
106+ // Test implementation
107+ }),
108+ ))
99109})
100110```
101111
1021122 . ** Test Configuration** :
103- - Tests run against multiple databases (as configured in ` ormconfig.json ` )
104- - Each test should work across all supported databases unless database-specific
105- - Place entity files in ` ./entity/ ` relative to test file for automatic loading
106- - Use ` Promise.all(dataSources.map(...)) ` pattern to test against all databases
113+ - Tests run against multiple databases (as configured in ` ormconfig.json ` )
114+ - Each test should work across all supported databases unless database-specific
115+ - Place entity files in ` ./entity/ ` relative to test file for automatic loading
116+ - Use ` Promise.all(dataSources.map(...)) ` pattern to test against all databases
107117
1081183 . ** Test Naming** :
109- - Use descriptive ` describe() ` blocks for features
110- - Use "should..." format for ` it() ` descriptions
111- - Reference GitHub issue numbers when fixing specific issues
119+ - Use descriptive ` describe() ` blocks for features
120+ - Use "should..." format for ` it() ` descriptions
121+ - Reference GitHub issue numbers when fixing specific issues
112122
1131234 . ** Running Tests** :
114- - Full test suite: ` npm test` (compiles then runs tests)
115- - Fast iteration: ` npm run test:fast` (runs without recompiling)
116- - Specific tests: ` npm run test:fast -- --grep "pattern"`
117- - Watch mode: ` npm run compile -- --watch` + ` npm run test:fast`
124+ - Full test suite: ` pnpm run test` (compiles then runs tests)
125+ - Fast iteration: ` pnpm run test:fast` (runs without recompiling)
126+ - Specific tests: ` pnpm run test:fast -- --grep "pattern"`
127+ - Watch mode: ` pnpm run compile -- --watch` + ` pnpm run test:fast`
118128
119129## Database-Specific Considerations
120130
121131### Multi-Database Support
122132
123133When writing code or tests:
134+
124135- Ensure compatibility across all supported databases
125136- Use driver-specific code only in ` src/driver/ ` directory
126137- Test database-agnostic code against multiple databases
@@ -130,6 +141,7 @@ When writing code or tests:
130141### Driver Implementation
131142
132143Each driver in ` src/driver/ ` implements common interfaces:
144+
133145- Connection management
134146- Query execution
135147- Schema synchronization
@@ -168,20 +180,20 @@ Each driver in `src/driver/` implements common interfaces:
168180
169181### Commands
170182
171- - ** Build** : ` npm run compile` - Compiles TypeScript to ` build/compiled/ `
172- - ** Package** : ` npm run package` - Creates distribution in ` build/package/ `
173- - ** Pack** : ` npm run pack` - Creates ` .tgz ` file in ` build/ `
174- - ** Test** : ` npm test` - Compile and run all tests
175- - ** Lint** : ` npm run lint` - Run ESLint
176- - ** Format** : ` npm run format` - Run Prettier
177- - ** Watch** : ` npm run watch` - Watch mode for TypeScript compilation
183+ - ** Build** : ` pnpm run compile` - Compiles TypeScript to ` build/compiled/ `
184+ - ** Package** : ` pnpm run package` - Creates distribution in ` build/package/ `
185+ - ** Pack** : ` pnpm pack` - Creates ` .tgz ` file in ` build/ `
186+ - ** Test** : ` pnpm run test` - Compile and run all tests
187+ - ** Lint** : ` pnpm run lint` - Run ESLint
188+ - ** Format** : ` pnpm run format` - Run Prettier
189+ - ** Watch** : ` pnpm run watch` - Watch mode for TypeScript compilation
178190
179191### Development Setup
180192
181- 1 . Install dependencies: ` npm install`
193+ 1 . Install dependencies: ` pnpm install`
1821942 . Copy config: ` cp ormconfig.sample.json ormconfig.json `
1831953 . Configure database connections in ` ormconfig.json `
184- 4 . Optionally use Docker: ` docker- compose up ` for database services
196+ 4 . Optionally use Docker: ` docker compose up ` for database services
185197
186198### Pre-commit Hooks
187199
@@ -194,6 +206,7 @@ Each driver in `src/driver/` implements common interfaces:
194206### Commit Message Format
195207
196208Follow conventional commits:
209+
197210```
198211<type>: <subject>
199212
@@ -204,7 +217,8 @@ Follow conventional commits:
204217
205218** Types** : ` feat ` , ` fix ` , ` docs ` , ` style ` , ` refactor ` , ` perf ` , ` test ` , ` build ` , ` chore ` , ` revert `
206219
207- ** Subject** :
220+ ** Subject** :
221+
208222- Use imperative, present tense
209223- Don't capitalize first letter
210224- No period at the end
@@ -232,7 +246,7 @@ export class User {
232246 @Column ()
233247 name: string
234248
235- @OneToMany (() => Photo , photo => photo .user )
249+ @OneToMany (() => Photo , ( photo ) => photo .user )
236250 photos: Photo []
237251}
238252```
0 commit comments