Skip to content

Commit 9bbb555

Browse files
authored
fix: test/lint develop (#2266)
* bump version * add eslint config * remove unused error var per lint * fix lint * comment out duplicate symbol * prefix address as it's not used per lint * add _ prefix for unused vars per lint * remove unused error per lint * prefix unused vars with _ per lint * remove unused error per lint * don't import unused ServiceType per lint * remove unused vars per lint * rename test per lint * lint auto fixes * deTS it per lint * deTS per lint * bump
1 parent 28e613a commit 9bbb555

File tree

20 files changed

+73
-118
lines changed

20 files changed

+73
-118
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];

packages/plugin-binance/src/actions/spotBalance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const spotBalance: Action = {
4747
try {
4848
await validateBinanceConfig(runtime);
4949
return true;
50-
} catch (error) {
50+
} catch {
5151
return false;
5252
}
5353
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];

packages/plugin-nft-collections/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "tsup src/index.ts --format esm --dts",
1010
"test": "vitest run",
1111
"test:watch": "vitest",
12-
"lint": "eslint src --ext .ts",
12+
"lint": "eslint --fix --cache .",
1313
"format": "prettier --write src/**/*.ts"
1414
},
1515
"dependencies": {
@@ -22,7 +22,7 @@
2222
"@types/node": "^20.11.16",
2323
"@typescript-eslint/eslint-plugin": "^6.21.0",
2424
"@typescript-eslint/parser": "^6.21.0",
25-
"eslint": "^8.56.0",
25+
"eslint": "^9.16.0",
2626
"prettier": "^3.2.5",
2727
"tsup": "^8.0.1",
2828
"typescript": "^5.3.3",

packages/plugin-nft-collections/src/constants/curated-collections.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const CollectionCategory = z.enum([
88
"Iconic Gems",
99
]);
1010

11-
export type CollectionCategory = z.infer<typeof CollectionCategory>;
11+
//export type CollectionCategory = z.infer<typeof CollectionCategory>;
1212

1313
export const CuratedCollectionSchema = z.object({
1414
address: z.string(),

packages/plugin-nft-collections/src/services/market-intelligence.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class MarketIntelligenceService {
1616
this.rateLimiter = config.rateLimiter;
1717
}
1818

19-
async getMarketIntelligence(address: string): Promise<MarketData> {
19+
async getMarketIntelligence(_address: string): Promise<MarketData> {
2020
// Implementation will be added later
2121
return {
2222
floorPrice: 0,

packages/plugin-nft-collections/src/services/reservoir.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,19 @@ export class ReservoirService {
218218
return Promise.resolve({} as MarketStats);
219219
}
220220

221-
async getCollectionActivity(collectionAddress: string): Promise<any> {
221+
async getCollectionActivity(_collectionAddress: string): Promise<any> {
222222
return Promise.resolve(null);
223223
}
224224

225-
async getCollectionTokens(collectionAddress: string): Promise<any> {
225+
async getCollectionTokens(_collectionAddress: string): Promise<any> {
226226
return Promise.resolve(null);
227227
}
228228

229-
async getCollectionAttributes(collectionAddress: string): Promise<any> {
229+
async getCollectionAttributes(_collectionAddress: string): Promise<any> {
230230
return Promise.resolve(null);
231231
}
232232

233-
async getFloorListings(options: {
233+
async getFloorListings(_options: {
234234
collection: string;
235235
limit: number;
236236
sortBy: "price" | "rarity";
@@ -245,7 +245,7 @@ export class ReservoirService {
245245
return Promise.resolve([]);
246246
}
247247

248-
async executeBuy(options: {
248+
async executeBuy(_options: {
249249
listings: Array<{
250250
tokenId: string;
251251
price: number;
@@ -266,7 +266,7 @@ export class ReservoirService {
266266
});
267267
}
268268

269-
async createListing(options: {
269+
async createListing(_options: {
270270
tokenId: string;
271271
collectionAddress: string;
272272
price: number;
@@ -288,7 +288,7 @@ export class ReservoirService {
288288
});
289289
}
290290

291-
async cancelListing(options: {
291+
async cancelListing(_options: {
292292
listingId: string;
293293
marketplace: "ikigailabs";
294294
}): Promise<{
@@ -301,7 +301,7 @@ export class ReservoirService {
301301
});
302302
}
303303

304-
async getOwnedNFTs(owner: string): Promise<
304+
async getOwnedNFTs(_owner: string): Promise<
305305
Array<{
306306
tokenId: string;
307307
collectionAddress: string;

packages/plugin-nft-collections/src/services/security-manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class SecurityManager {
4545

4646
try {
4747
return JSON.parse(decrypted);
48-
} catch (error) {
48+
} catch {
4949
throw new Error('Failed to decrypt or parse data');
5050
}
5151
}

packages/plugin-nft-collections/src/services/social-analytics.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ export class SocialAnalyticsService {
1616
this.rateLimiter = config.rateLimiter;
1717
}
1818

19-
async getSocialMetrics(address: string): Promise<SocialMetrics> {
19+
async getSocialMetrics(_address: string): Promise<SocialMetrics> {
2020
// Implementation will be added later
2121
return {
2222
lastUpdate: new Date().toISOString(),
2323
};
2424
}
2525

2626
async getCommunityMetrics(
27-
address: string,
28-
discordId?: string,
29-
telegramId?: string
27+
_address: string,
28+
_discordId?: string,
29+
_telegramId?: string
3030
): Promise<SocialMetrics> {
3131
// Implementation will be added later
3232
return {
3333
lastUpdate: new Date().toISOString(),
3434
};
3535
}
3636

37-
async analyzeSentiment(address: string): Promise<{
37+
async analyzeSentiment(_address: string): Promise<{
3838
overall: number;
3939
breakdown: {
4040
positive: number;
@@ -59,7 +59,7 @@ export class SocialAnalyticsService {
5959
};
6060
}
6161

62-
async trackSocialPerformance(address: string): Promise<{
62+
async trackSocialPerformance(_address: string): Promise<{
6363
metrics: {
6464
reach: number;
6565
engagement: number;

packages/plugin-nft-collections/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Service, ServiceType } from "@elizaos/core";
1+
import { Service } from "@elizaos/core";
22

33
declare module "@elizaos/core" {
44
interface ServiceTypeMap {

packages/plugin-nft-collections/src/utils/validation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function validatePriceRange(price: number): boolean {
111111
export function sanitizeCollectionData(data: unknown): Partial<NFTCollection> {
112112
try {
113113
return NFTCollectionSchema.parse(data);
114-
} catch (error) {
114+
} catch {
115115
// Return only the valid fields
116116
const partial = {};
117117
const validFields = Object.entries(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];

packages/plugin-opacity/src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export class OpacityAdapter implements IVerifiableInferenceAdapter {
4343
// Get provider-specific endpoint
4444
let endpoint;
4545
let authHeader;
46-
let responseRegex;
4746

4847
switch (provider) {
4948
case ModelProviderName.OPENAI:
@@ -97,7 +96,7 @@ export class OpacityAdapter implements IVerifiableInferenceAdapter {
9796
// Validate JSON before sending
9897
try {
9998
JSON.parse(requestBody); // Verify the JSON is valid
100-
} catch (e) {
99+
} catch {
101100
elizaLogger.error("Invalid JSON body:", body);
102101
throw new Error("Failed to create valid JSON request body");
103102
}

packages/plugin-tee-verifiable-log/src/test/deriveProvider.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe("DeriveProvider", () => {
1818
});
1919
expect(keys).not.toBeNull();
2020
});
21-
it("should deriveKeyPair when available", async () => {
21+
it("should deriveKeyPair when available 2", async () => {
2222
const agentId = uuidv4();
2323
const plantText = "Helo World";
2424
const { success, errorMsg, ivHex, encryptedData } =

packages/plugin-tee-verifiable-log/src/test/providers.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("SQLite3VerifiableDAO", () => {
2828
});
2929
describe("VerifiableLogProvider Management", () => {
3030
it("should verifiableLogProvider.log when available", async () => {
31-
let uid = uuidv4();
31+
const uid = uuidv4();
3232
await verifiableLogProvider.log(
3333
{
3434
agentId: uid,
@@ -75,7 +75,7 @@ describe("SQLite3VerifiableDAO", () => {
7575

7676
describe("SQLite3VerifiableDAO Management", () => {
7777
it("should addLog and pageQueryLogs when available", async () => {
78-
let testId = uuidv4();
78+
const testId = uuidv4();
7979
await sqLite3VerifiableDAO.addLog(<VerifiableLog>{
8080
id: testId,
8181
agent_id: "dddd",

packages/plugin-whatsapp/__tests__/client.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ vi.mock('axios', () => {
1515
});
1616

1717
describe('WhatsAppClient', () => {
18-
let client: WhatsAppClient;
19-
let mockPost: any;
20-
21-
const mockConfig: WhatsAppConfig = {
18+
let client;
19+
let mockPost;
20+
21+
const mockConfig = {
2222
accessToken: 'test-token',
2323
phoneNumberId: 'test-phone-id',
2424
webhookVerifyToken: 'test-webhook-token',
@@ -28,12 +28,12 @@ describe('WhatsAppClient', () => {
2828
beforeEach(() => {
2929
vi.clearAllMocks();
3030
client = new WhatsAppClient(mockConfig);
31-
mockPost = (axios.create() as any).post;
31+
mockPost = (axios.create()).post;
3232
});
3333

3434
describe('sendMessage', () => {
3535
it('should send a text message correctly', async () => {
36-
const mockMessage: WhatsAppMessage = {
36+
const mockMessage = {
3737
type: 'text',
3838
to: '1234567890',
3939
content: 'Hello, World!'
@@ -57,7 +57,7 @@ describe('WhatsAppClient', () => {
5757
});
5858

5959
it('should send a template message correctly', async () => {
60-
const mockMessage: WhatsAppMessage = {
60+
const mockMessage = {
6161
type: 'template',
6262
to: '1234567890',
6363
content: {
@@ -93,7 +93,7 @@ describe('WhatsAppClient', () => {
9393
});
9494

9595
it('should handle API errors correctly', async () => {
96-
const mockMessage: WhatsAppMessage = {
96+
const mockMessage = {
9797
type: 'text',
9898
to: '1234567890',
9999
content: 'Hello, World!'
@@ -108,7 +108,7 @@ describe('WhatsAppClient', () => {
108108

109109
describe('verifyWebhook', () => {
110110
it('should verify webhook token correctly', async () => {
111-
const result = await client.verifyWebhook(mockConfig.webhookVerifyToken!);
111+
const result = await client.verifyWebhook(mockConfig.webhookVerifyToken);
112112
expect(result).toBe(true);
113113
});
114114

packages/plugin-whatsapp/__tests__/handlers/webhook.handler.test.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { WhatsAppClient } from '../../src/client';
44
import { WhatsAppWebhookEvent } from '../../src/types';
55

66
describe('WebhookHandler', () => {
7-
let webhookHandler: WebhookHandler;
8-
let mockClient: WhatsAppClient;
9-
let consoleSpy: any;
7+
let webhookHandler;
8+
let mockClient;
9+
let consoleSpy;
1010

1111
beforeEach(() => {
12-
mockClient = {} as WhatsAppClient;
12+
mockClient = {};
1313
webhookHandler = new WebhookHandler(mockClient);
1414
consoleSpy = vi.spyOn(console, 'log');
1515
});
@@ -28,7 +28,7 @@ describe('WebhookHandler', () => {
2828
}
2929
};
3030

31-
const mockEvent: WhatsAppWebhookEvent = {
31+
const mockEvent = {
3232
object: 'whatsapp_business_account',
3333
entry: [{
3434
id: 'BUSINESS_ID',
@@ -58,7 +58,7 @@ describe('WebhookHandler', () => {
5858
recipient_id: '1234567890'
5959
};
6060

61-
const mockEvent: WhatsAppWebhookEvent = {
61+
const mockEvent = {
6262
object: 'whatsapp_business_account',
6363
entry: [{
6464
id: 'BUSINESS_ID',
@@ -98,7 +98,7 @@ describe('WebhookHandler', () => {
9898
recipient_id: '1234567890'
9999
};
100100

101-
const mockEvent: WhatsAppWebhookEvent = {
101+
const mockEvent = {
102102
object: 'whatsapp_business_account',
103103
entry: [{
104104
id: 'BUSINESS_ID',
@@ -123,11 +123,11 @@ describe('WebhookHandler', () => {
123123
});
124124

125125
it('should handle errors correctly', async () => {
126-
const mockEvent = {} as WhatsAppWebhookEvent;
127-
126+
const mockEvent = {};
127+
128128
// The handler should not throw an error for an empty event
129129
await expect(webhookHandler.handle(mockEvent)).resolves.not.toThrow();
130-
130+
131131
// Verify that no messages or statuses were processed
132132
expect(consoleSpy).not.toHaveBeenCalled();
133133
});

0 commit comments

Comments
 (0)