chore: update code style configuration with Prettier and ESLint integration#49
chore: update code style configuration with Prettier and ESLint integration#49
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Prettier code formatting tooling and integrates it with ESLint to establish consistent code style across the frontend and documentation packages. It also removes invalid comment syntax from JSON files (package.json and package-lock.json), which don't support comments according to the JSON specification.
Key changes:
- Adds Prettier v3.7.4 and eslint-config-prettier v10.1.8 as dev dependencies to frontend and docs
- Creates .prettierrc configuration files with formatting rules (semicolons disabled, single quotes, tab width 2, etc.)
- Adds
formatnpm scripts for running Prettier - Integrates eslint-config-prettier into ESLint configuration to prevent rule conflicts
- Removes copyright comment headers from JSON files
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/package.json | Adds Prettier and eslint-config-prettier dependencies; adds format script; removes invalid JSON comments |
| src/frontend/package-lock.json | Updates lockfile with new Prettier and eslint-config-prettier packages; removes invalid JSON comments |
| src/frontend/eslint.config.js | Imports and applies eslint-config-prettier to disable conflicting ESLint rules |
| src/frontend/.prettierrc | Creates Prettier configuration with code style rules (no semicolons, single quotes, 100 char line width) |
| docs/package.json | Adds Prettier dependency and format script; removes invalid JSON comments |
| docs/package-lock.json | Updates lockfile with Prettier package; removes invalid JSON comments |
| docs/.prettierrc | Creates Prettier configuration with additional markdown-specific overrides for prose wrapping |
Files not reviewed (2)
- docs/package-lock.json: Language not supported
- src/frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "write-heading-ids": "docusaurus write-heading-ids", | ||
| "typecheck": "tsc" | ||
| "typecheck": "tsc", | ||
| "format": "prettier --write ." |
There was a problem hiding this comment.
The format script runs prettier --write . without a .prettierignore file, which will attempt to format all files including package-lock.json, build artifacts, and other generated files that shouldn't be formatted.
Consider adding a .prettierignore file with common exclusions:
node_modules
dist
build
.docusaurus
package-lock.json
*.min.js
*.min.css
coverage
| @@ -0,0 +1,9 @@ | |||
| { | |||
| "semi": false, | |||
| "singleQuote": true, | |||
There was a problem hiding this comment.
The Prettier configuration sets "singleQuote": true, but the existing codebase uses double quotes consistently for strings and imports (e.g., import { StrictMode } from "react";). When Prettier runs, it will reformat all files to use single quotes, causing widespread changes across the codebase.
Consider changing this to "singleQuote": false to match the existing code style, or run Prettier on the entire codebase in this PR to complete the style migration.
| "singleQuote": true, | |
| "singleQuote": false, |
| @@ -0,0 +1,17 @@ | |||
| { | |||
| "semi": false, | |||
| "singleQuote": true, | |||
There was a problem hiding this comment.
The Prettier configuration sets "singleQuote": true, but the existing codebase uses double quotes consistently. When Prettier runs, it will reformat documentation and code files to use single quotes.
Consider changing this to "singleQuote": false to match the existing code style, or run Prettier on the entire codebase in this PR to complete the style migration.
| "singleQuote": true, | |
| "singleQuote": false, |
| @@ -0,0 +1,9 @@ | |||
| { | |||
| "semi": false, | |||
There was a problem hiding this comment.
The Prettier configuration sets "semi": false, but the existing codebase uses semicolons consistently at the end of statements. When Prettier runs, it will remove all semicolons from files, causing widespread changes.
Consider changing this to "semi": true to match the existing code style, or run Prettier on the entire codebase in this PR to complete the style migration.
| "semi": false, | |
| "semi": true, |
| @@ -0,0 +1,17 @@ | |||
| { | |||
| "semi": false, | |||
There was a problem hiding this comment.
The Prettier configuration sets "semi": false, but the existing codebase uses semicolons consistently. When Prettier runs, it will remove semicolons from files.
Consider changing this to "semi": true to match the existing code style, or run Prettier on the entire codebase in this PR to complete the style migration.
| "semi": false, | |
| "semi": true, |
| "lint": "eslint .", | ||
| "preview": "vite preview" | ||
| "preview": "vite preview", | ||
| "format": "prettier --write ." |
There was a problem hiding this comment.
The format script runs prettier --write . without a .prettierignore file, which will attempt to format all files including package-lock.json, build artifacts, and other generated files that shouldn't be formatted.
Consider adding a .prettierignore file with common exclusions:
node_modules
dist
build
.docusaurus
package-lock.json
*.min.js
*.min.css
coverage
Proposed changes
Update code style configuration
Types of changes
🐛 Bug fix (non-breaking change which fixes an issue)
✨ Feature (non-breaking change which adds functionality)
💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
📝 Docs (documentation only changes)
♻️ Refactor (code improvement without changing functionality)
Checklist
Docker build successful (src/backend)
All tests passing (pytest)
Code follows project standards (Black, Ruff, MyPy)
Service boundaries maintained
.env.example updated (if environment variables changed)
No debug print statements left