-
Notifications
You must be signed in to change notification settings - Fork 0
chore(BE)(lint): fix linter errors in server 1 #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses linter errors and warnings in the backend server by upgrading ESLint configuration, updating type annotations, improving error handling, and implementing TypeScript best practices.
Key changes include:
- Upgrade from legacy ESLint to modern ESLint 9 with TypeScript ESLint configuration
- Replace
anytypes with proper TypeScript types and add comprehensive type safety - Remove unnecessary try-catch blocks and improve async/await handling
Reviewed Changes
Copilot reviewed 29 out of 31 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/utils/database.ts | Adds proper typing for MongoDB utilities and transforms |
| server/src/services/*.ts | Improves type safety, error handling, and async operations |
| server/src/repositories/TraineesRepository.ts | Adds type safety with helper methods and proper error handling |
| server/src/controllers/*.ts | Removes unnecessary error handling and improves async patterns |
| server/src/models/*.ts | Updates utility functions with better TypeScript patterns |
| server/eslint.config.js | Upgrades to modern ESLint configuration |
| client/package.json & eslint.config.js | Updates client ESLint to modern configuration |
| .github/workflows/quality-checks.yml | Adds CI workflow for linting both server and client |
Files not reviewed (1)
- server/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
client/eslint.config.js:6
- The import
{ globalIgnores } from 'eslint/config'does not exist in ESLint. This should likely be removed asglobalIgnoresis being used as a function on line 9, but this import path is invalid.
import { globalIgnores } from 'eslint/config';
server/src/repositories/TraineesRepository.ts:92
- [nitpick] The parameter name
_idsuggests it's intentionally unused, but the original parameter nameidwas more descriptive. Since this is a stub method that throws 'Not implemented', consider keeping the original parameter nameidfor clarity.
deleteTrainee(_id: string): Promise<void> {
8334b6a to
553af96
Compare
553af96 to
0a6387c
Compare
| export default tseslint.config( | ||
| { | ||
| ignores: ['dist', 'node_modules', 'scripts', 'eslint.config.js'], | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the scripts need to be linted too, ts config will change to include them in the project but exclude them from the build
128ad54 to
7603ee1
Compare
7603ee1 to
d525dbf
Compare
d525dbf to
8d84927
Compare
8d84927 to
201101b
Compare
Due to the rejected promises being auto-handled by express in the current version, and due to some linter errors, instead of just satisfying the linter, the whole
try catchwrappers are removed where not necessary.The fixes related to validation will be part of a following PR.
To see the exact errors and warnings that are solved here please refer to: previous linter result