Skip to content

docs: ensure consistent plural form for folder names (entities, migrations, etc) - #11903

Merged
gioboa merged 7 commits into
masterfrom
docs-plural-folder-names
Jan 21, 2026
Merged

gioboa merged 7 commits into
masterfrom
docs-plural-folder-names

Conversation

@pkuczynski

@pkuczynski pkuczynski commented Jan 8, 2026 •

Copy link
Copy Markdown
Member

Inspired by #11898. We are very inconsistent in naming across our documentation and code. This is fixing the documentation part.

In my mind it makes more sense to go with prulal in general:

  migrations: [__dirname + '/migrations/**/*{.js,.ts}']
  // vs
  migrations: [__dirname + '/migration/**/*{.js,.ts}']

The first one reads more natural with the config propertis, but also in general people tend to name folders in pluralr like tests, controllers, routes, etc...

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Pattern Change

The glob pattern was changed from *.{js,ts} to *{.js,.ts}. While both patterns work, the new pattern is less conventional and may not be supported consistently across all glob implementations. The original pattern with curly braces around the entire extension list is more standard.

entities: [__dirname + "/entity/*{.js,.ts}"],
schemaCreate: true,

@pkg-pr-new

pkg-pr-new Bot commented Jan 8, 2026 •

Copy link
Copy Markdown
  • typeorm-sql-js-example

    npm i https://pkg.pr.new/typeorm/typeorm@11903
    

commit: fd9b684

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 8, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to d79c5b2

CategorySuggestion                                                                                                                                    Impact
General
Inconsistent folder naming pattern

For consistency with other paths, change the entitySchemas path from "/schemas/"
to "/entity-schemas/" in the documentation example.

docs/docs/data-source/2-data-source-options.md [107-110]

 entities: [__dirname + "/entities/**/*{.js,.ts}"],
 subscribers: [__dirname + "/subscribers/**/*{.js,.ts}"],
-entitySchemas: [__dirname + "/schemas/**/*.json"],
+entitySchemas: [__dirname + "/entity-schemas/**/*.json"],
 migrations: [__dirname + "/migrations/**/*{.js,.ts}"]
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies an inconsistency in the documentation example, which aligns with the PR's goal of standardizing folder names to their plural form.

Low
  • More

Previous suggestions

Suggestions up to commit b00bef3
CategorySuggestion                                                                                                                                    Impact
General
Fix inconsistent glob pattern syntax

Update the glob pattern in the entities example to *{.js,.ts} to correctly match
both JavaScript and TypeScript files for consistency.

docs/docs/data-source/2-data-source-options.md [21]

-Example: `entities: [Post, Category, "entities/*.js", "modules/**/entities/*.js"]`.
+Example: `entities: [Post, Category, "entities/*{.js,.ts}", "modules/**/entities/*{.js,.ts}"]`.
Suggestion importance[1-10]: 4

__

Why: The suggestion correctly identifies an inconsistent glob pattern in a documentation example and proposes a fix that aligns with other changes in the PR, improving documentation consistency.

Low
Suggestions up to commit 08cc1ff
CategorySuggestion                                                                                                                                    Impact
General
Fix inconsistent file extension pattern

Update the glob pattern in the entities example to *{.js,.ts} to consistently
match both JavaScript and TypeScript files.

docs/docs/data-source/2-data-source-options.md [21]

-Example: `entities: [Post, Category, "entities/*.js", "modules/**/entities/*.js"]`.
+Example: `entities: [Post, Category, "entities/*{.js,.ts}", "modules/**/entities/*{.js,.ts}"]`.
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies an inconsistent glob pattern in a documentation example and proposes a fix that aligns with other changes in the PR, improving documentation quality.

Low
✅ Suggestions up to commit a04d143
CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Fix nested array syntax error
Suggestion Impact:The commit directly implements the suggestion by removing the extra nested array brackets from the entities configuration, changing `entities: [[__dirname + "/entities/**/*{.js,.ts}"]],` to `entities: [__dirname + "/entities/**/*{.js,.ts}"],`

code diff:

-    entities: [[__dirname + "/entities/**/*{.js,.ts}"]],
+    entities: [__dirname + "/entities/**/*{.js,.ts}"],

In the entities configuration example, remove the extra nested array brackets to
correct the syntax.

docs/docs/entity/1-entities.md [72]

-entities: [[__dirname + "/entities/**/*{.js,.ts}"]],
+entities: [__dirname + "/entities/**/*{.js,.ts}"],
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a syntax error in the documentation example where entities is assigned a nested array [[...]] instead of a flat array, which would mislead users.

Low
✅ Suggestions up to commit 0f5989b
CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Fix incorrect nested array syntax
Suggestion Impact:The commit directly implements the suggestion by removing the extra brackets from the entities array, changing from [[__dirname + "/entities/**/*{.js,.ts}"]] to [__dirname + "/entities/**/*{.js,.ts}"]

code diff:

-    entities: [[__dirname + "/entities/**/*{.js,.ts}"]],
+    entities: [__dirname + "/entities/**/*{.js,.ts}"],

Remove the extra pair of brackets from the entities option in the DataSource
configuration to correct the invalid nested array syntax.

docs/docs/entity/1-entities.md [72]

-entities: [[__dirname + "/entities/**/*{.js,.ts}"]],
+entities: [__dirname + "/entities/**/*{.js,.ts}"],
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a syntax error (a nested array) in the entities configuration example, which was introduced in the PR and would likely cause the code to fail for users.

Medium
General
Update entity path to plural form

Update the entity path in the test configuration from singular entity to plural
entities to maintain consistency with the PR's refactoring.

test/github-issues/8747/issue-8747.test.ts [18]

-entities: [__dirname + "/entity/*{.js,.ts}"],
+entities: [__dirname + "/entities/*{.js,.ts}"],
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies an inconsistent path in a test file that was missed during the refactoring, ensuring the test configuration aligns with the PR's goal of pluralizing directory names.

Low

@coveralls

coveralls commented Jan 8, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 80.944% (-0.001%) from 80.945%
when pulling fd9b684 on docs-plural-folder-names
into 0ebc7e5 on master.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 21, 2026 •

Copy link
Copy Markdown

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: d79c5b2
Status: ✅  Deploy successful!
Preview URL: https://5418c19a.typeorm.pages.dev
Branch Preview URL: https://docs-plural-folder-names.typeorm.pages.dev

View logs

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 21, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Inconsistent plural folder naming in docs 📘 Rule violation ✓ Correctness
Description
• The PR aims to standardize folder names to plural form (entities, migrations, subscribers,
  controllers) but misses multiple import statements in documentation files.
• Files like getting-started.md, working-with-entity-manager/1-working-with-entity-manager.md,
  working-with-entity-manager/2-working-with-repository.md, and data-source/1-data-source.md still
  use singular ./entity/ in import statements.
• This creates inconsistency where glob patterns use plural entities/**/* but import examples use
  singular entity/, confusing users about the correct naming convention.
Code

docs/docs/data-source/2-data-source-options.md[21]

+  Example: `entities: [Post, Category, "entities/*.js", "modules/**/entities/*.js"]`.
Evidence
The compliance rule requires consistent naming conventions across the project. The PR changes glob
patterns to use plural folder names (entities, migrations, subscribers) but leaves import statements
in multiple documentation files using singular form (entity/). This violates the stated objective of
ensuring consistent plural form for folder names.

Rule 1: Consistent Naming Conventions
docs/docs/data-source/2-data-source-options.md[21-21]
docs/docs/getting-started.md[464-464]
docs/docs/working-with-entity-manager/1-working-with-entity-manager.md[11-11]
docs/docs/data-source/1-data-source.md[80-80]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR updates glob patterns to use plural folder names but leaves import statements using singular form, creating inconsistency in the documentation.

## Issue Context
The PR objective is to ensure consistent plural form for folder names (entities, migrations, subscribers, controllers) across documentation. Multiple files still contain import statements using singular `entity/` path.

## Fix Focus Areas
- docs/docs/getting-started.md[464-464]
- docs/docs/getting-started.md[521-521]
- docs/docs/getting-started.md[547-547]
- docs/docs/getting-started.md[565-565]
- docs/docs/getting-started.md[591-591]
- docs/docs/getting-started.md[624-624]
- docs/docs/getting-started.md[642-642]
- docs/docs/getting-started.md[721-722]
- docs/docs/getting-started.md[861-862]
- docs/docs/getting-started.md[880-881]
- docs/docs/working-with-entity-manager/1-working-with-entity-manager.md[11-11]
- docs/docs/working-with-entity-manager/2-working-with-repository.md[9-9]
- docs/docs/data-source/1-data-source.md[80-80]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Previous review results

Review updated until commit fd9b684

Results up to commit d79c5b2


🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider
Action required
1. Sample Projects Not Updated to Match New Convention 🐞 Bug ✓ Correctness
Description
• The PR changes InitCommand and documentation to use plural directory names (entities/,
  migrations/, subscribers/, controllers/)
• However, all existing sample projects in the repository still use singular directory names
  (entity/, migration/)
• This creates a mismatch where newly generated projects have a different structure than the
  examples users can reference
• Users following sample code will encounter path mismatches and confusion
Code

src/commands/InitCommand.ts[R88-91]

+                basePath + "/src/entities/User.ts",
                InitCommand.getUserEntityTemplate(database),
            )
            await CommandUtils.createFile(
Evidence
The InitCommand generates new projects with plural directory names, but all sample projects in the
repository use singular names. This is evidenced by the directory structure in sample projects
(e.g., sample/sample1-simple-entity/entity/, sample/sample32-migrations/entity/) which all use
singular 'entity' directory, while the InitCommand now creates 'entities' directory. The
sample32-migrations project also shows migrations: [__dirname + '/migrations/*{.js,.ts}'] using the
'migrations' directory (already plural), demonstrating existing inconsistency in the codebase.

src/commands/InitCommand.ts[88-99]
sample/sample32-migrations/app.ts[3-4]
sample/sample1-simple-entity/app.ts[2]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue Description
The PR standardizes directory naming to use plural forms (entities/, migrations/, subscribers/, controllers/), but existing sample projects still use singular names (entity/, migration/). This creates inconsistency between generated projects and reference examples.

## Issue Context
The InitCommand.ts now generates:
- src/entities/ instead of src/entity/
- src/migrations/ instead of src/migration/
- src/controllers/ instead of src/controller/

But all sample projects still use the old singular naming.

## Fix Focus Areas
Update all sample projects to use plural directory names:
- sample/sample1-simple-entity/entity/ → entities/
- sample/sample32-migrations/entity/ → entities/
- All other sample*/entity/ directories → entities/
- Update all import statements in sample projects to reference the new paths

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. InitCommand Uses Class Import Instead of Glob Pattern 🐞 Bug ✓ Correctness
Description
• The InitCommand generates a data-source.ts file that uses direct class imports (entities: [User])
  instead of glob patterns
• However, the documentation examples show glob patterns like entities: [__dirname +
  '/entities/**/*{.js,.ts}']
• This inconsistency means the generated project structure doesn't match what's documented
• Users will need to manually change from class imports to glob patterns if they want to follow the
  documented approach
Code

src/commands/InitCommand.ts[R246-247]

export const AppDataSource = new DataSource({
    ${dbSettings}
Evidence
The InitCommand template generates a DataSource configuration using direct class imports (entities:
[User]), while the documentation consistently shows glob pattern examples. This creates a mismatch
between what's generated and what's documented as best practice.

src/commands/InitCommand.ts[246-253]
docs/docs/data-source/2-data-source-options.md[107-110]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue Description
The InitCommand generates a DataSource configuration with direct class imports (entities: [User]), but documentation examples consistently show glob patterns (entities: [__dirname + '/entities/**/*{.js,.ts}']).

## Issue Context
The generated data-source.ts file uses:
```typescript
entities: [User],
migrations: [],
subscribers: [],
```

But documentation shows:
```typescript
entities: [__dirname + "/entities/**/*{.js,.ts}"],
migrations: [__dirname + "/migrations/**/*{.js,.ts}"],
subscribers: [__dirname + "/subscribers/**/*{.js,.ts}"],
```

## Fix Focus Areas
Update the template generation logic:
- src/commands/InitCommand.ts[246-253]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 08cc1ff


🐞 Bugs (0) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider
Action required
✅ 1. Import paths reference old entity folder 📘 Rule violation ✓ Correctness
Suggestion Impact:The commit directly implements the suggestion by updating all import statements in template strings from "./entity/User" to "./entities/User" and from "./controller/UserController" to "./controllers/UserController" at the exact lines identified in the suggestion (lines 244, 382, 448, 500 and the controller import).

code diff:

-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"

Description
• The PR changes folder names from singular to plural (e.g., entity → entities, migration →
  migrations) in documentation and file creation paths.
• However, the template code in InitCommand.ts still uses the old singular folder name entity in
  import statements.
• This creates an inconsistency where the actual folder is created as entities/ but the generated
  code imports from ./entity/User, causing runtime errors.
Code

src/commands/InitCommand.ts[88]

+                basePath + "/src/entities/User.ts",
Evidence
The code creates a file at basePath + '/src/entities/User.ts' (line 88) using the plural folder
name, but the template methods still generate import statements referencing the old singular path
./entity/User (lines 244, 382, 448, 500). This violates the Consistent Naming Conventions
compliance rule as the folder naming is inconsistent between the actual file system structure and
the generated code references.

Rule 1: Consistent Naming Conventions
src/commands/InitCommand.ts[88-88]
src/commands/InitCommand.ts[244-244]
src/commands/InitCommand.ts[382-382]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The InitCommand creates files in the `entities/` folder but generates code that imports from the old `entity/` folder path, causing module resolution errors.

## Issue Context
This PR aims to standardize folder naming to use plural forms (entities, migrations, controllers, etc.) for consistency. The file creation paths were updated but the template strings that generate import statements were not.

## Fix Focus Areas
- src/commands/InitCommand.ts[244-244]
- src/commands/InitCommand.ts[382-382]
- src/commands/InitCommand.ts[448-448]
- src/commands/InitCommand.ts[500-500]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Import paths reference old controller folder 📘 Rule violation ✓ Correctness
Description
• The PR creates the UserController file in the plural controllers/ folder.
• However, the routes template still imports from the old singular controller/ path.
• This inconsistency will cause import errors when the express template is used.
Code

src/commands/InitCommand.ts[108]

+                    basePath + "/src/controllers/UserController.ts",
Evidence
The code creates the UserController at basePath + '/src/controllers/UserController.ts' (line 108)
using the plural folder name, but the routes template needs to import from this location. While the
routes template is not shown in the diff, the inconsistency between file creation path and expected
import path violates the Consistent Naming Conventions rule.

Rule 1: Consistent Naming Conventions
src/commands/InitCommand.ts[108-108]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The UserController is created in the `controllers/` folder but the routes template likely imports from the old `controller/` folder path.

## Issue Context
This PR standardizes folder naming to use plural forms. The file creation path for UserController was updated to use `controllers/` but any import statements in the routes template need to be updated accordingly.

## Fix Focus Areas
- src/commands/InitCommand.ts[108-108]
- Review the getRoutesTemplate method to ensure it imports from `./controllers/UserController`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 21, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

✅ 1. Inconsistent folder naming in InitCommand 📘 Rule violation ✓ Correctness
Suggestion Impact:The commit directly implements the suggestion by updating all import paths in the generated code templates from singular folder names to plural folder names. Specifically, it changes "./entity/User" to "./entities/User" and "./controller/UserController" to "./controllers/UserController" across multiple template methods, exactly as identified in the suggestion's fix focus areas (lines 244, 382, 448, 500).

code diff:

-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {

# File: src/commands/InitCommand.ts
@@ -241,7 +241,7 @@
         }
         return `import "reflect-metadata"
 import { DataSource } from "typeorm"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 export const AppDataSource = new DataSource({
     ${dbSettings}
@@ -344,7 +344,7 @@
      * Gets contents of the route file (used when express is enabled).
      */
     protected static getRoutesTemplate(isEsm: boolean): string {
-        return `import { UserController } from "./controller/UserController${
+        return `import { UserController } from "./controllers/UserController${
             isEsm ? ".js" : ""
         }"
 
@@ -379,7 +379,7 @@
             isEsm ? ".js" : ""
         }"
 import { NextFunction, Request, Response } from "express"
-import { User } from "../entity/User${isEsm ? ".js" : ""}"
+import { User } from "../entities/User${isEsm ? ".js" : ""}"
 
 export class UserController {
 
@@ -445,7 +445,7 @@
 import { Request, Response } from "express"
 import { AppDataSource } from "./data-source${isEsm ? ".js" : ""}"
 import { Routes } from "./routes${isEsm ? ".js" : ""}"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"
 
 AppDataSource.initialize().then(async () => {
 
@@ -497,7 +497,7 @@
             return `import { AppDataSource } from "./data-source${
                 isEsm ? ".js" : ""
             }"
-import { User } from "./entity/User${isEsm ? ".js" : ""}"
+import { User } from "./entities/User${isEsm ? ".js" : ""}"

Description
• The PR changes documentation and folder structure to use plural folder names (entities,
  migrations, controllers), but the generated code templates in InitCommand.ts still import from
  singular paths like ./entity/User.
• This creates inconsistency between the actual folder structure created (line 88:
  src/entities/User.ts, line 99: src/migrations, line 108: src/controllers/UserController.ts)
  and the import paths in generated templates (lines 244, 382, 448, 500: ./entity/User).
• Users following the generated code will encounter import errors since the files are created in
  entities/ but imports reference entity/.
Code

src/commands/InitCommand.ts[88]

+                basePath + "/src/entities/User.ts",
Evidence
The compliance checklist requires consistent naming conventions (PR Compliance ID 1). The code
creates files in plural folder names (entities, migrations, controllers) but the generated
templates import from singular paths (entity). This violates the stated objective of ensuring
consistent plural folder naming across the codebase.

Rule 1: Consistent Naming Conventions
src/commands/InitCommand.ts[88-88]
src/commands/InitCommand.ts[244-244]
src/commands/InitCommand.ts[382-382]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The InitCommand creates files in plural-named folders (`entities/`, `migrations/`, `controllers/`) but generates code templates that import from singular-named folders (`entity/`, `migration/`, `controller/`). This causes import errors in generated projects.

## Issue Context
This PR aims to standardize on plural folder names across documentation and code. The folder creation was updated but the import paths in code templates were not.

## Fix Focus Areas
- src/commands/InitCommand.ts[244-244]
- src/commands/InitCommand.ts[382-382]
- src/commands/InitCommand.ts[448-448]
- src/commands/InitCommand.ts[500-500]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit d79c5b2

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit fd9b684

@gioboa
gioboa merged commit 28650d9 into master Jan 21, 2026
44 checks passed
@gioboa
gioboa deleted the docs-plural-folder-names branch January 21, 2026 19:44
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants