-
Notifications
You must be signed in to change notification settings - Fork 68
feature: upgrade typescript-eslint and node packages to latest versions #1504
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 }] | ||
| } | ||
| }; |
| 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/) |
| 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, | ||||||
| }, | ||||||
| }, | ||||||
| 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', | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace deprecated The Apply this diff: - 'no-return-await': 'error',
+ '@typescript-eslint/return-await': 'error',📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| '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/**'], | ||||||
| }, | ||||||
| ]; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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}": [ | ||
|
|
@@ -204,6 +202,6 @@ | |
| }, | ||
| "packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a", | ||
| "engines": { | ||
| "node": ">=18" | ||
| "node": ">=20" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainNode.js version requirement increased to v20. The minimum Node.js version has been bumped from >=18 to >=20. Verify that:
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 Update all 18+ Dockerfiles in 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
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.
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:
You'll also need to add the
globalspackage to devDependencies:"devDependencies": { "@eslint/js": "^9.14.0", + "globals": "^15.12.0",🤖 Prompt for AI Agents