Skip to content

Commit 9774fdc

Browse files
Copilothotlong
andcommitted
fix: resolve all 372 @typescript-eslint/no-unused-vars violations
- Prefix unused function parameters with _ (207 instances) - Prefix unused caught errors with _ (53 instances) - Remove unused imports (48 instances) - Prefix unused variables with _ (51 instances) - Prefix remaining imports with _ where removal wasn't safe (13 instances) - Fix incorrectly renamed imports that were prefixed instead of removed Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 13384ec commit 9774fdc

98 files changed

Lines changed: 300 additions & 323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/drivers/excel/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Data } from '@objectstack/spec';
22
import { z } from 'zod';
3-
type DriverInterface = z.infer<typeof Data.DriverInterface>;
3+
type _DriverInterface = z.infer<typeof Data.DriverInterface>;
44
/**
55
* ObjectQL
66
* Copyright (c) 2026-present ObjectStack Inc.
@@ -258,7 +258,7 @@ export class ExcelDriver extends MemoryDriver {
258258
await workbook.xlsx.readFile(filePath);
259259
this.workbooks.set(objectName, workbook);
260260
this.loadDataFromWorkbookForObject(workbook, objectName);
261-
} catch (error) {
261+
} catch (_error) {
262262
// Error silently ignored
263263
}
264264
this.releaseLock(filePath);

packages/drivers/excel/test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ describe('ExcelDriver', () => {
715715
it('should execute bulkDelete command', async () => {
716716
const user1 = await driver.create(TEST_OBJECT, { name: 'Alice' });
717717
const user2 = await driver.create(TEST_OBJECT, { name: 'Bob' });
718-
const user3 = await driver.create(TEST_OBJECT, { name: 'Charlie' });
718+
const _user3 = await driver.create(TEST_OBJECT, { name: 'Charlie' });
719719

720720
const result = await driver.executeCommand({
721721
type: 'bulkDelete',

packages/drivers/fs/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Data, System as SystemSpec } from '@objectstack/spec';
1+
import { Data, System as _SystemSpec } from '@objectstack/spec';
22
import { z } from 'zod';
3-
import { QueryAST, SortNode } from '@objectql/types';
4-
type DriverInterface = z.infer<typeof Data.DriverInterface>;
3+
type _DriverInterface = z.infer<typeof Data.DriverInterface>;
54
/**
65
* ObjectQL
76
* Copyright (c) 2026-present ObjectStack Inc.
@@ -160,7 +159,7 @@ export class FileSystemDriver extends MemoryDriver {
160159
return [];
161160
}
162161
return JSON.parse(content);
163-
} catch (error) {
162+
} catch (_error) {
164163
throw new ObjectQLError({
165164
code: 'INVALID_JSON_FORMAT',
166165
message: `Failed to parse ${filePath}: invalid JSON format`

packages/drivers/fs/test/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('FileSystemDriver', () => {
319319
});
320320

321321
test('should handle _id field', async () => {
322-
const result = await driver.create('docs', {
322+
const _result = await driver.create('docs', {
323323
_id: 'mongo-style-id',
324324
title: 'Document'
325325
});
@@ -591,7 +591,7 @@ describe('FileSystemDriver', () => {
591591
test('should execute bulkDelete command', async () => {
592592
const user1 = await driver.create('users', { name: 'Alice' });
593593
const user2 = await driver.create('users', { name: 'Bob' });
594-
const user3 = await driver.create('users', { name: 'Charlie' });
594+
const _user3 = await driver.create('users', { name: 'Charlie' });
595595

596596
const result = await driver.executeCommand({
597597
type: 'bulkDelete',

packages/drivers/memory/src/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Data, System as SystemSpec } from '@objectstack/spec';
1+
import { Data, System as _SystemSpec } from '@objectstack/spec';
22
import { z } from 'zod';
3-
import { QueryAST, SortNode } from '@objectql/types';
4-
type DriverInterface = z.infer<typeof Data.DriverInterface>;
3+
import { QueryAST } from '@objectql/types';
4+
type _DriverInterface = z.infer<typeof Data.DriverInterface>;
55
/**
66
* ObjectQL
77
* Copyright (c) 2026-present ObjectStack Inc.
@@ -181,7 +181,7 @@ export class MemoryDriver implements Driver {
181181
* Find multiple records matching the query criteria.
182182
* Supports filtering, sorting, pagination, and field projection using Mingo.
183183
*/
184-
async find(objectName: string, query: any = {}, options?: any): Promise<any[]> {
184+
async find(objectName: string, query: any = {}, _options?: any): Promise<any[]> {
185185
// Get all records for this object type
186186
const pattern = `${objectName}:`;
187187
let records: any[] = [];
@@ -245,7 +245,7 @@ export class MemoryDriver implements Driver {
245245
/**
246246
* Create a new record.
247247
*/
248-
async create(objectName: string, data: any, options?: any): Promise<any> {
248+
async create(objectName: string, data: any, _options?: any): Promise<any> {
249249
// Generate ID if not provided
250250
const id = data.id || this.generateId(objectName);
251251
const key = `${objectName}:${id}`;
@@ -278,7 +278,7 @@ export class MemoryDriver implements Driver {
278278
/**
279279
* Update an existing record.
280280
*/
281-
async update(objectName: string, id: string | number, data: any, options?: any): Promise<any> {
281+
async update(objectName: string, id: string | number, data: any, _options?: any): Promise<any> {
282282
const key = `${objectName}:${id}`;
283283
const existing = this.store.get(key);
284284

@@ -312,7 +312,7 @@ export class MemoryDriver implements Driver {
312312
/**
313313
* Delete a record.
314314
*/
315-
async delete(objectName: string, id: string | number, options?: any): Promise<any> {
315+
async delete(objectName: string, id: string | number, _options?: any): Promise<any> {
316316
const key = `${objectName}:${id}`;
317317
const deleted = this.store.delete(key);
318318

@@ -335,7 +335,7 @@ export class MemoryDriver implements Driver {
335335
/**
336336
* Count records matching filters using Mingo.
337337
*/
338-
async count(objectName: string, filters: any, options?: any): Promise<number> {
338+
async count(objectName: string, filters: any, _options?: any): Promise<number> {
339339
const pattern = `${objectName}:`;
340340

341341
// Extract where condition from query object if needed
@@ -371,7 +371,7 @@ export class MemoryDriver implements Driver {
371371
/**
372372
* Get distinct values for a field using Mingo.
373373
*/
374-
async distinct(objectName: string, field: string, filters?: any, options?: any): Promise<any[]> {
374+
async distinct(objectName: string, field: string, filters?: any, _options?: any): Promise<any[]> {
375375
const pattern = `${objectName}:`;
376376

377377
// Get all records for this object type
@@ -418,7 +418,7 @@ export class MemoryDriver implements Driver {
418418
/**
419419
* Update multiple records matching filters using Mingo.
420420
*/
421-
async updateMany(objectName: string, filters: any, data: any, options?: any): Promise<any> {
421+
async updateMany(objectName: string, filters: any, data: any, _options?: any): Promise<any> {
422422
const pattern = `${objectName}:`;
423423

424424
// Get all records for this object type
@@ -464,7 +464,7 @@ export class MemoryDriver implements Driver {
464464
/**
465465
* Delete multiple records matching filters using Mingo.
466466
*/
467-
async deleteMany(objectName: string, filters: any, options?: any): Promise<any> {
467+
async deleteMany(objectName: string, filters: any, _options?: any): Promise<any> {
468468
const pattern = `${objectName}:`;
469469

470470
// Get all records for this object type
@@ -550,7 +550,7 @@ export class MemoryDriver implements Driver {
550550
* { $group: { _id: null, avgPrice: { $avg: '$price' } } }
551551
* ]);
552552
*/
553-
async aggregate(objectName: string, pipeline: any[], options?: any): Promise<any[]> {
553+
async aggregate(objectName: string, pipeline: any[], _options?: any): Promise<any[]> {
554554
const pattern = `${objectName}:`;
555555

556556
// Get all records for this object type
@@ -675,7 +675,7 @@ export class MemoryDriver implements Driver {
675675
}
676676
}
677677
}
678-
} catch (error) {
678+
} catch (_error) {
679679
// Error silently ignored
680680
}
681681

@@ -703,7 +703,7 @@ export class MemoryDriver implements Driver {
703703
};
704704

705705
fs.writeFileSync(this.config.persistence.filePath, JSON.stringify(data, null, 2), 'utf8');
706-
} catch (error) {
706+
} catch (_error) {
707707
// Error silently ignored
708708
}
709709
}
@@ -839,7 +839,7 @@ export class MemoryDriver implements Driver {
839839
}
840840

841841
// Process the filter array to build MongoDB query
842-
const conditions: Record<string, any>[] = [];
842+
const _conditions: Record<string, any>[] = [];
843843
let currentLogic: 'and' | 'or' = 'and';
844844
const logicGroups: { logic: 'and' | 'or', conditions: Record<string, any>[] }[] = [
845845
{ logic: 'and', conditions: [] }
@@ -1183,7 +1183,7 @@ export class MemoryDriver implements Driver {
11831183
* @param parameters - Command parameters
11841184
* @param options - Execution options
11851185
*/
1186-
async execute(command: any, parameters?: any[], options?: any): Promise<any> {
1186+
async execute(_command: any, _parameters?: any[], _options?: any): Promise<any> {
11871187
// For memory driver, this is primarily for compatibility
11881188
// We don't support raw SQL/commands
11891189
throw new ObjectQLError({ code: 'DRIVER_UNSUPPORTED_OPERATION', message: 'Memory driver does not support raw command execution. Use executeCommand() instead.' });

packages/drivers/memory/test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ describe('MemoryDriver', () => {
484484
if (fs.existsSync(testFilePath)) {
485485
fs.unlinkSync(testFilePath);
486486
}
487-
} catch (e) {
487+
} catch (_e) {
488488
// Ignore errors
489489
}
490490
});

packages/drivers/mongo/src/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Data, System as SystemSpec } from '@objectstack/spec';
1+
import { Data, System as _SystemSpec } from '@objectstack/spec';
22
import { z } from 'zod';
3-
import { QueryAST, SortNode } from '@objectql/types';
4-
type DriverInterface = z.infer<typeof Data.DriverInterface>;
3+
import { QueryAST } from '@objectql/types';
4+
type _DriverInterface = z.infer<typeof Data.DriverInterface>;
55
/**
66
* ObjectQL
77
* Copyright (c) 2026-present ObjectStack Inc.
@@ -119,7 +119,7 @@ export class MongoDriver implements Driver {
119119
if (!this.db) return false;
120120
await this.db.admin().ping();
121121
return true;
122-
} catch (error) {
122+
} catch (_error) {
123123
return false;
124124
}
125125
}
@@ -336,7 +336,7 @@ export class MongoDriver implements Driver {
336336
* QueryAST sort is array of {field, order}, while UnifiedQuery is array of [field, order].
337337
* QueryAST uses 'aggregations', while legacy uses 'aggregate'.
338338
*/
339-
async find(objectName: string, query: any, options?: any): Promise<any[]> {
339+
async find(objectName: string, query: any, _options?: any): Promise<any[]> {
340340
const collection = await this.getCollection(objectName);
341341

342342
// Handle both new format (where) and legacy format (filters)
@@ -486,7 +486,7 @@ export class MongoDriver implements Driver {
486486
return result.deletedCount;
487487
}
488488

489-
async count(objectName: string, filters: any, options?: any): Promise<number> {
489+
async count(objectName: string, filters: any, _options?: any): Promise<number> {
490490
const collection = await this.getCollection(objectName);
491491
// Handle both filter objects and query objects
492492
let actualFilters = filters;
@@ -524,7 +524,7 @@ export class MongoDriver implements Driver {
524524
const filter = this.mapFilters(filters);
525525

526526
// Remove 'id' field from update data as it shouldn't be updated
527-
const { id: idToIgnore, ...updateData } = data;
527+
const { id: _idToIgnore, ...updateData } = data;
528528

529529
const isAtomic = Object.keys(updateData).some(k => k.startsWith('$'));
530530
const update = isAtomic ? updateData : { $set: updateData };
@@ -548,7 +548,7 @@ export class MongoDriver implements Driver {
548548
return { deletedCount: result.deletedCount };
549549
}
550550

551-
async aggregate(objectName: string, pipeline: any[], options?: any): Promise<any[]> {
551+
async aggregate(objectName: string, pipeline: any[], _options?: any): Promise<any[]> {
552552
const collection = await this.getCollection(objectName);
553553
const results = await collection.aggregate(pipeline).toArray();
554554
// Map MongoDB documents to API format (convert _id to id)
@@ -563,7 +563,7 @@ export class MongoDriver implements Driver {
563563
* @param options - Optional query options
564564
* @returns Array of distinct values
565565
*/
566-
async distinct(objectName: string, field: string, filters?: any, options?: any): Promise<any[]> {
566+
async distinct(objectName: string, field: string, filters?: any, _options?: any): Promise<any[]> {
567567
const collection = await this.getCollection(objectName);
568568

569569
// Convert ObjectQL filters to MongoDB query format
@@ -689,7 +689,7 @@ export class MongoDriver implements Driver {
689689

690690
async disconnect() {
691691
// Close all active change streams
692-
for (const [streamId, stream] of this.changeStreams.entries()) {
692+
for (const [_streamId, stream] of this.changeStreams.entries()) {
693693
await stream.close();
694694
}
695695
this.changeStreams.clear();
@@ -755,7 +755,7 @@ export class MongoDriver implements Driver {
755755
changeStream.on('change', async (change) => {
756756
try {
757757
await handler(change);
758-
} catch (error) {
758+
} catch (_error) {
759759
// Error silently ignored
760760
}
761761
});

packages/drivers/mongo/test/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import { MongoDriver } from '../src';
10-
import { MongoClient } from 'mongodb';
1110
import { vi } from 'vitest';
1211

1312
const mockCollection = {

packages/drivers/mongo/test/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('MongoDriver Integration Tests', () => {
8989
// Driver doesn't have dropDatabase.
9090
// Use the client we created in beforeAll
9191
await client.db(dbName).dropDatabase();
92-
} catch (e) {
92+
} catch (_e) {
9393
// Ignore cleanup errors
9494
}
9595
});

packages/drivers/mongo/test/queryast.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import { MongoDriver } from '../src';
10-
import { MongoClient } from 'mongodb';
1110
import { vi } from 'vitest';
1211

1312
// Mock data
@@ -289,7 +288,7 @@ describe('MongoDriver (QueryAST Format)', () => {
289288
filters: [['id', '=', '1']],
290289
fields: ['id', 'name']
291290
};
292-
const results = await driver.find('products', query);
291+
const _results = await driver.find('products', query);
293292

294293
expect(mockCollection.find).toHaveBeenCalledWith(
295294
{ _id: '1' },

0 commit comments

Comments
 (0)