From 63fd59ec8b4afe42e34197c0e9e9d2774a6acfe2 Mon Sep 17 00:00:00 2001 From: fisherdaddy Date: Mon, 23 Feb 2026 16:14:18 +0800 Subject: [PATCH] chore: upgrade typescript-eslint to v8 and add eslint config --- .eslintrc.cjs | 46 ++++++++++++++++++++++++++++++++++ package.json | 4 +-- src/main/im/telegramGateway.ts | 2 -- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .eslintrc.cjs diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..68d3b38 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,46 @@ +module.exports = { + root: true, + env: { + browser: true, + es2022: true, + node: true, + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + plugins: [ + '@typescript-eslint', + 'react-refresh', + ], + ignorePatterns: [ + 'dist/', + 'dist-electron/', + 'node_modules/', + 'release/', + 'build/', + 'SKILLs/**', + 'sandbox/**', + ], + rules: { + 'react-refresh/only-export-components': 'off', + 'react-hooks/exhaustive-deps': 'off', + 'no-control-regex': 'off', + 'no-useless-escape': 'off', + 'no-constant-condition': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-unused-vars': 'off', + }, +}; diff --git a/package.json b/package.json index 55fae3d..d064dcc 100644 --- a/package.json +++ b/package.json @@ -78,8 +78,8 @@ "@types/react-dom": "^18.2.0", "@types/react-syntax-highlighter": "^15.5.13", "@types/sql.js": "^1.4.9", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^8.56.0", + "@typescript-eslint/parser": "^8.56.0", "@vitejs/plugin-react": "^4.2.1", "7zip-bin": "^5.2.0", "autoprefixer": "^10.4.17", diff --git a/src/main/im/telegramGateway.ts b/src/main/im/telegramGateway.ts index 55727ca..55b379e 100644 --- a/src/main/im/telegramGateway.ts +++ b/src/main/im/telegramGateway.ts @@ -20,7 +20,6 @@ import { extractMediaFromMessage, cleanupOldMediaFiles } from './telegramMedia'; import { parseMediaMarkers } from './dingtalkMediaParser'; // Import node-fetch for HTTP requests (grammy's default) -// eslint-disable-next-line @typescript-eslint/no-var-requires const nodeFetch = require('node-fetch'); /** @@ -150,7 +149,6 @@ export class TelegramGateway extends EventEmitter { this.bot = new Bot(config.botToken, { client: { // Use our custom fetch wrapper - // eslint-disable-next-line @typescript-eslint/no-explicit-any fetch: grammyFetch as any, // Increase API timeout to 60 seconds for file uploads (default is 500s which is too long) timeoutSeconds: 60,