Skip to content

Commit

Permalink
clean up and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 11, 2025
1 parent 75ab478 commit 048fafa
Show file tree
Hide file tree
Showing 94 changed files with 979 additions and 606 deletions.
10 changes: 1 addition & 9 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
"noPrototypeBuiltins": "warn",
"noDuplicateObjectKeys": "warn",
"noGlobalIsNan": "warn",
"noDuplicateFontNames": "warn",
"noSelfCompare": "warn",
"noDoubleEquals": "warn",
"noImplicitAnyLet": "warn",
"noAssignInExpressions": "warn",
"noExportsInTest": "warn",
"noConstEnum": "warn",
"noEmptyInterface": "warn"
},
Expand All @@ -33,24 +31,19 @@
"style": {
"useConst": "warn",
"useTemplate": "warn",
"useImportType": "warn",
"useNodejsImportProtocol": "warn",
"noUselessElse": "warn",
"useSelfClosingElements": "warn",
"useNumberNamespace": "warn",
"noUnusedTemplateLiteral": "warn",
"noInferrableTypes": "warn",
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"useDefaultParameterLast": "warn",
"useExponentiationOperator": "warn",
"noVar": "warn",
"useSingleVarDeclarator": "warn",
"useExportType": "warn"
"useSingleVarDeclarator": "warn"
},
"a11y": {
"useAltText": "warn",
"useFocusableInteractive": "warn",
"useMediaCaption": "warn",
"noSvgWithoutTitle": "warn",
"useKeyWithClickEvents": "warn"
Expand All @@ -65,7 +58,6 @@
"noStaticOnlyClass": "warn",
"noThisInStatic": "warn",
"noUselessConstructor": "warn",
"noUselessTernary": "warn",
"noUselessSwitchCase": "warn",
"noUselessCatch": "warn"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"scripts": {
"format": "biome format --write .",
"cli": "bun --filter=@elizaos/cli cli",
"lint": "biome lint . --write",
"lint": "turbo run lint:fix --filter=./packages/*",
"check": "biome check --apply .",
"preinstall": "npx only-allow bun",
"build": "turbo run build --filter=./packages/core && turbo run build --filter=./packages/*",
Expand Down
6 changes: 3 additions & 3 deletions packages/agent/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
type Character,
getEnvVariable,
IAgentRuntime,
ITeeLogService,
type IAgentRuntime,
type ITeeLogService,
logger,
ServiceType,
TeeLogQuery,
type TeeLogQuery,
type UUID,
validateCharacterConfig,
validateUuid
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/defaultCharacter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Character } from "@elizaos/core";
import type { Character } from "@elizaos/core";

export const defaultCharacter: Character = {
name: "Eliza",
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DbCacheAdapter,
logger,
stringToUuid,
TestSuite,
type TestSuite,
type IAgentRuntime
} from "@elizaos/core";
import { afterAll, beforeAll, describe, it } from 'vitest';
Expand Down
14 changes: 7 additions & 7 deletions packages/agent/src/reply.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
type Action,
type ActionExample,
type HandlerCallback,
type IAgentRuntime,
type Memory,
type State,
import type {
Action,
ActionExample,
HandlerCallback,
IAgentRuntime,
Memory,
State,
} from "@elizaos/core";

const replyAction = {
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ agent
try {
// If input is a number, get agent ID from index
if (!isNaN(Number(agentIdOrIndex))) {
agentIdOrIndex = await getAgentIdFromIndex(parseInt(agentIdOrIndex))
agentIdOrIndex = await getAgentIdFromIndex(Number.parseInt(agentIdOrIndex))
}

const response = await fetch(`${AGENT_RUNTIME_URL}/agents/${agentIdOrIndex}`)
Expand Down Expand Up @@ -122,7 +122,7 @@ agent
.action(async (agentIdOrIndex) => {
try {
if (!isNaN(Number(agentIdOrIndex))) {
agentIdOrIndex = await getAgentIdFromIndex(parseInt(agentIdOrIndex))
agentIdOrIndex = await getAgentIdFromIndex(Number.parseInt(agentIdOrIndex))
}

const response = await fetch(`${AGENT_RUNTIME_URL}/agents/${agentIdOrIndex}/stop`, {
Expand All @@ -146,7 +146,7 @@ agent
.action(async (agentIdOrIndex) => {
try {
if (!isNaN(Number(agentIdOrIndex))) {
agentIdOrIndex = await getAgentIdFromIndex(parseInt(agentIdOrIndex))
agentIdOrIndex = await getAgentIdFromIndex(Number.parseInt(agentIdOrIndex))
}

const response = await fetch(`${AGENT_RUNTIME_URL}/agents/${agentIdOrIndex}`, {
Expand All @@ -171,7 +171,7 @@ agent
.action(async (agentIdOrIndex, configPath) => {
try {
if (!isNaN(Number(agentIdOrIndex))) {
agentIdOrIndex = await getAgentIdFromIndex(parseInt(agentIdOrIndex))
agentIdOrIndex = await getAgentIdFromIndex(Number.parseInt(agentIdOrIndex))
}

const config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
Expand Down
2 changes: 1 addition & 1 deletion packages/core/__tests__/knowledge.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import knowledge from "../src/knowledge";
import type { AgentRuntime } from "../src/runtime";
import { type Memory } from "../src/types";
import type { Memory } from "../src/types";

vi.mock("../generation", () => ({
splitChunks: vi.fn().mockImplementation(async (text) => [text]),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/__tests__/mockCharacter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Character } from "@elizaos/core";
import type { Character } from "@elizaos/core";

export const mockCharacter: Character = {
name: "Eliza",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/__tests__/runtime.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { beforeEach, describe, expect, it, test, vi } from "vitest";
import { AgentRuntime } from "../src/runtime";
import {
type Action,
type IDatabaseAdapter,
type IMemoryManager,
type Memory,
type UUID
import type {
Action,
IDatabaseAdapter,
IMemoryManager,
Memory,
UUID
} from "../src/types";

// Mock dependencies with minimal implementations
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import {
type Provider,
type State,
type UUID,
ServiceType,
Service
type ServiceType,
type Service
} from "./types.ts";
import { stringToUuid } from "./uuid.ts";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/test_resources/createRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SqliteDatabaseAdapter, loadVecExtensions } from "@elizaos-plugins/sqlite";
import type { DatabaseAdapter } from "../database.ts";
import { AgentRuntime } from "../runtime.ts";
import { type Action, type Evaluator, type Provider } from "../types.ts";
import type { Action, Evaluator, Provider } from "../types.ts";
import {
zeroUuid
} from "./constants.ts";
Expand Down
40 changes: 40 additions & 0 deletions packages/plugin-anthropic/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"extends": ["../../biome.json"],
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "error"
},
"style": {
"useConst": "error"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"files": {
"ignore": [
"dist/**/*",
"extra/**/*",
"node_modules/**/*"
]
}
}
2 changes: 1 addition & 1 deletion packages/plugin-anthropic/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { anthropic } from "@ai-sdk/anthropic";
import type { Plugin } from "@elizaos/core";
import {
GenerateTextParams,
type GenerateTextParams,
ModelClass
} from "@elizaos/core";
import { generateText } from "ai";
Expand Down
40 changes: 40 additions & 0 deletions packages/plugin-bootstrap/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"extends": ["../../biome.json"],
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "error"
},
"style": {
"useConst": "error"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"files": {
"ignore": [
"dist/**/*",
"extra/**/*",
"node_modules/**/*"
]
}
}
2 changes: 1 addition & 1 deletion packages/plugin-bootstrap/src/providers/facts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Memory, Provider, State } from "@elizaos/core";
import {
formatMessages,
IAgentRuntime,
type IAgentRuntime,
MemoryManager,
ModelClass
} from "@elizaos/core";
Expand Down
40 changes: 40 additions & 0 deletions packages/plugin-discord/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"extends": ["../../biome.json"],
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "error"
},
"style": {
"useConst": "error"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"files": {
"ignore": [
"dist/**/*",
"extra/**/*",
"node_modules/**/*"
]
}
}
12 changes: 6 additions & 6 deletions packages/plugin-discord/src/actions/reply.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
type Action,
type HandlerCallback,
type IAgentRuntime,
type Memory,
type State
import type {
Action,
HandlerCallback,
IAgentRuntime,
Memory,
State
} from "@elizaos/core";

const replyAction = {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-discord/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
logger,
stringToUuid,
TestSuite,
type TestSuite,
type Character,
type Client as ElizaClient,
type IAgentRuntime,
Expand All @@ -28,7 +28,7 @@ import { MessageManager } from "./messages.ts";
import channelStateProvider from "./providers/channelState.ts";
import voiceStateProvider from "./providers/voiceState.ts";
import reply from "./actions/reply.ts";
import { IDiscordClient } from "./types.ts";
import type { IDiscordClient } from "./types.ts";
import { VoiceManager } from "./voice.ts";

export class DiscordClient extends EventEmitter implements IDiscordClient {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-discord/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ChannelType,
type Client,
type Message as DiscordMessage,
TextChannel,
type TextChannel,
} from "discord.js";
import { AttachmentManager } from "./attachments.ts";
import {
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-discord/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
type Character,
type IAgentRuntime
import type {
Character,
IAgentRuntime
} from "@elizaos/core";
import {
import type {
Client
} from "discord.js";

Expand Down
Loading

0 comments on commit 048fafa

Please sign in to comment.