Skip to content

chore: add format script for codebase styling consistency#723

Merged
Karanjot786 merged 13 commits into
Karanjot786:mainfrom
Rish-2006:main
Jun 5, 2026
Merged

chore: add format script for codebase styling consistency#723
Karanjot786 merged 13 commits into
Karanjot786:mainfrom
Rish-2006:main

Conversation

@Rish-2006
Copy link
Copy Markdown
Contributor

@Rish-2006 Rish-2006 commented Jun 4, 2026

Closes #721

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced development tooling with a new code formatting utility to improve code consistency.

@Rish-2006 Rish-2006 requested a review from Karanjot786 as a code owner June 4, 2026 17:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

A new format npm script is added to package.json that runs Prettier with write mode across the repository, allowing developers to automatically format all source files to maintain consistent code style.

Changes

Format Script Configuration

Layer / File(s) Summary
Format script definition
package.json
The scripts object in package.json is updated to include a new format entry that invokes Prettier with the --write flag on all files in the repository.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A script so fine, with Prettier's might,
We hop through the code, making formatting bright!
No more messy spacing, no more trailing woes,
One command to format from head to our toes! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It only includes a link to the related issue but lacks required sections like summary, affected packages, type of change, and checklist items. Expand the description to include all required template sections: a brief summary of changes, package(s) affected, type of change selection, and completion of the contributor checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and accurately summarizes the main change: adding a format script to package.json for code styling consistency.
Linked Issues check ✅ Passed The PR successfully implements the requirement from #721 by adding a format script to package.json that runs Prettier, enabling contributors to easily standardize code formatting.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective: only the package.json scripts section was modified to add the format script, with no unrelated alterations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the type:devops +15 pts. CI, build, or release. label Jun 4, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 18: The package.json script "format": "prettier --write \".\"" uses the
Prettier CLI but Prettier is not declared in the root devDependencies; add
"prettier" (with a specific version, e.g. "^x.y.z") to the root package.json
devDependencies so the format script is reproducible in fresh installs/CI and
update package-lock/yarn.lock by running an install; reference the "format"
script and ensure the dependency is added to devDependencies in package.json.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d5d41b2-49f6-4094-9cba-d75f6ca19221

📥 Commits

Reviewing files that changed from the base of the PR and between f90f75c and 353813e.

📒 Files selected for processing (1)
  • package.json

Comment thread package.json
"bench": "bun packages/core/src/benchmark/render-loop.ts",
"clean": "turbo run clean && rm -rf node_modules"
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \".\""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that the root package.json has a format script and whether prettier is declared.
python - <<'PY'
import json, pathlib
p = pathlib.Path("package.json")
data = json.loads(p.read_text())
scripts = data.get("scripts", {})
dev = data.get("devDependencies", {})
print("format script:", scripts.get("format"))
print("prettier in devDependencies:", "prettier" in dev)
if "prettier" in dev:
    print("prettier version:", dev["prettier"])
PY

Repository: Karanjot786/TermUI

Length of output: 133


Declare prettier in root devDependencies so format is reproducible

"format": "prettier --write \".\"" invokes the prettier CLI, but prettier is not declared in this repo’s root devDependencies, so it can fail on clean installs/CI.

   "devDependencies": {
     "`@types/bun`": "latest",
     "`@types/node`": "^25.2.3",
+    "prettier": "^3.3.3",
     "tsup": "^8.3.0",
     "turbo": "^2.9.12",
     "typescript": "^5.7.0",
     "vitest": "^2.1.0"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"format": "prettier --write \".\""
"devDependencies": {
"`@types/bun`": "latest",
"`@types/node`": "^25.2.3",
"prettier": "^3.3.3",
"tsup": "^8.3.0",
"turbo": "^2.9.12",
"typescript": "^5.7.0",
"vitest": "^2.1.0"
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 18, The package.json script "format": "prettier --write
\".\"" uses the Prettier CLI but Prettier is not declared in the root
devDependencies; add "prettier" (with a specific version, e.g. "^x.y.z") to the
root package.json devDependencies so the format script is reproducible in fresh
installs/CI and update package-lock/yarn.lock by running an install; reference
the "format" script and ensure the dependency is added to devDependencies in
package.json.

@Karanjot786 Karanjot786 added gssoc:approved Approved PR. Earns +50 base points. quality:clean x 1.2 multiplier. Clean implementation. level:beginner +20 pts. Entry-level task. labels Jun 5, 2026
@Karanjot786
Copy link
Copy Markdown
Owner

Review: prettier missing from devDependencies

The format script uses prettier but it is not declared. CI installs will not have it.

Add to root package.json devDependencies:

"prettier": "^3.3.0"

Pin a specific version so the format output stays reproducible across machines.

@Karanjot786 Karanjot786 merged commit cecfd0a into Karanjot786:main Jun 5, 2026
6 checks passed
@Karanjot786
Copy link
Copy Markdown
Owner

Thank you so much for your contribution, @Rish-2006!

Your PR #723 added a format script to the root package. Running bun run format now applies Prettier across the whole codebase in one step.

Keep contributing. We appreciate your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved PR. Earns +50 base points. level:beginner +20 pts. Entry-level task. quality:clean x 1.2 multiplier. Clean implementation. type:devops +15 pts. CI, build, or release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: add format script for codebase styling consistency

2 participants