From 79bdabbaaae1b85122c08bbeb9c73fb4add8effa Mon Sep 17 00:00:00 2001 From: Snobbish Bee <125891987+snobbee@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:43:30 +0100 Subject: [PATCH] test: fix linter errors and add linter to pre-commit hook --- .husky/pre-commit | 1 + eslint.global.mjs | 71 ++++++++++ packages/adapter-postgres/eslint.config.mjs | 72 +--------- packages/adapter-sqlite/eslint.config.mjs | 72 +--------- packages/adapter-sqljs/eslint.config.mjs | 72 +--------- packages/adapter-sqljs/src/types.ts | 2 +- packages/adapter-supabase/eslint.config.mjs | 72 +--------- packages/client-auto/eslint.config.mjs | 72 +--------- packages/client-auto/src/index.ts | 4 +- packages/client-direct/eslint.config.mjs | 72 +--------- packages/client-direct/src/index.ts | 7 +- packages/client-discord/eslint.config.mjs | 72 +--------- .../src/actions/chat_with_attachments.ts | 6 +- .../src/actions/download_media.ts | 7 +- .../client-discord/src/actions/joinvoice.ts | 3 +- .../client-discord/src/actions/leavevoice.ts | 2 +- .../src/actions/summarize_conversation.ts | 2 +- .../src/actions/transcribe_media.ts | 6 +- packages/client-discord/src/attachments.ts | 1 - packages/client-discord/src/index.ts | 2 +- packages/client-discord/src/voice.ts | 2 +- packages/client-github/eslint.config.mjs | 72 +--------- packages/client-github/src/index.ts | 2 +- packages/client-telegram/eslint.config.mjs | 72 +--------- packages/client-telegram/src/index.ts | 2 +- packages/client-twitter/eslint.config.mjs | 72 +--------- packages/client-twitter/src/index.ts | 2 +- packages/client-twitter/src/utils.ts | 1 + packages/core/eslint.config.mjs | 72 +--------- packages/core/src/embedding.ts | 6 +- packages/core/src/tests/token.test.ts | 134 +++++++++--------- packages/create-eliza-app/eslint.config.mjs | 72 +--------- packages/plugin-bootstrap/eslint.config.mjs | 72 +--------- .../plugin-bootstrap/src/actions/ignore.ts | 4 +- packages/plugin-bootstrap/src/actions/none.ts | 4 +- .../plugin-bootstrap/src/evaluators/fact.ts | 1 - .../plugin-bootstrap/src/providers/boredom.ts | 2 - .../plugin-bootstrap/src/providers/facts.ts | 2 +- .../plugin-image-generation/eslint.config.mjs | 72 +--------- packages/plugin-image-generation/src/index.ts | 6 +- packages/plugin-node/eslint.config.mjs | 72 +--------- packages/plugin-node/src/services/browser.ts | 4 +- packages/plugin-node/src/services/image.ts | 2 +- packages/plugin-node/src/services/llama.ts | 2 +- packages/plugin-node/src/services/pdf.ts | 2 +- packages/plugin-node/src/services/speech.ts | 4 +- .../plugin-node/src/services/transcription.ts | 5 +- packages/plugin-node/src/services/video.ts | 4 +- packages/plugin-solana/eslint.config.mjs | 72 +--------- packages/plugin-solana/src/actions/pumpfun.ts | 22 ++- packages/plugin-solana/src/actions/swap.ts | 2 + .../plugin-solana/src/actions/takeOrder.ts | 5 +- packages/plugin-solana/src/providers/token.ts | 4 +- .../src/providers/trustScoreProvider.ts | 4 +- .../plugin-solana/src/providers/wallet.ts | 2 +- packages/plugin-starknet/eslint.config.mjs | 72 +--------- packages/plugin-starknet/src/actions/swap.ts | 4 +- .../plugin-starknet/src/actions/takeOrder.ts | 2 +- .../plugin-starknet/src/actions/transfer.ts | 8 +- .../plugin-starknet/src/actions/unruggable.ts | 11 +- .../plugin-starknet/src/providers/token.ts | 3 +- .../src/providers/trustScoreProvider.ts | 7 +- .../src/providers/walletProvider.ts | 9 +- .../plugin-starknet/src/utils/ERC20Token.ts | 2 +- packages/plugin-trustdb/eslint.config.mjs | 72 +--------- .../plugin-video-generation/eslint.config.mjs | 72 +--------- packages/plugin-video-generation/src/index.ts | 6 +- scripts/lint.sh | 1 + 68 files changed, 269 insertions(+), 1496 deletions(-) create mode 100644 eslint.global.mjs diff --git a/.husky/pre-commit b/.husky/pre-commit index 3f926d34051..afb45bee423 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ pnpm run prettier-check +pnpm run lint \ No newline at end of file diff --git a/eslint.global.mjs b/eslint.global.mjs new file mode 100644 index 00000000000..282796e2b51 --- /dev/null +++ b/eslint.global.mjs @@ -0,0 +1,71 @@ +import eslint from "@eslint/js"; +import tseslint from "@typescript-eslint/eslint-plugin"; +import typescript from "@typescript-eslint/parser"; +import prettier from "eslint-config-prettier"; +import vitest from "eslint-plugin-vitest"; // Add Vitest plugin + +export default [ + // JavaScript and TypeScript files + { + files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], + languageOptions: { + parser: typescript, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + project: "./tsconfig.json", // Make sure your tsconfig includes @types/node + }, + globals: { + // Add Node.js globals + NodeJS: "readonly", + console: "readonly", + process: "readonly", + Buffer: "readonly", + __dirname: "readonly", + __filename: "readonly", + module: "readonly", + require: "readonly", + }, + }, + plugins: { + "@typescript-eslint": tseslint, + }, + rules: { + ...eslint.configs.recommended.rules, + ...tseslint.configs.recommended.rules, + "prefer-const": "warn", + "no-constant-binary-expression": "error", + + // Disable no-undef as TypeScript handles this better + "no-undef": "off", + "@typescript-eslint/no-unsafe-function-type": "off", + // Customize TypeScript rules + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + ignoreRestSiblings: true, + }, + ], + }, + }, + // Vitest configuration + { + files: [ + "src/**/*.test.js", + "src/**/*.test.ts", + "src/**/*.spec.js", + "src/**/*.spec.ts", + ], + plugins: { + vitest, // Register Vitest plugin + }, + rules: { + ...vitest.configs.recommended.rules, + }, + }, + // Add prettier as the last config to override other formatting rules + prettier, +]; diff --git a/packages/adapter-postgres/eslint.config.mjs b/packages/adapter-postgres/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/adapter-postgres/eslint.config.mjs +++ b/packages/adapter-postgres/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/adapter-sqlite/eslint.config.mjs b/packages/adapter-sqlite/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/adapter-sqlite/eslint.config.mjs +++ b/packages/adapter-sqlite/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/adapter-sqljs/eslint.config.mjs b/packages/adapter-sqljs/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/adapter-sqljs/eslint.config.mjs +++ b/packages/adapter-sqljs/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/adapter-sqljs/src/types.ts b/packages/adapter-sqljs/src/types.ts index 675523f4917..42dfdf9847b 100644 --- a/packages/adapter-sqljs/src/types.ts +++ b/packages/adapter-sqljs/src/types.ts @@ -134,7 +134,7 @@ export declare class Database { callback: ParamsCallback, done: () => void ): Database; - each(sql: string, callback: ParamsCallback, done: () => void): Database; + each(sql: string, callback: ParamsCallback, done: () => void): Database; // eslint-disable-line /** * Execute an SQL query, and returns the result. diff --git a/packages/adapter-supabase/eslint.config.mjs b/packages/adapter-supabase/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/adapter-supabase/eslint.config.mjs +++ b/packages/adapter-supabase/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-auto/eslint.config.mjs b/packages/client-auto/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-auto/eslint.config.mjs +++ b/packages/client-auto/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-auto/src/index.ts b/packages/client-auto/src/index.ts index fd1a4c0b76c..887c550b192 100644 --- a/packages/client-auto/src/index.ts +++ b/packages/client-auto/src/index.ts @@ -52,7 +52,7 @@ export class AutoClient { ); // get information for all tokens which were recommended - const tokenInfos = highTrustRecommendations.map( + const _tokenInfos = highTrustRecommendations.map( async (highTrustRecommendation) => { const tokenProvider = new TokenProvider( highTrustRecommendation.tokenAddress, @@ -87,7 +87,7 @@ export const AutoClientInterface: Client = { const client = new AutoClient(runtime); return client; }, - stop: async (runtime: IAgentRuntime) => { + stop: async (_runtime: IAgentRuntime) => { console.warn("Direct client does not support stopping yet"); }, }; diff --git a/packages/client-direct/eslint.config.mjs b/packages/client-direct/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-direct/eslint.config.mjs +++ b/packages/client-direct/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-direct/src/index.ts b/packages/client-direct/src/index.ts index 123600bf555..7ddc5fa233f 100644 --- a/packages/client-direct/src/index.ts +++ b/packages/client-direct/src/index.ts @@ -11,7 +11,6 @@ import { Content, Memory, ModelClass, - State, Client, IAgentRuntime, } from "@ai16z/eliza"; @@ -222,7 +221,7 @@ export class DirectClient { await runtime.evaluate(memory, state); - const result = await runtime.processActions( + const _result = await runtime.processActions( memory, [responseMessage], state, @@ -285,14 +284,14 @@ export class DirectClient { } export const DirectClientInterface: Client = { - start: async (runtime: IAgentRuntime) => { + start: async (_runtime: IAgentRuntime) => { elizaLogger.log("DirectClientInterface start"); const client = new DirectClient(); const serverPort = parseInt(settings.SERVER_PORT || "3000"); client.start(serverPort); return client; }, - stop: async (runtime: IAgentRuntime) => { + stop: async (_runtime: IAgentRuntime) => { elizaLogger.warn("Direct client does not support stopping yet"); }, }; diff --git a/packages/client-discord/eslint.config.mjs b/packages/client-discord/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-discord/eslint.config.mjs +++ b/packages/client-discord/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-discord/src/actions/chat_with_attachments.ts b/packages/client-discord/src/actions/chat_with_attachments.ts index 5a7480d1b32..c55aca1a935 100644 --- a/packages/client-discord/src/actions/chat_with_attachments.ts +++ b/packages/client-discord/src/actions/chat_with_attachments.ts @@ -91,7 +91,11 @@ const summarizeAction = { ], description: "Answer a user request informed by specific attachments based on their IDs. If a user asks to chat with a PDF, or wants more specific information about a link or video or anything else they've attached, this is the action to use.", - validate: async (runtime: IAgentRuntime, message: Memory, state: State) => { + validate: async ( + _runtime: IAgentRuntime, + message: Memory, + _state: State + ) => { if (message.content.source !== "discord") { return false; } diff --git a/packages/client-discord/src/actions/download_media.ts b/packages/client-discord/src/actions/download_media.ts index 8c68ea44676..28f0b2e9311 100644 --- a/packages/client-discord/src/actions/download_media.ts +++ b/packages/client-discord/src/actions/download_media.ts @@ -10,7 +10,6 @@ import { IVideoService, Memory, ModelClass, - Service, ServiceType, State, } from "@ai16z/eliza"; @@ -73,7 +72,11 @@ export default { ], description: "Downloads a video or audio file from a URL and attaches it to the response message.", - validate: async (runtime: IAgentRuntime, message: Memory, state: State) => { + validate: async ( + runtime: IAgentRuntime, + message: Memory, + _state: State + ) => { if (message.content.source !== "discord") { return false; } diff --git a/packages/client-discord/src/actions/joinvoice.ts b/packages/client-discord/src/actions/joinvoice.ts index 32453a158cb..d312d58deda 100644 --- a/packages/client-discord/src/actions/joinvoice.ts +++ b/packages/client-discord/src/actions/joinvoice.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line // @ts-nocheck // src/actions/joinVoice import { @@ -167,7 +168,7 @@ You should only respond with the name of the voice channel or none, no commentar state: guessState as unknown as State, }); - const datestr = new Date().toUTCString().replace(/:/g, "-"); + const _datestr = new Date().toUTCString().replace(/:/g, "-"); const responseContent = await generateText({ runtime, diff --git a/packages/client-discord/src/actions/leavevoice.ts b/packages/client-discord/src/actions/leavevoice.ts index 54a1f7a46da..d15a941e24d 100644 --- a/packages/client-discord/src/actions/leavevoice.ts +++ b/packages/client-discord/src/actions/leavevoice.ts @@ -90,7 +90,7 @@ export default { (channel: Channel) => channel.type === ChannelType.GuildVoice ); - voiceChannels?.forEach((channel: Channel) => { + voiceChannels?.forEach((_channel: Channel) => { const connection = getVoiceConnection( (discordMessage as DiscordMessage).guild?.id as string ); diff --git a/packages/client-discord/src/actions/summarize_conversation.ts b/packages/client-discord/src/actions/summarize_conversation.ts index 86d3921dc55..ea7f35d683c 100644 --- a/packages/client-discord/src/actions/summarize_conversation.ts +++ b/packages/client-discord/src/actions/summarize_conversation.ts @@ -253,7 +253,7 @@ const summarizeAction = { const chunks = await splitChunks(formattedMemories, chunkSize, 0); - const datestr = new Date().toUTCString().replace(/:/g, "-"); + const _datestr = new Date().toUTCString().replace(/:/g, "-"); state.memoriesWithAttachments = formattedMemories; state.objective = objective; diff --git a/packages/client-discord/src/actions/transcribe_media.ts b/packages/client-discord/src/actions/transcribe_media.ts index 52e2efedd5f..ab0a70cc705 100644 --- a/packages/client-discord/src/actions/transcribe_media.ts +++ b/packages/client-discord/src/actions/transcribe_media.ts @@ -73,7 +73,11 @@ const transcribeMediaAction = { ], description: "Transcribe the full text of an audio or video file that the user has attached.", - validate: async (runtime: IAgentRuntime, message: Memory, state: State) => { + validate: async ( + _runtime: IAgentRuntime, + message: Memory, + _state: State + ) => { if (message.content.source !== "discord") { return false; } diff --git a/packages/client-discord/src/attachments.ts b/packages/client-discord/src/attachments.ts index 7746beda4e3..fe675e29bf7 100644 --- a/packages/client-discord/src/attachments.ts +++ b/packages/client-discord/src/attachments.ts @@ -8,7 +8,6 @@ import { IVideoService, Media, ModelClass, - Service, ServiceType, } from "@ai16z/eliza"; import { Attachment, Collection } from "discord.js"; diff --git a/packages/client-discord/src/index.ts b/packages/client-discord/src/index.ts index 061f8e55ce7..a23b6cedaed 100644 --- a/packages/client-discord/src/index.ts +++ b/packages/client-discord/src/index.ts @@ -303,7 +303,7 @@ export const DiscordClientInterface: ElizaClient = { return new DiscordClient(runtime); }, - stop: async (runtime: IAgentRuntime) => { + stop: async (_runtime: IAgentRuntime) => { console.warn("Discord client does not support stopping yet"); }, }; diff --git a/packages/client-discord/src/voice.ts b/packages/client-discord/src/voice.ts index 61d8224ae0a..623f39de4c4 100644 --- a/packages/client-discord/src/voice.ts +++ b/packages/client-discord/src/voice.ts @@ -385,7 +385,7 @@ export class VoiceManager extends EventEmitter { let transcriptionStarted = false; let transcriptionText = ""; - const monitor = new AudioMonitor( + const _monitor = new AudioMonitor( audioStream, 10000000, async (buffer) => { diff --git a/packages/client-github/eslint.config.mjs b/packages/client-github/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-github/eslint.config.mjs +++ b/packages/client-github/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-github/src/index.ts b/packages/client-github/src/index.ts index ac03a9df362..71d9238943d 100644 --- a/packages/client-github/src/index.ts +++ b/packages/client-github/src/index.ts @@ -191,7 +191,7 @@ export const GitHubClientInterface: Client = { return client; }, - stop: async (runtime: IAgentRuntime) => { + stop: async (_runtime: IAgentRuntime) => { elizaLogger.log("GitHubClientInterface stop"); }, }; diff --git a/packages/client-telegram/eslint.config.mjs b/packages/client-telegram/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-telegram/eslint.config.mjs +++ b/packages/client-telegram/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-telegram/src/index.ts b/packages/client-telegram/src/index.ts index 41008057e68..3e3be51e0c5 100644 --- a/packages/client-telegram/src/index.ts +++ b/packages/client-telegram/src/index.ts @@ -19,7 +19,7 @@ export const TelegramClientInterface: Client = { ); return tg; }, - stop: async (runtime: IAgentRuntime) => { + stop: async (_runtime: IAgentRuntime) => { console.warn("Telegram client does not support stopping yet"); }, }; diff --git a/packages/client-twitter/eslint.config.mjs b/packages/client-twitter/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/client-twitter/eslint.config.mjs +++ b/packages/client-twitter/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/client-twitter/src/index.ts b/packages/client-twitter/src/index.ts index 2ac9056e3ab..dad65d4d326 100644 --- a/packages/client-twitter/src/index.ts +++ b/packages/client-twitter/src/index.ts @@ -37,7 +37,7 @@ export const TwitterClientInterface: Client = { return manager; }, - async stop(runtime: IAgentRuntime) { + async stop(_runtime: IAgentRuntime) { elizaLogger.warn("Twitter client does not support stopping yet"); }, }; diff --git a/packages/client-twitter/src/utils.ts b/packages/client-twitter/src/utils.ts index 6ef63c30873..fe003d12951 100644 --- a/packages/client-twitter/src/utils.ts +++ b/packages/client-twitter/src/utils.ts @@ -270,6 +270,7 @@ function splitTweetContent(content: string): string[] { } function splitParagraph(paragraph: string, maxLength: number): string[] { + // eslint-disable-next-line const sentences = paragraph.match(/[^\.!\?]+[\.!\?]+|[^\.!\?]+$/g) || [ paragraph, ]; diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/core/eslint.config.mjs +++ b/packages/core/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/core/src/embedding.ts b/packages/core/src/embedding.ts index 2d03d3f4bbc..0bb91f136b3 100644 --- a/packages/core/src/embedding.ts +++ b/packages/core/src/embedding.ts @@ -158,7 +158,8 @@ async function getLocalEmbedding(input: string): Promise { (async () => { try { return await import("fastembed"); - } catch (error) { + // eslint-disable-next-line + } catch (_error) { elizaLogger.error("Failed to load fastembed."); throw new Error( "fastembed import failed, falling back to remote embedding" @@ -195,7 +196,8 @@ async function getLocalEmbedding(input: string): Promise { const trimmedInput = trimTokens(input, 8000, "gpt-4o-mini"); const embedding = await embeddingModel.queryEmbed(trimmedInput); return embedding; - } catch (error) { + // eslint-disable-next-line + } catch (_error) { elizaLogger.warn( "Local embedding not supported in browser, falling back to remote embedding." ); diff --git a/packages/core/src/tests/token.test.ts b/packages/core/src/tests/token.test.ts index e8ffc377c9f..76f70509dc5 100644 --- a/packages/core/src/tests/token.test.ts +++ b/packages/core/src/tests/token.test.ts @@ -1,77 +1,77 @@ -// // Now import other modules -// import { createRuntime } from "../test_resources/createRuntime"; -// import { TokenProvider, WalletProvider } from "@ai16z/plugin-solana"; -// import { Connection, PublicKey } from "@solana/web3.js"; -// import { describe, test, expect, beforeEach, vi } from "vitest"; -// import NodeCache from "node-cache"; +// Now import other modules +import { createRuntime } from "../test_resources/createRuntime"; +import { TokenProvider, WalletProvider } from "@ai16z/plugin-solana"; +import { Connection, PublicKey } from "@solana/web3.js"; +import { describe, it, expect, beforeEach, vi } from "vitest"; +import NodeCache from "node-cache"; -// describe("TokenProvider Tests", async () => { -// let tokenProvider: TokenProvider; +describe("TokenProvider Tests", () => { + let tokenProvider: TokenProvider; -// beforeEach(async () => { -// // Clear all mocks before each test -// vi.clearAllMocks(); + beforeEach(async () => { + // Clear all mocks before each test + vi.clearAllMocks(); -// const { runtime } = await createRuntime({ -// env: process.env, -// conversationLength: 10, -// }); + const { runtime } = await createRuntime({ + env: process.env, + conversationLength: 10, + }); -// const walletProvider = new WalletProvider( -// new Connection(runtime.getSetting("RPC_URL")), -// new PublicKey(runtime.getSetting("WALLET_PUBLIC_KEY")) -// ); -// // Create new instance of TokenProvider -// tokenProvider = new TokenProvider( -// "2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh", -// walletProvider -// ); + const walletProvider = new WalletProvider( + new Connection(runtime.getSetting("RPC_URL")), + new PublicKey(runtime.getSetting("WALLET_PUBLIC_KEY")) + ); + // Create new instance of TokenProvider + tokenProvider = new TokenProvider( + "2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh", + walletProvider + ); -// // Clear the cache and ensure it's empty -// (tokenProvider as any).cache.flushAll(); -// (tokenProvider as any).cache.close(); -// (tokenProvider as any).cache = new NodeCache(); + // Clear the cache and ensure it's empty + (tokenProvider as any).cache.flushAll(); + (tokenProvider as any).cache.close(); + (tokenProvider as any).cache = new NodeCache(); -// // Mock the getCachedData method instead -// vi.spyOn(tokenProvider as any, "getCachedData").mockReturnValue(null); -// }); + // Mock the getCachedData method instead + vi.spyOn(tokenProvider as any, "getCachedData").mockReturnValue(null); + }); -// test("should fetch token security data", async () => { -// // Mock the response for the fetchTokenSecurity call -// const mockFetchResponse = { -// success: true, -// data: { -// ownerBalance: "100", -// creatorBalance: "50", -// ownerPercentage: 10, -// creatorPercentage: 5, -// top10HolderBalance: "200", -// top10HolderPercent: 20, -// }, -// }; + it.skip("should fetch token security data", async () => { + // Mock the response for the fetchTokenSecurity call + const mockFetchResponse = { + success: true, + data: { + ownerBalance: "100", + creatorBalance: "50", + ownerPercentage: 10, + creatorPercentage: 5, + top10HolderBalance: "200", + top10HolderPercent: 20, + }, + }; -// // Mock fetchWithRetry function -// const fetchSpy = vi -// .spyOn(tokenProvider as any, "fetchWithRetry") -// .mockResolvedValue(mockFetchResponse); + // Mock fetchWithRetry function + const fetchSpy = vi + .spyOn(tokenProvider as any, "fetchWithRetry") + .mockResolvedValue(mockFetchResponse); -// // Run the fetchTokenSecurity method -// const securityData = await tokenProvider.fetchTokenSecurity(); -// // Check if the data returned is correct -// expect(securityData).toEqual({ -// ownerBalance: "100", -// creatorBalance: "50", -// ownerPercentage: 10, -// creatorPercentage: 5, -// top10HolderBalance: "200", -// top10HolderPercent: 20, -// }); + // Run the fetchTokenSecurity method + const securityData = await tokenProvider.fetchTokenSecurity(); + // Check if the data returned is correct + expect(securityData).toEqual({ + ownerBalance: "100", + creatorBalance: "50", + ownerPercentage: 10, + creatorPercentage: 5, + top10HolderBalance: "200", + top10HolderPercent: 20, + }); -// // Ensure the mock was called with correct URL -// expect(fetchSpy).toHaveBeenCalledWith( -// expect.stringContaining( -// "https://public-api.birdeye.so/defi/token_security?address=2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh" -// ) -// ); -// }); -// }); + // Ensure the mock was called with correct URL + expect(fetchSpy).toHaveBeenCalledWith( + expect.stringContaining( + "https://public-api.birdeye.so/defi/token_security?address=2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh" + ) + ); + }); +}); diff --git a/packages/create-eliza-app/eslint.config.mjs b/packages/create-eliza-app/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/create-eliza-app/eslint.config.mjs +++ b/packages/create-eliza-app/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-bootstrap/eslint.config.mjs b/packages/plugin-bootstrap/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-bootstrap/eslint.config.mjs +++ b/packages/plugin-bootstrap/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-bootstrap/src/actions/ignore.ts b/packages/plugin-bootstrap/src/actions/ignore.ts index 5126999f3a2..35121ab0514 100644 --- a/packages/plugin-bootstrap/src/actions/ignore.ts +++ b/packages/plugin-bootstrap/src/actions/ignore.ts @@ -14,8 +14,8 @@ export const ignoreAction: Action = { description: "Call this action if ignoring the user. If the user is aggressive, creepy or is finished with the conversation, use this action. Or, if both you and the user have already said goodbye, use this action instead of saying bye again. Use IGNORE any time the conversation has naturally ended. Do not use IGNORE if the user has engaged directly, or if something went wrong an you need to tell them. Only ignore if the user should be ignored.", handler: async ( - runtime: IAgentRuntime, - message: Memory + _runtime: IAgentRuntime, + _message: Memory ): Promise => { return true; }, diff --git a/packages/plugin-bootstrap/src/actions/none.ts b/packages/plugin-bootstrap/src/actions/none.ts index e2f7f158b07..cff68a20579 100644 --- a/packages/plugin-bootstrap/src/actions/none.ts +++ b/packages/plugin-bootstrap/src/actions/none.ts @@ -21,8 +21,8 @@ export const noneAction: Action = { description: "Respond but perform no additional action. This is the default if the agent is speaking and not doing anything additional.", handler: async ( - runtime: IAgentRuntime, - message: Memory + _runtime: IAgentRuntime, + _message: Memory ): Promise => { return true; }, diff --git a/packages/plugin-bootstrap/src/evaluators/fact.ts b/packages/plugin-bootstrap/src/evaluators/fact.ts index 15857f3d11b..78e87f5455a 100644 --- a/packages/plugin-bootstrap/src/evaluators/fact.ts +++ b/packages/plugin-bootstrap/src/evaluators/fact.ts @@ -3,7 +3,6 @@ import { generateObjectArray } from "@ai16z/eliza"; import { MemoryManager } from "@ai16z/eliza"; import { ActionExample, - Content, IAgentRuntime, Memory, ModelClass, diff --git a/packages/plugin-bootstrap/src/providers/boredom.ts b/packages/plugin-bootstrap/src/providers/boredom.ts index 1158cca46e4..159c21f3a5b 100644 --- a/packages/plugin-bootstrap/src/providers/boredom.ts +++ b/packages/plugin-bootstrap/src/providers/boredom.ts @@ -336,8 +336,6 @@ const boredomProvider: Provider = { ); const selectedMessage = boredomLevel.statusMessages[randomIndex]; return selectedMessage.replace("{{agentName}}", agentName); - - return ""; }, }; diff --git a/packages/plugin-bootstrap/src/providers/facts.ts b/packages/plugin-bootstrap/src/providers/facts.ts index 21ae26b5787..9869640bfbe 100644 --- a/packages/plugin-bootstrap/src/providers/facts.ts +++ b/packages/plugin-bootstrap/src/providers/facts.ts @@ -16,7 +16,7 @@ const factsProvider: Provider = { actors: state?.actorsData, }); - const embedding = await embed(runtime, recentMessages); + const _embedding = await embed(runtime, recentMessages); const memoryManager = new MemoryManager({ runtime, diff --git a/packages/plugin-image-generation/eslint.config.mjs b/packages/plugin-image-generation/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-image-generation/eslint.config.mjs +++ b/packages/plugin-image-generation/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-image-generation/src/index.ts b/packages/plugin-image-generation/src/index.ts index 0aac366e1f2..ab95d0c3f3d 100644 --- a/packages/plugin-image-generation/src/index.ts +++ b/packages/plugin-image-generation/src/index.ts @@ -7,7 +7,7 @@ import { Plugin, State, } from "@ai16z/eliza"; -import { generateCaption, generateImage } from "@ai16z/eliza"; +import { generateImage } from "@ai16z/eliza"; import fs from "fs"; import path from "path"; @@ -76,7 +76,7 @@ const imageGeneration: Action = { "MAKE_A", ], description: "Generate an image to go along with the message.", - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (runtime: IAgentRuntime, _message: Memory) => { await validateImageGenConfig(runtime); const anthropicApiKeyOk = !!runtime.getSetting("ANTHROPIC_API_KEY"); @@ -148,7 +148,7 @@ const imageGeneration: Action = { elizaLogger.error("Caption generation failed, using default caption:", error); }*/ - const caption = "..."; + const _caption = "..."; /*= await generateCaption( { imageUrl: image, diff --git a/packages/plugin-node/eslint.config.mjs b/packages/plugin-node/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-node/eslint.config.mjs +++ b/packages/plugin-node/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-node/src/services/browser.ts b/packages/plugin-node/src/services/browser.ts index c7172ce59bd..b25beaa82eb 100644 --- a/packages/plugin-node/src/services/browser.ts +++ b/packages/plugin-node/src/services/browser.ts @@ -266,7 +266,7 @@ export class BrowserService extends Service implements IBrowserService { websiteKey: hcaptchaKey, }); await page.evaluate((token) => { - // @ts-ignore + // @ts-expect-error expecting window.hcaptcha window.hcaptcha.setResponse(token); }, solution.gRecaptchaResponse); return; @@ -279,7 +279,7 @@ export class BrowserService extends Service implements IBrowserService { websiteKey: recaptchaKey, }); await page.evaluate((token) => { - // @ts-ignore + // @ts-expect-error expecting window.grecaptcha document.getElementById("g-recaptcha-response").innerHTML = token; }, solution.gRecaptchaResponse); diff --git a/packages/plugin-node/src/services/image.ts b/packages/plugin-node/src/services/image.ts index aed37cd9275..3f60566f66d 100644 --- a/packages/plugin-node/src/services/image.ts +++ b/packages/plugin-node/src/services/image.ts @@ -106,7 +106,7 @@ export class ImageDescriptionService this.queue.push(imageUrl); this.processQueue(); - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { const checkQueue = () => { const index = this.queue.indexOf(imageUrl); if (index !== -1) { diff --git a/packages/plugin-node/src/services/llama.ts b/packages/plugin-node/src/services/llama.ts index 720972278f3..7a747136c0d 100644 --- a/packages/plugin-node/src/services/llama.ts +++ b/packages/plugin-node/src/services/llama.ts @@ -181,7 +181,7 @@ export class LlamaService extends Service { this.modelPath = path.join(__dirname, modelName); } - async initialize(runtime: IAgentRuntime): Promise {} + async initialize(_runtime: IAgentRuntime): Promise {} private async ensureInitialized() { if (!this.modelInitialized) { diff --git a/packages/plugin-node/src/services/pdf.ts b/packages/plugin-node/src/services/pdf.ts index 8ad0ecec37f..92b8a2a13d4 100644 --- a/packages/plugin-node/src/services/pdf.ts +++ b/packages/plugin-node/src/services/pdf.ts @@ -13,7 +13,7 @@ export class PdfService extends Service implements IPdfService { return PdfService.getInstance(); } - async initialize(runtime: IAgentRuntime): Promise {} + async initialize(_runtime: IAgentRuntime): Promise {} async convertPdfToText(pdfBuffer: Buffer): Promise { // Convert Buffer to Uint8Array diff --git a/packages/plugin-node/src/services/speech.ts b/packages/plugin-node/src/services/speech.ts index a8a81e99a58..58533f804b5 100644 --- a/packages/plugin-node/src/services/speech.ts +++ b/packages/plugin-node/src/services/speech.ts @@ -87,7 +87,7 @@ async function textToSpeech(runtime: IAgentRuntime, text: string) { const reader = response.body?.getReader(); const readable = new Readable({ read() { - reader && + reader && // eslint-disable-line reader.read().then(({ done, value }) => { if (done) { this.push(null); @@ -176,7 +176,7 @@ async function textToSpeech(runtime: IAgentRuntime, text: string) { export class SpeechService extends Service implements ISpeechService { static serviceType: ServiceType = ServiceType.SPEECH_GENERATION; - async initialize(runtime: IAgentRuntime): Promise {} + async initialize(_runtime: IAgentRuntime): Promise {} getInstance(): ISpeechService { return SpeechService.getInstance(); diff --git a/packages/plugin-node/src/services/transcription.ts b/packages/plugin-node/src/services/transcription.ts index e2d78397841..763982e4a16 100644 --- a/packages/plugin-node/src/services/transcription.ts +++ b/packages/plugin-node/src/services/transcription.ts @@ -35,7 +35,7 @@ export class TranscriptionService private queue: { audioBuffer: ArrayBuffer; resolve: Function }[] = []; private processing: boolean = false; - async initialize(runtime: IAgentRuntime): Promise {} + async initialize(_runtime: IAgentRuntime): Promise {} constructor() { super(); @@ -76,7 +76,8 @@ export class TranscriptionService console.log( "CUDA detected. Transcription will use CUDA acceleration." ); - } catch (error) { + // eslint-disable-next-line + } catch (_error) { console.log( "CUDA not detected. Transcription will run on CPU." ); diff --git a/packages/plugin-node/src/services/video.ts b/packages/plugin-node/src/services/video.ts index df87d9445a7..81554cc7a7b 100644 --- a/packages/plugin-node/src/services/video.ts +++ b/packages/plugin-node/src/services/video.ts @@ -30,7 +30,7 @@ export class VideoService extends Service implements IVideoService { return VideoService.getInstance(); } - async initialize(runtime: IAgentRuntime): Promise {} + async initialize(_runtime: IAgentRuntime): Promise {} private ensureDataDirectoryExists() { if (!fs.existsSync(this.dataDir)) { @@ -140,7 +140,7 @@ export class VideoService extends Service implements IVideoService { ): Promise { const videoId = url.match( - /(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/watch\?.+&v=))([^\/&?]+)/ + /(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/watch\?.+&v=))([^\/&?]+)/ // eslint-disable-line )?.[1] || ""; const videoUuid = this.getVideoId(videoId); const cacheKey = `${this.cacheKey}/${videoUuid}`; diff --git a/packages/plugin-solana/eslint.config.mjs b/packages/plugin-solana/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-solana/eslint.config.mjs +++ b/packages/plugin-solana/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-solana/src/actions/pumpfun.ts b/packages/plugin-solana/src/actions/pumpfun.ts index 96fe39d0eca..e81f44dd160 100644 --- a/packages/plugin-solana/src/actions/pumpfun.ts +++ b/packages/plugin-solana/src/actions/pumpfun.ts @@ -2,12 +2,7 @@ import { AnchorProvider } from "@coral-xyz/anchor"; import { Wallet } from "@coral-xyz/anchor"; import { generateImage } from "@ai16z/eliza"; import { Connection, Keypair, PublicKey } from "@solana/web3.js"; -import { - CreateTokenMetadata, - DEFAULT_DECIMALS, - PriorityFee, - PumpFunSDK, -} from "pumpdotfun-sdk"; +import { CreateTokenMetadata, PriorityFee, PumpFunSDK } from "pumpdotfun-sdk"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import bs58 from "bs58"; @@ -232,14 +227,15 @@ export const sellToken = async ({ } }; +// previous logic: +// if (typeof window !== "undefined" && typeof window.confirm === "function") { +// return window.confirm( +// "Confirm the creation and purchase of the token?" +// ); +// } +// return true; const promptConfirmation = async (): Promise => { return true; - if (typeof window !== "undefined" && typeof window.confirm === "function") { - return window.confirm( - "Confirm the creation and purchase of the token?" - ); - } - return true; }; // Save the base64 data to a file @@ -275,7 +271,7 @@ Respond with a JSON markdown block containing only the extracted values.`; export default { name: "CREATE_AND_BUY_TOKEN", similes: ["CREATE_AND_PURCHASE_TOKEN", "DEPLOY_AND_BUY_TOKEN"], - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (_runtime: IAgentRuntime, _message: Memory) => { return true; //return isCreateAndBuyContent(runtime, message.content); }, description: diff --git a/packages/plugin-solana/src/actions/swap.ts b/packages/plugin-solana/src/actions/swap.ts index c43a3b22daa..97bb55a6a92 100644 --- a/packages/plugin-solana/src/actions/swap.ts +++ b/packages/plugin-solana/src/actions/swap.ts @@ -325,12 +325,14 @@ export const executeSwap: Action = { try { // First try to decode as base58 secretKey = bs58.decode(privateKeyString); + // eslint-disable-next-line } catch (e) { try { // If that fails, try base64 secretKey = Uint8Array.from( Buffer.from(privateKeyString, "base64") ); + // eslint-disable-next-line } catch (e2) { throw new Error("Invalid private key format"); } diff --git a/packages/plugin-solana/src/actions/takeOrder.ts b/packages/plugin-solana/src/actions/takeOrder.ts index b4a5a528729..14e7441679d 100644 --- a/packages/plugin-solana/src/actions/takeOrder.ts +++ b/packages/plugin-solana/src/actions/takeOrder.ts @@ -3,11 +3,8 @@ import { IAgentRuntime, Memory, Content, - ActionExample, ModelClass, } from "@ai16z/eliza"; -import * as fs from "fs"; -import { settings } from "@ai16z/eliza"; import { composeContext } from "@ai16z/eliza"; import { generateText } from "@ai16z/eliza"; @@ -32,7 +29,7 @@ const take_order: Action = { return tickerRegex.test(text); }, handler: async (runtime: IAgentRuntime, message: Memory) => { - const text = (message.content as Content).text; + const _text = (message.content as Content).text; const userId = message.userId; const template = ` diff --git a/packages/plugin-solana/src/providers/token.ts b/packages/plugin-solana/src/providers/token.ts index 2e46e0e8096..b773d0cebad 100644 --- a/packages/plugin-solana/src/providers/token.ts +++ b/packages/plugin-solana/src/providers/token.ts @@ -889,8 +889,8 @@ export class TokenProvider { const liquidityUsd = toBN(liquidity.usd); const marketCapUsd = toBN(marketCap); const totalSupply = toBN(ownerBalance).plus(creatorBalance); - const ownerPercentage = toBN(ownerBalance).dividedBy(totalSupply); - const creatorPercentage = + const _ownerPercentage = toBN(ownerBalance).dividedBy(totalSupply); + const _creatorPercentage = toBN(creatorBalance).dividedBy(totalSupply); const top10HolderPercent = toBN(tradeData.volume_24h_usd).dividedBy( totalSupply diff --git a/packages/plugin-solana/src/providers/trustScoreProvider.ts b/packages/plugin-solana/src/providers/trustScoreProvider.ts index 88c2b97df01..32f41267203 100644 --- a/packages/plugin-solana/src/providers/trustScoreProvider.ts +++ b/packages/plugin-solana/src/providers/trustScoreProvider.ts @@ -29,7 +29,7 @@ interface sellDetails { sell_amount: number; sell_recommender_id: string | null; } -interface RecommendationGroup { +interface _RecommendationGroup { recommendation: any; trustScore: number; } @@ -605,7 +605,7 @@ export const trustScoreProvider: Provider = { async get( runtime: IAgentRuntime, message: Memory, - state?: State + _state?: State ): Promise { try { const trustScoreDb = new TrustScoreDatabase( diff --git a/packages/plugin-solana/src/providers/wallet.ts b/packages/plugin-solana/src/providers/wallet.ts index c9d406eb46e..22d9f050bf6 100644 --- a/packages/plugin-solana/src/providers/wallet.ts +++ b/packages/plugin-solana/src/providers/wallet.ts @@ -33,7 +33,7 @@ interface WalletPortfolio { items: Array; } -interface BirdEyePriceData { +interface _BirdEyePriceData { data: { [key: string]: { price: number; diff --git a/packages/plugin-starknet/eslint.config.mjs b/packages/plugin-starknet/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-starknet/eslint.config.mjs +++ b/packages/plugin-starknet/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-starknet/src/actions/swap.ts b/packages/plugin-starknet/src/actions/swap.ts index b5e23133346..3c135b5f753 100644 --- a/packages/plugin-starknet/src/actions/swap.ts +++ b/packages/plugin-starknet/src/actions/swap.ts @@ -16,7 +16,7 @@ import { QuoteRequest, } from "@avnu/avnu-sdk"; -import { getStarknetAccount, validateSettings } from "../utils/index.ts"; +import { getStarknetAccount } from "../utils/index.ts"; import { validateStarknetConfig } from "../enviroment.ts"; interface SwapContent { @@ -80,7 +80,7 @@ export const executeSwap: Action = { "STARKNET_TRADE_TOKENS", "STARKNET_EXCHANGE_TOKENS", ], - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (runtime: IAgentRuntime, _message: Memory) => { await validateStarknetConfig(runtime); return true; }, diff --git a/packages/plugin-starknet/src/actions/takeOrder.ts b/packages/plugin-starknet/src/actions/takeOrder.ts index a18dab230ad..39df5073f6c 100644 --- a/packages/plugin-starknet/src/actions/takeOrder.ts +++ b/packages/plugin-starknet/src/actions/takeOrder.ts @@ -51,7 +51,7 @@ const take_order: Action = { return tickerRegex.test(text); }, handler: async (runtime: IAgentRuntime, message: Memory) => { - const text = (message.content as Content).text; + const _text = (message.content as Content).text; const userId = message.userId; let ticker, contractAddress; diff --git a/packages/plugin-starknet/src/actions/transfer.ts b/packages/plugin-starknet/src/actions/transfer.ts index 76baba1c385..6fd851ca93c 100644 --- a/packages/plugin-starknet/src/actions/transfer.ts +++ b/packages/plugin-starknet/src/actions/transfer.ts @@ -13,11 +13,7 @@ import { generateObject, elizaLogger, } from "@ai16z/eliza"; -import { - getStarknetAccount, - isTransferContent, - validateSettings, -} from "../utils"; +import { getStarknetAccount, isTransferContent } from "../utils"; import { ERC20Token } from "../utils/ERC20Token"; import { validateStarknetConfig } from "../enviroment"; @@ -58,7 +54,7 @@ export default { "SEND_ETH_ON_STARKNET", "PAY_ON_STARKNET", ], - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (runtime: IAgentRuntime, _message: Memory) => { await validateStarknetConfig(runtime); return true; }, diff --git a/packages/plugin-starknet/src/actions/unruggable.ts b/packages/plugin-starknet/src/actions/unruggable.ts index 9dcde7e8e08..9d052415f96 100644 --- a/packages/plugin-starknet/src/actions/unruggable.ts +++ b/packages/plugin-starknet/src/actions/unruggable.ts @@ -16,16 +16,9 @@ import { getStarknetProvider, parseFormatedAmount, parseFormatedPercentage, - validateSettings, } from "../utils/index.ts"; import { DeployData, Factory } from "@unruggable_starknet/core"; -import { - AMM, - EKUBO_TICK_SPACING, - LiquidityType, - QUOTE_TOKEN_SYMBOL, - RECOMMENDED_EKUBO_FEES, -} from "@unruggable_starknet/core/constants"; +import { AMM, QUOTE_TOKEN_SYMBOL } from "@unruggable_starknet/core/constants"; import { ACCOUNTS, TOKENS } from "../utils/constants.ts"; import { validateStarknetConfig } from "../enviroment.ts"; @@ -82,7 +75,7 @@ export const deployToken: Action = { "STARKNET_DEPLOY_MEMECOIN", "STARKNET_CREATE_MEMECOIN", ], - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (runtime: IAgentRuntime, _message: Memory) => { await validateStarknetConfig(runtime); return true; }, diff --git a/packages/plugin-starknet/src/providers/token.ts b/packages/plugin-starknet/src/providers/token.ts index 999090cbdee..c6677d4dfb4 100644 --- a/packages/plugin-starknet/src/providers/token.ts +++ b/packages/plugin-starknet/src/providers/token.ts @@ -9,7 +9,6 @@ import { HolderData, ProcessedTokenData, TokenSecurityData, - TokenTradeData, CalculatedBuyAmounts, Prices, } from "../types/trustDB.ts"; @@ -404,7 +403,7 @@ export class TokenProvider { } // TODO: - async analyzeHolderDistribution(tradeData: TokenInfo): Promise { + async analyzeHolderDistribution(_tradeData: TokenInfo): Promise { // Define the time intervals to consider (e.g., 30m, 1h, 2h) // TODO: Update to Starknet diff --git a/packages/plugin-starknet/src/providers/trustScoreProvider.ts b/packages/plugin-starknet/src/providers/trustScoreProvider.ts index 809d8e92120..5913946f1de 100644 --- a/packages/plugin-starknet/src/providers/trustScoreProvider.ts +++ b/packages/plugin-starknet/src/providers/trustScoreProvider.ts @@ -20,10 +20,9 @@ import { import { settings } from "@ai16z/eliza"; import { IAgentRuntime, Memory, Provider, State } from "@ai16z/eliza"; import { getTokenBalance } from "../utils/index.ts"; -import { walletProvider } from "./walletProvider.ts"; import { TokenProvider } from "./token.ts"; -const Wallet = settings.MAIN_WALLET_ADDRESS; +const _Wallet = settings.MAIN_WALLET_ADDRESS; interface TradeData { buy_amount: number; is_simulation: boolean; @@ -32,7 +31,7 @@ interface sellDetails { sell_amount: number; sell_recommender_id: string | null; } -interface RecommendationGroup { +interface _RecommendationGroup { recommendation: any; trustScore: number; } @@ -605,7 +604,7 @@ export const trustScoreProvider: Provider = { async get( runtime: IAgentRuntime, message: Memory, - state?: State + _state?: State ): Promise { try { const trustScoreDb = new TrustScoreDatabase( diff --git a/packages/plugin-starknet/src/providers/walletProvider.ts b/packages/plugin-starknet/src/providers/walletProvider.ts index 91d90b35fac..2ab45b0f05c 100644 --- a/packages/plugin-starknet/src/providers/walletProvider.ts +++ b/packages/plugin-starknet/src/providers/walletProvider.ts @@ -1,5 +1,4 @@ import { IAgentRuntime, Memory, Provider, State } from "@ai16z/eliza"; -import { Connection, PublicKey } from "@solana/web3.js"; import BigNumber from "bignumber.js"; import NodeCache from "node-cache"; import { validateSettings } from "../utils"; @@ -34,7 +33,7 @@ interface WalletPortfolio { items: Array; } -interface BirdEyePriceData { +interface _BirdEyePriceData { data: { [key: string]: { price: number; @@ -106,7 +105,7 @@ export class WalletProvider { throw lastError; } - async fetchPortfolioValue(runtime): Promise { + async fetchPortfolioValue(_runtime): Promise { try { const cacheKey = `portfolio-${this.runtime.getSetting("STARKNET_WALLET_ADDRESS")}`; const cachedValue = this.cache.get(cacheKey); @@ -163,7 +162,7 @@ export class WalletProvider { } } - async fetchPrices(runtime): Promise { + async fetchPrices(_runtime): Promise { try { const cacheKey = "prices"; const cachedValue = this.cache.get(cacheKey); @@ -175,7 +174,7 @@ export class WalletProvider { console.log("Cache miss for fetchPrices"); const { SOL, BTC, ETH } = PROVIDER_CONFIG.TOKEN_ADDRESSES; - const tokens = [SOL, BTC, ETH]; + const _tokens = [SOL, BTC, ETH]; const prices: Prices = { solana: { usd: "0" }, bitcoin: { usd: "0" }, diff --git a/packages/plugin-starknet/src/utils/ERC20Token.ts b/packages/plugin-starknet/src/utils/ERC20Token.ts index 10721486dcf..0d4c54e1f04 100644 --- a/packages/plugin-starknet/src/utils/ERC20Token.ts +++ b/packages/plugin-starknet/src/utils/ERC20Token.ts @@ -1,4 +1,4 @@ -import { Account, Call, CallData, Calldata, Contract, cairo } from "starknet"; +import { Account, CallData, Calldata, Contract, cairo } from "starknet"; import erc20Abi from "./erc20.json"; export type ApproveCall = { diff --git a/packages/plugin-trustdb/eslint.config.mjs b/packages/plugin-trustdb/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-trustdb/eslint.config.mjs +++ b/packages/plugin-trustdb/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-video-generation/eslint.config.mjs b/packages/plugin-video-generation/eslint.config.mjs index 282796e2b51..c6b6b1a9daa 100644 --- a/packages/plugin-video-generation/eslint.config.mjs +++ b/packages/plugin-video-generation/eslint.config.mjs @@ -1,71 +1,3 @@ -import eslint from "@eslint/js"; -import tseslint from "@typescript-eslint/eslint-plugin"; -import typescript from "@typescript-eslint/parser"; -import prettier from "eslint-config-prettier"; -import vitest from "eslint-plugin-vitest"; // Add Vitest plugin +import eslintGlobalConfig from "../../eslint.global.mjs"; -export default [ - // JavaScript and TypeScript files - { - files: ["src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "src/**/*.ts"], - languageOptions: { - parser: typescript, - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - project: "./tsconfig.json", // Make sure your tsconfig includes @types/node - }, - globals: { - // Add Node.js globals - NodeJS: "readonly", - console: "readonly", - process: "readonly", - Buffer: "readonly", - __dirname: "readonly", - __filename: "readonly", - module: "readonly", - require: "readonly", - }, - }, - plugins: { - "@typescript-eslint": tseslint, - }, - rules: { - ...eslint.configs.recommended.rules, - ...tseslint.configs.recommended.rules, - "prefer-const": "warn", - "no-constant-binary-expression": "error", - - // Disable no-undef as TypeScript handles this better - "no-undef": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - // Customize TypeScript rules - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - ignoreRestSiblings: true, - }, - ], - }, - }, - // Vitest configuration - { - files: [ - "src/**/*.test.js", - "src/**/*.test.ts", - "src/**/*.spec.js", - "src/**/*.spec.ts", - ], - plugins: { - vitest, // Register Vitest plugin - }, - rules: { - ...vitest.configs.recommended.rules, - }, - }, - // Add prettier as the last config to override other formatting rules - prettier, -]; +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-video-generation/src/index.ts b/packages/plugin-video-generation/src/index.ts index b6e6bae5022..08f158dc3c9 100644 --- a/packages/plugin-video-generation/src/index.ts +++ b/packages/plugin-video-generation/src/index.ts @@ -119,7 +119,7 @@ const videoGeneration: Action = { "VIDEO_MAKE", ], description: "Generate a video based on a text prompt", - validate: async (runtime: IAgentRuntime, message: Memory) => { + validate: async (runtime: IAgentRuntime, _message: Memory) => { elizaLogger.log("Validating video generation action"); const lumaApiKey = runtime.getSetting("LUMA_API_KEY"); elizaLogger.log("LUMA_API_KEY present:", !!lumaApiKey); @@ -128,8 +128,8 @@ const videoGeneration: Action = { handler: async ( runtime: IAgentRuntime, message: Memory, - state: State, - options: any, + _state: State, + _options: any, callback: HandlerCallback ) => { elizaLogger.log("Video generation request:", message); diff --git a/scripts/lint.sh b/scripts/lint.sh index 9643183e627..98e28991fa3 100644 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -41,6 +41,7 @@ for package in "${PACKAGES[@]}"; do echo -e "\033[1;32mSuccessfully linted $package\033[0m\n" else echo -e "\033[1;31mLint failed for $package\033[0m" + exit 1 # Exit immediately if lint fails fi else echo "No lint script found in $package, skipping lint..."