Skip to content

ci: use prettier on all types of files it supports - #11842

Merged
pkuczynski merged 9 commits into
masterfrom
ci/prettier-all
Jan 22, 2026
Merged

pkuczynski merged 9 commits into
masterfrom
ci/prettier-all

Conversation

@pkuczynski

@pkuczynski pkuczynski commented Dec 10, 2025 •

Copy link
Copy Markdown
Member

Prettier support many files, and even more with plugins. There is no reason why we should not laverage the full power of it.

How the new setup would affect current code can be seen in #11843 (which should be merged first)

@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

ESLint Fix Removed

The --fix flag was added to eslint in lint-staged, but previously it was run without this flag. This change means ESLint will now automatically fix issues during pre-commit, which could potentially auto-fix code in unintended ways. Verify this is the desired behavior and that it won't cause issues with the existing linting workflow.

"*.ts": ["eslint --fix", "prettier --write"],
"*.{json,md,mjs,toml,yml,yaml}": ["prettier --write"]
Reduced Ignore Patterns

The .prettierignore file removed build/, coverage/, and node_modules/ directories. While these are typically ignored by default in many tools, verify that Prettier won't attempt to format files in these directories, especially node_modules/, which could cause performance issues or unexpected behavior.

extra/
gulpfile.ts
package-lock.json
Typecheck Script Removed

The typecheck script was removed from both root and docs package.json files. If type checking was part of the CI/CD pipeline or development workflow, this removal could lead to type errors going undetected. Verify that type checking is still performed elsewhere in the build process.

"format": "prettier --cache --write .",
"format:ci": "prettier --check .",

@pkg-pr-new

pkg-pr-new Bot commented Dec 10, 2025 •

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

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

commit: 6e9c64a

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

qodo-free-for-open-source-projects Bot commented Dec 10, 2025 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 6e9c64a

CategorySuggestion                                                                                                                                    Impact
General
Remove trailing whitespace from code

Remove trailing whitespace from lines 158 and 169 in
src/driver/cordova/CordovaQueryRunner.ts to improve code consistency.

src/driver/cordova/CordovaQueryRunner.ts [155-178]

 const generatedColumns = this.connection.hasMetadata(tableName) ? this.connection.getMetadata(tableName).generatedColumns : [];
 const sql = columns.length > 0 ? (`INSERT INTO "${tableName}"(${columns}) VALUES (${values})`) : `INSERT INTO "${tableName}" DEFAULT VALUES`;
 const parameters = keys.map(key => keyValues[key]);
-     
+
 return new Promise<InsertResult>(async (ok, fail) => {
     this.driver.connection.logger.logQuery(sql, parameters, this);
     const __this = this;
     this.driver.connection.executeSql(sql, parameters, (resultSet: any) => {
         const generatedMap = generatedColumns.reduce((map, generatedColumn) => {
             const value = resultSet.insertId;
             if (!value) return map;
             return OrmUtils.mergeDeep(map, generatedColumn.createValueMap(value));
         }, {} as ObjectLiteral);
-     
+
         ok({
             result: undefined,
             generatedMap: Object.keys(generatedMap).length > 0 ? generatedMap : undefined
         });
     }, (err: any) => {
         __this.driver.connection.logger.logQueryError(err, sql, parameters, this);
         fail(err);
     });
 });

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 3

__

Why: The suggestion correctly identifies and proposes removing unnecessary whitespace on lines 158 and 169, which improves code style and consistency.

Low
  • More

Previous suggestions

Suggestions up to commit c3a5ab2
CategorySuggestion                                                                                                                                    Impact
General
Ensure consistent line endings

Add endOfLine: "lf" to the .prettierrc.js configuration file to enforce
consistent line endings, matching the project's .editorconfig.

.prettierrc.js [5-13]

 const config = {
     arrowParens: "always",
     semi: false,
     trailingComma: "all",
+    endOfLine: "lf",
 
     plugins: ["prettier-plugin-packagejson", "prettier-plugin-toml"],
 }
 
 module.exports = config
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly proposes adding endOfLine: "lf" to .prettierrc.js to explicitly align with the .editorconfig setting, which enhances configuration robustness and prevents potential cross-platform inconsistencies.

Low
Suggestions up to commit 1f4f2e2
CategorySuggestion                                                                                                                                    Impact
General
Match Prettier indentation with EditorConfig

Add tabWidth: 4 to the Prettier configuration in .prettierrc.js to align with
the indent_size = 4 setting in .editorconfig.

.prettierrc.js [5-13]

 const config = {
     arrowParens: "always",
     semi: false,
     trailingComma: "all",
+    tabWidth: 4,
 
     plugins: ["prettier-plugin-packagejson", "prettier-plugin-toml"],
 }
 
 module.exports = config
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a discrepancy between the .editorconfig setting (indent_size = 4) and Prettier's default (tabWidth: 2), and proposes a fix to ensure consistent code formatting across the project.

Medium
Suggestions up to commit dc0d373
CategorySuggestion                                                                                                                                    Impact
General
Explicitly format package.json files

In .lintstagedrc.json, add an explicit entry for package.json to be formatted by
Prettier, even though it is already covered by an existing glob pattern.

.lintstagedrc.json [1-4]

 {
   "*.ts": ["eslint --fix", "prettier --write"],
+  "package.json": ["prettier --write"],
   "*.{json,md,mjs,toml,yml,yaml}": ["prettier --write"]
 }
Suggestion importance[1-10]: 2

__

Why: The suggestion correctly notes that being explicit is good practice, but the existing glob pattern *.{json,...} already covers package.json, making this change a minor stylistic improvement with no functional impact.

Low
✅ Suggestions up to commit 34e4963
CategorySuggestion                                                                                                                                    Impact
High-level
✅ PR silently removes TypeScript type-checking
Suggestion Impact:The suggestion was directly implemented. The commit re-added the "typecheck": "tsc --noEmit" script to the root package.json file (line 31), restoring the TypeScript type-checking capability that was previously removed.

code diff:

+    "typecheck": "tsc --noEmit",

The PR removes the typecheck scripts from the root and docs package.json files,
which disables TypeScript type-checking. This change should be reverted or
justified as it's a significant regression in quality assurance.

Examples:

package.json [79-95]
  "scripts": {
    "changelog": "standard-changelog",
    "compile": "rimraf ./build && tsc",
    "docs:dev": "cd docs && npm run start",
    "format": "prettier --cache --write .",
    "format:ci": "prettier --check .",
    "lint": "eslint",
    "pack": "gulp pack",
    "package": "gulp package",
    "pre-commit": "lint-staged",

 ... (clipped 7 lines)
docs/package.json [5-15]
  "scripts": {
    "build": "docusaurus build",
    "clear": "docusaurus clear",
    "deploy": "docusaurus deploy",
    "docusaurus": "docusaurus",
    "serve": "docusaurus serve",
    "start": "docusaurus start",
    "swizzle": "docusaurus swizzle",
    "write-heading-ids": "docusaurus write-heading-ids",
    "write-translations": "docusaurus write-translations"

 ... (clipped 1 lines)

Solution Walkthrough:

Before:

// package.json
"scripts": {
  ...
  "test:fast": "mocha",
  "typecheck": "tsc --noEmit",
  "watch": "tsc --watch"
},

// docs/package.json
"scripts": {
  ...
  "swizzle": "docusaurus swizzle",
  "typecheck": "tsc",
  "write-heading-ids": "docusaurus write-heading-ids",
  ...
}

After:

// package.json
"scripts": {
  ...
  "test:fast": "mocha",
  "watch": "tsc --watch"
},

// docs/package.json
"scripts": {
  ...
  "swizzle": "docusaurus swizzle",
  "write-heading-ids": "docusaurus write-heading-ids",
  ...
}
Suggestion importance[1-10]: 10

__

Why: The suggestion correctly identifies the silent removal of TypeScript type-checking scripts, a critical regression in the project's quality assurance process that was not mentioned in the PR description.

High
Possible issue
✅ Ignore build output directory explicitly
Suggestion Impact:The suggestion was implemented. The commit added 'build/' to line 2 of the .prettierignore file, exactly as suggested. The commit also made additional changes (adding coverage/, modifying other entries) but the core suggestion to add 'build/' was directly implemented.

code diff:

+build/

Add build/ back to the .prettierignore file to prevent Prettier from formatting
the contents of the build output directory.

.prettierignore [1-3]

+build/
 extra/
 gulpfile.ts
 package-lock.json
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly points out that removing build/ from .prettierignore is a mistake, as Prettier v3 does not ignore it by default. This change prevents Prettier from formatting build artifacts, which is a critical best practice for performance and to avoid unintended changes in generated code.

Medium
General
Align editor config with Prettier

In .editorconfig, re-introduce a rule to set indent_size = 2 for file types
formatted by Prettier (e.g., JSON, YAML, TS) to align with common conventions
and maintain consistency.

.editorconfig [3-9]

 [*]
 end_of_line = lf
 insert_final_newline = true
 trim_trailing_whitespace = true
 charset = utf-8
 indent_style = space
 indent_size = 4
 
--# Matches the exact files either *.json or *.yml
-[*.{json,yml}]
+[*.{js,ts,json,md,mjs,toml,yml,yaml}]
 indent_style = space
 indent_size = 2
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that removing the 2-space indent rule for JSON/YML files in .editorconfig will cause Prettier to use the global 4-space setting, which is unconventional for these file types and inconsistent with the previous setup. Reinstating a specific rule for Prettier-formatted files improves consistency.

Medium

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

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@coveralls

coveralls commented Dec 10, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 81.091% (+0.1%) from 80.944%
when pulling 6e9c64a on ci/prettier-all
into 28650d9 on master.

Comment thread .lintstagedrc.json Resolved
Comment thread package.json Resolved
Comment thread .prettierrc.js Resolved
Comment thread package.json
"prettier": "^2.8.8",
"prettier": "^3.7.4",
"prettier-plugin-packagejson": "^2.5.20",
"prettier-plugin-toml": "^2.0.6",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an entire package for a single toml file which is actually temporary (let's see how long Qodo will last) and rarely updated?

I would not add it for one file.

Comment thread .editorconfig
@@ -12,7 +8,6 @@ charset = utf-8
indent_style = space
indent_size = 4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are changing this file - there's something I wanted to do for quite some time, but didn't want to it until the we made more progress on 1.0: markdown lists are formatted with a lot of space because we didn't set up indent_size = 2 for *.md files.

For sure we want 4 spaces for *.{c,m,}{js,ts}{x,} (all TS/JS extensions - react too in docs), but for all the others, I think we might want 2 - basically for *.{json,md,yml} (we don't have yaml anymore AFAIK).

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙏 @pkuczynski

@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: 6e9c64a
Status: ✅  Deploy successful!
Preview URL: https://25595acb.typeorm.pages.dev
Branch Preview URL: https://ci-prettier-all.typeorm.pages.dev

View logs

@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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review


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

Grey Divider

Previous review results

Review updated until commit 6e9c64a

Results up to commit 419df24


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

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Results up to commit c2a8131


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

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Qodo Logo

# Conflicts:
#	.github/copilot-instructions.md
#	.gitignore
#	.pr_agent.toml
#	.prettierrc.json
#	DEVELOPER.md
#	docs/docs/data-source/2-data-source-options.md
#	docs/docs/drivers/mysql.md
#	docs/docs/drivers/postgres.md
#	docs/docs/drivers/sap.md
#	docs/docs/migrations/02-setup.md
#	docs/src/css/custom.css
#	package-lock.json
#	package.json
#	src/driver/cockroachdb/CockroachQueryRunner.ts
#	src/driver/mysql/MysqlQueryRunner.ts
@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 419df24

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

Copy link
Copy Markdown

Persistent review updated to latest commit 6e9c64a

@pkuczynski
pkuczynski requested review from alumni and gioboa January 22, 2026 16:57
@pkuczynski
pkuczynski merged commit 5d5522f into master Jan 22, 2026
47 checks passed
@pkuczynski
pkuczynski deleted the ci/prettier-all branch January 22, 2026 18:20
Comment thread .lintstagedrc.json Resolved
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.

5 participants