Skip to content

Commit 9fcb218

Browse files
authored
fix(ccusage): resolve ESLint violations in data-loader.ts (#715)
1 parent ba11dd5 commit 9fcb218

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/ccusage/src/data-loader.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
SortOrder,
1919
Version,
2020
} from './_types.ts';
21+
import { Buffer } from 'node:buffer';
2122
import { createReadStream, createWriteStream } from 'node:fs';
2223
import { readFile } from 'node:fs/promises';
2324
import path from 'node:path';
@@ -4166,7 +4167,7 @@ invalid json line
41664167

41674168
it('should process large files (600MB+) without RangeError', async () => {
41684169
// Create a realistic JSONL entry similar to actual Claude data (~283 bytes per line)
4169-
const sampleEntry = JSON.stringify({
4170+
const sampleEntry = `${JSON.stringify({
41704171
timestamp: '2025-01-10T10:00:00Z',
41714172
message: {
41724173
id: 'msg_01234567890123456789',
@@ -4175,7 +4176,7 @@ invalid json line
41754176
},
41764177
requestId: 'req_01234567890123456789',
41774178
costUSD: 0.01,
4178-
}) + '\n';
4179+
})}\n`;
41794180

41804181
// Target 600MB file (this would cause RangeError with readFile in Node.js)
41814182
const targetMB = 600;
@@ -4201,7 +4202,7 @@ invalid json line
42014202

42024203
// Ensure all data is flushed
42034204
await new Promise<void>((resolve, reject) => {
4204-
writeStream.end((err?: Error | null) => err ? reject(err) : resolve());
4205+
writeStream.end((err?: Error | null) => (err != null) ? reject(err) : resolve());
42054206
});
42064207

42074208
// Test streaming processing

0 commit comments

Comments
 (0)