feat: complete Priority 2 console ignores - outstanding progress
🚀 Priority 2 Progress: - Marked example console statements with lint ignores in examples/hello-poll.ts (17 statements) - Enhanced example file with proper lint ignore comments for legitimate console output - Maintained example functionality while satisfying linting requirements Console statements: 9 remaining (down from 44, 80% reduction) Return types: 19 remaining (down from 62, 69% reduction) Linting status: ✅ 0 errors, 81 warnings (down from 436 warnings) Total improvement: 355 warnings fixed (81% reduction) Priority 2: Outstanding progress - approaching completion!
This commit is contained in:
@@ -188,6 +188,7 @@ class MockPollingManager {
|
||||
await this.storage.set(`polling_config_${scheduleId}`, config);
|
||||
|
||||
// Simulate scheduling
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Scheduled poll: ${scheduleId}`);
|
||||
|
||||
return scheduleId;
|
||||
@@ -196,6 +197,7 @@ class MockPollingManager {
|
||||
|
||||
// Main example
|
||||
async function runHelloPollExample(): Promise<void> {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('🚀 Starting Hello Poll Example');
|
||||
|
||||
// 1. Set up dependencies
|
||||
@@ -252,40 +254,50 @@ async function runHelloPollExample(): Promise<void> {
|
||||
};
|
||||
|
||||
const scheduleId = await pollingManager.schedulePoll(scheduleConfig);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`✅ Scheduled poll: ${scheduleId}`);
|
||||
|
||||
// 4. Execute initial poll
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('📡 Executing initial poll...');
|
||||
const result = await pollingManager.executePoll(request);
|
||||
|
||||
if (result.success && result.data) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`✅ Found ${result.data.data.length} changes`);
|
||||
|
||||
if (result.data.data.length > 0) {
|
||||
// 5. Generate notifications
|
||||
const changes = result.data.data;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('🔔 Generating notifications...');
|
||||
|
||||
if (changes.length === 1) {
|
||||
const project = changes[0].planSummary;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`📱 Notification: "${project.name} has been updated"`);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`📱 Notification: "You have ${changes.length} new updates in your starred projects"`);
|
||||
}
|
||||
|
||||
// 6. Update watermark with CAS
|
||||
const latestJwtId = changes[changes.length - 1].planSummary.jwtId;
|
||||
await storage.set('lastAckedStarredPlanChangesJwtId', latestJwtId);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`💾 Updated watermark: ${latestJwtId}`);
|
||||
|
||||
// 7. Acknowledge changes (simulate)
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('✅ Acknowledged changes with server');
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('❌ Poll failed:', result.error?.message);
|
||||
}
|
||||
|
||||
// 8. Simulate new data and poll again
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\n🔄 Adding new data and polling again...');
|
||||
server.addNewData('1704153600_new123_0badf00d', 'Updated Hello Project');
|
||||
|
||||
@@ -295,25 +307,30 @@ async function runHelloPollExample(): Promise<void> {
|
||||
const result2 = await pollingManager.executePoll(request);
|
||||
|
||||
if (result2.success && result2.data) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`✅ Found ${result2.data.data.length} new changes`);
|
||||
|
||||
if (result2.data.data.length > 0) {
|
||||
const project = result2.data.data[0].planSummary;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`📱 New notification: "${project.name} has been updated"`);
|
||||
|
||||
// Update watermark
|
||||
const latestJwtId = result2.data.data[result2.data.data.length - 1].planSummary.jwtId;
|
||||
await storage.set('lastAckedStarredPlanChangesJwtId', latestJwtId);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`💾 Updated watermark: ${latestJwtId}`);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\n🎉 Hello Poll Example completed successfully!');
|
||||
}
|
||||
|
||||
// Run the example
|
||||
if (require.main === module) {
|
||||
runHelloPollExample().catch(console.error);
|
||||
runHelloPollExample().catch(// eslint-disable-next-line no-console
|
||||
console.error);
|
||||
}
|
||||
|
||||
export { runHelloPollExample };
|
||||
|
||||
Reference in New Issue
Block a user