Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .eslintrc.js.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
root: true,
env: {
node: true,
jest: true
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'prettier/prettier': 0,
'no-console': 'error',
// "@typescript-eslint/consistent-type-imports": "error",
'@typescript-eslint/no-unused-vars': [
'error'
// {
// "argsIgnorePattern": "_"
// }
],
'@typescript-eslint/array-type': 'error',
'template-curly-spacing': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-use-before-define': 'error',
complexity: ['error', 50],
'array-callback-return': 'error',
curly: 'error',
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'error',
camelcase: [2, { properties: 'always' }],
'no-invalid-this': 'error',
'no-return-assign': 'error',
'no-unused-expressions': ['error', { allowTernary: true }],
'no-useless-concat': 'error',
'no-useless-return': 'error',
'guard-for-in': 'error',
'no-case-declarations': 'error',
'no-implicit-coercion': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-param-reassign': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-useless-catch': 'error',
'prefer-promise-reject-errors': 'error',
'vars-on-top': 'error',
yoda: ['error', 'always'],
'arrow-body-style': ['warn', 'as-needed'],
'no-useless-rename': 'error',
'prefer-destructuring': [
'error',
{
array: true,
object: true
},
{
enforceForRenamedProperties: false
}
],
'prefer-numeric-literals': 'error',
'prefer-rest-params': 'warn',
'prefer-spread': 'error',
'array-bracket-newline': ['error', { multiline: true, minItems: null }],
'array-bracket-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'block-spacing': 'error',
'comma-dangle': 'error',
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'func-call-spacing': 'error',
'implicit-arrow-linebreak': ['error', 'beside'],
'keyword-spacing': 'error',
'multiline-ternary': ['error', 'always-multiline'],
'no-mixed-operators': 'error',
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
'no-tabs': 'error',
'no-unneeded-ternary': 'error',
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': ['error', 'below'],
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
semi: ['error', 'always'],
'semi-spacing': 'error',
'space-before-blocks': 'error',
'space-in-parens': 'error',
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'arrow-spacing': 'error',
'no-confusing-arrow': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
quotes: ['warn', 'single', { allowTemplateLiterals: true }]
}
};
62 changes: 62 additions & 0 deletions ESLINT_MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ESLint Migration Guide

## Changes Made

This migration upgrades the project from ESLint v8 with legacy configuration to ESLint v9 with flat configuration format.

### Package Updates

- `@typescript-eslint/eslint-plugin`: `^6.2.1` → `^8.14.0`
- `@typescript-eslint/parser`: `^6.2.1` → `^8.14.0`
- `eslint`: `^8.46.0` → `^9.14.0`
- `@types/node`: `^20.4.6` → `^22.9.0`
- `typescript`: `^5.1.6` → `^5.6.3`
- `prettier`: `^3.0.1` → `^3.3.3`
- `eslint-config-prettier`: `^8.10.0` → `^9.1.0`
- `eslint-plugin-prettier`: `^4.2.1` → `^5.2.1`
- `eslint-plugin-promise`: `^6.1.1` → `^7.1.0`

### New Dependencies

- `@eslint/js`: `^9.14.0` (required for flat config)

### Removed Dependencies

- `eslint-config-standard-with-typescript`: No longer needed with flat config
- `eslint-plugin-import`: Functionality integrated into core ESLint
- `eslint-plugin-n`: Not required for this project setup

### Configuration Changes

- **Old**: `.eslintrc.js` (legacy format)
- **New**: `eslint.config.js` (flat config format)

The new configuration maintains all existing rules while using the modern flat config structure.

### Node.js Version

- Updated minimum Node.js version from `>=18` to `>=20` (current LTS)

## Migration Steps for Developers

1. Install dependencies: `pnpm install`
2. The old `.eslintrc.js` is backed up as `.eslintrc.js.backup`
3. ESLint now uses `eslint.config.js` for configuration
4. All existing lint rules are preserved

## Verification

Run the following commands to verify the migration:

```bash
# Check ESLint configuration
pnpm lint

# Run tests to ensure no breaking changes
pnpm test
```

## References

- [ESLint Migration Guide](https://eslint.org/docs/latest/use/configure/migration-guide)
- [TypeScript ESLint v8 Migration](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8-beta/)
112 changes: 112 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';

export default [
js.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsparser,
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
},
globals: {
node: true,
jest: true,
},
Comment on lines +16 to +19
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Incorrect globals syntax for flat config.

The globals are defined incorrectly. In ESLint flat config, globals should use actual global definitions, not boolean values. This won't properly define Node.js and Jest global variables, potentially causing false positives for undefined variables.

Apply this diff to fix the globals definition:

+import globals from 'globals';
+
 export default [
   js.configs.recommended,
   {
     files: ['**/*.ts', '**/*.tsx'],
     languageOptions: {
       parser: tsparser,
       parserOptions: {
         project: './tsconfig.json',
         sourceType: 'module',
       },
       globals: {
-        node: true,
-        jest: true,
+        ...globals.node,
+        ...globals.jest,
       },
     },

You'll also need to add the globals package to devDependencies:

   "devDependencies": {
     "@eslint/js": "^9.14.0",
+    "globals": "^15.12.0",

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In eslint.config.js around lines 16-19, the globals are incorrectly set to
booleans (node: true, jest: true); replace them with actual global definitions
from the external "globals" package by importing/require-ing it and spreading
the corresponding entries (e.g., ...require('globals').node,
...require('globals').jest) into the globals object, and add "globals" to
devDependencies in package.json.

},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettier,
},
rules: {
'prettier/prettier': 0,
'no-console': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/array-type': 'error',
'template-curly-spacing': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-use-before-define': 'error',
complexity: ['error', 50],
'array-callback-return': 'error',
curly: 'error',
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'error',
camelcase: [2, { properties: 'always' }],
'no-invalid-this': 'error',
'no-return-assign': 'error',
'no-unused-expressions': ['error', { allowTernary: true }],
'no-useless-concat': 'error',
'no-useless-return': 'error',
'guard-for-in': 'error',
'no-case-declarations': 'error',
'no-implicit-coercion': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-param-reassign': 'error',
'no-return-await': 'error',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace deprecated no-return-await rule.

The no-return-await rule was deprecated in ESLint v8.53.0. For TypeScript projects, use @typescript-eslint/return-await instead, which provides better type-aware handling.

Apply this diff:

-      'no-return-await': 'error',
+      '@typescript-eslint/return-await': 'error',
📝 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
'no-return-await': 'error',
'@typescript-eslint/return-await': 'error',
🤖 Prompt for AI Agents
In eslint.config.js around line 53, replace the deprecated ESLint rule
'no-return-await' with the TypeScript-aware rule
'@typescript-eslint/return-await'; remove the 'no-return-await' entry and add
'@typescript-eslint/return-await' set to ['error', 'never'] (or another
preferred option like 'in-try-catch') so the project uses the supported,
type-aware rule.

'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-useless-catch': 'error',
'prefer-promise-reject-errors': 'error',
'vars-on-top': 'error',
yoda: ['error', 'always'],
'arrow-body-style': ['warn', 'as-needed'],
'no-useless-rename': 'error',
'prefer-destructuring': [
'error',
{
array: true,
object: true,
},
{
enforceForRenamedProperties: false,
},
],
'prefer-numeric-literals': 'error',
'prefer-rest-params': 'warn',
'prefer-spread': 'error',
'array-bracket-newline': ['error', { multiline: true, minItems: null }],
'array-bracket-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'block-spacing': 'error',
'comma-dangle': 'error',
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'func-call-spacing': 'error',
'implicit-arrow-linebreak': ['error', 'beside'],
'keyword-spacing': 'error',
'multiline-ternary': ['error', 'always-multiline'],
'no-mixed-operators': 'error',
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
'no-tabs': 'error',
'no-unneeded-ternary': 'error',
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': ['error', 'below'],
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
semi: ['error', 'always'],
'semi-spacing': 'error',
'space-before-blocks': 'error',
'space-in-parens': 'error',
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'arrow-spacing': 'error',
'no-confusing-arrow': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
quotes: ['warn', 'single', { allowTemplateLiterals: true }],
},
},
{
ignores: ['.eslintrc.js', 'dist/**', 'node_modules/**'],
},
];
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,34 @@
"xml-js": "^1.6.11"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@nestjs/cli": "catalog:",
"@nestjs/schematics": "catalog:",
"@nestjs/testing": "catalog:",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.3",
"@types/multer": "^1.4.9",
"@types/node": "^20.4.6",
"@types/node": "^22.9.0",
"@types/passport-jwt": "3.0.9",
"@types/passport-local": "^1.0.35",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-standard-with-typescript": "^37.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"@typescript-eslint/eslint-plugin": "^8.14.0",
"@typescript-eslint/parser": "^8.14.0",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"husky": "^8.0.3",
"jest": "^29.6.2",
"lint-staged": "^13.2.3",
"prettier": "^3.0.1",
"prettier": "^3.3.3",
"prisma": "^5.1.1",
"supertest": "^6.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.6"
"typescript": "^5.6.3"
},
"lint-staged": {
"**/*.{js,ts}": [
Expand Down Expand Up @@ -204,6 +202,6 @@
},
"packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a",
"engines": {
"node": ">=18"
"node": ">=20"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Node.js version requirement increased to v20.

The minimum Node.js version has been bumped from >=18 to >=20. Verify that:

  • CI/CD pipelines are configured for Node.js 20
  • Development environments meet this requirement
  • Deployment environments support Node.js 20

Check the README, CI configuration files, and Dockerfiles to ensure they specify Node.js 20:


🏁 Script executed:

#!/bin/bash
# Search for Node.js version specifications in configuration files

echo "Checking for Node.js version references..."
fd -e yml -e yaml -e json -e md -e dockerfile --exec rg -n "node.*18|18\.x|lts/hydrogen" {}

echo "Checking Docker base images..."
fd -g "*Dockerfile*" --exec rg -n "FROM.*node:" {}

Length of output: 9512


Update all Dockerfiles to Node 20 base image to match package.json requirement.

The root package.json now requires Node >=20, but all Dockerfiles still use node:18-alpine base images. This creates a breaking mismatch—Docker containers will fail to satisfy the engine requirement.

Update all 18+ Dockerfiles in ./Dockerfiles/ and root directory from FROM node:18-alpine to FROM node:20-alpine.

🤖 Prompt for AI Agents
In package.json around line 205 the engines field requires "node": ">=20";
update all Dockerfiles that still use Node 18 to match this requirement: in
every Dockerfile in the project root and in ./Dockerfiles/ replace the base
image line (e.g. FROM node:18-alpine or any node:18.* tag) with FROM
node:20-alpine, and rebuild any multi-stage FROM entries or CI scripts that
reference node:18 to node:20 to ensure containers satisfy the package.json
engine constraint.

}
}