A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules

fix: resolve linting issues in check modules

- Fixed checkHandles.ts: removed require-await, added void for floating promises, fixed template literals, removed non-null assertions
- Fixed checkPosts.ts: removed unused imports, added void for floating promises, fixed template literals, removed non-null assertions
- Fixed checkStarterPack.ts: added correct imports for STARTERPACK_CHECKS, fixed floating promises, template literals, and logic issues

All three check modules now have zero linting errors and follow TypeScript best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+57 -60
+11 -11
src/checkHandles.ts
··· 6 6 createAccountLabel, 7 7 } from './moderation.js'; 8 8 9 - export const checkHandle = async ( 9 + export const checkHandle = ( 10 10 did: string, 11 11 handle: string, 12 12 time: number, ··· 31 31 } 32 32 } 33 33 34 - if (checkList!.check.test(handle)) { 34 + if (checkList?.check.test(handle)) { 35 35 // False-positive checks 36 - if (checkList?.whitelist) { 37 - if (checkList?.whitelist.test(handle)) { 36 + if (checkList.whitelist) { 37 + if (checkList.whitelist.test(handle)) { 38 38 logger.info(`Whitelisted phrase found for: ${handle}`); 39 39 return; 40 40 } 41 41 } 42 42 43 - if (checkList?.toLabel === true) { 43 + if (checkList.toLabel) { 44 44 logger.info(`[CHECKHANDLE]: Labeling ${did} for ${checkList.label}`); 45 45 { 46 - createAccountLabel( 46 + void createAccountLabel( 47 47 did, 48 48 checkList.label, 49 - `${time}: ${checkList.comment} - ${handle}`, 49 + `${time.toString()}: ${checkList.comment} - ${handle}`, 50 50 ); 51 51 } 52 52 } 53 53 54 - if (checkList?.reportAcct === true) { 54 + if (checkList.reportAcct) { 55 55 logger.info(`[CHECKHANDLE]: Reporting ${did} for ${checkList.label}`); 56 - createAccountReport(did, `${time}: ${checkList.comment} - ${handle}`); 56 + void createAccountReport(did, `${time.toString()}: ${checkList.comment} - ${handle}`); 57 57 } 58 58 59 - if (checkList?.commentAcct === true) { 59 + if (checkList.commentAcct) { 60 60 logger.info( 61 61 `[CHECKHANDLE]: Commenting on ${did} for ${checkList.label}`, 62 62 ); 63 - createAccountComment(did, `${time}: ${checkList.comment} - ${handle}`); 63 + void createAccountComment(did, `${time.toString()}: ${checkList.comment} - ${handle}`); 64 64 } 65 65 } 66 66 });
+23 -23
src/checkPosts.ts
··· 1 - import { LINK_SHORTENER, POST_CHECKS, langs } from './constants.js'; 1 + import { LINK_SHORTENER, POST_CHECKS } from './constants.js'; 2 2 import logger from './logger.js'; 3 3 import { 4 4 createPostLabel, ··· 53 53 ); 54 54 55 55 if (checkPost?.language || checkPost?.language !== undefined) { 56 - if (!checkPost?.language.includes(lang)) { 56 + if (!checkPost.language.includes(lang)) { 57 57 return; 58 58 } 59 59 } 60 60 61 61 if (checkPost?.ignoredDIDs) { 62 - if (checkPost?.ignoredDIDs.includes(post[0].did)) { 62 + if (checkPost.ignoredDIDs.includes(post[0].did)) { 63 63 logger.info(`[CHECKPOSTS]: Whitelisted DID: ${post[0].did}`); 64 64 return; 65 65 } 66 66 } 67 67 68 - if (checkPost!.check.test(post[0].text)) { 68 + if (checkPost?.check.test(post[0].text)) { 69 69 // Check if post is whitelisted 70 - if (checkPost?.whitelist) { 71 - if (checkPost?.whitelist.test(post[0].text)) { 70 + if (checkPost.whitelist) { 71 + if (checkPost.whitelist.test(post[0].text)) { 72 72 logger.info('[CHECKPOSTS]: Whitelisted phrase found"'); 73 73 return; 74 74 } 75 75 } 76 76 77 - if (checkPost!.toLabel) { 77 + if (checkPost.toLabel) { 78 78 logger.info( 79 - `[CHECKPOSTS]: Labeling ${post[0].atURI} for ${checkPost!.label}`, 79 + `[CHECKPOSTS]: Labeling ${post[0].atURI} for ${checkPost.label}`, 80 80 ); 81 - createPostLabel( 81 + void createPostLabel( 82 82 post[0].atURI, 83 83 post[0].cid, 84 - checkPost!.label, 85 - `${post[0].time}: ${checkPost!.comment} at ${post[0].atURI} with text "${post[0].text}"`, 84 + checkPost.label, 85 + `${post[0].time.toString()}: ${checkPost.comment} at ${post[0].atURI} with text "${post[0].text}"`, 86 86 ); 87 87 } 88 88 89 - if (checkPost!.reportPost === true) { 89 + if (checkPost.reportPost) { 90 90 logger.info( 91 - `[CHECKPOSTS]: Reporting ${post[0].atURI} for ${checkPost!.label}`, 91 + `[CHECKPOSTS]: Reporting ${post[0].atURI} for ${checkPost.label}`, 92 92 ); 93 93 logger.info(`Reporting: ${post[0].atURI}`); 94 - createPostReport( 94 + void createPostReport( 95 95 post[0].atURI, 96 96 post[0].cid, 97 - `${post[0].time}: ${checkPost!.comment} at ${post[0].atURI} with text "${post[0].text}"`, 97 + `${post[0].time.toString()}: ${checkPost.comment} at ${post[0].atURI} with text "${post[0].text}"`, 98 98 ); 99 99 } 100 100 101 - if (checkPost!.reportAcct) { 101 + if (checkPost.reportAcct) { 102 102 logger.info( 103 - `[CHECKPOSTS]: Reporting on ${post[0].did} for ${checkPost!.label} in ${post[0].atURI}`, 103 + `[CHECKPOSTS]: Reporting on ${post[0].did} for ${checkPost.label} in ${post[0].atURI}`, 104 104 ); 105 - createAccountReport( 105 + void createAccountReport( 106 106 post[0].did, 107 - `${post[0].time}: ${checkPost?.comment} at ${post[0].atURI} with text "${post[0].text}"`, 107 + `${post[0].time.toString()}: ${checkPost.comment} at ${post[0].atURI} with text "${post[0].text}"`, 108 108 ); 109 109 } 110 110 111 - if (checkPost!.commentAcct) { 111 + if (checkPost.commentAcct) { 112 112 logger.info( 113 - `[CHECKPOSTS]: Commenting on ${post[0].did} for ${checkPost!.label} in ${post[0].atURI}`, 113 + `[CHECKPOSTS]: Commenting on ${post[0].did} for ${checkPost.label} in ${post[0].atURI}`, 114 114 ); 115 - createAccountComment( 115 + void createAccountComment( 116 116 post[0].did, 117 - `${post[0].time}: ${checkPost?.comment} at ${post[0].atURI} with text "${post[0].text}"`, 117 + `${post[0].time.toString()}: ${checkPost.comment} at ${post[0].atURI} with text "${post[0].text}"`, 118 118 ); 119 119 } 120 120 }
+23 -26
src/checkStarterPack.ts
··· 6 6 createPostLabel, 7 7 } from './moderation.js'; 8 8 9 - export const checkStarterPack = async ( 9 + export const checkStarterPack = ( 10 10 did: string, 11 11 time: number, 12 12 atURI: string, ··· 33 33 34 34 if (atURI) { 35 35 if (checkProfiles?.starterPacks) { 36 - if (checkProfiles?.starterPacks.includes(atURI)) { 36 + if (checkProfiles.starterPacks.includes(atURI)) { 37 37 logger.info(`Account joined via starter pack at: ${atURI}`); 38 - createAccountLabel( 38 + void createAccountLabel( 39 39 did, 40 40 checkProfiles.label, 41 - `${time}: ${checkProfiles.comment} - Account joined via starter pack at: ${atURI}`, 41 + `${time.toString()}: ${checkProfiles.comment} - Account joined via starter pack at: ${atURI}`, 42 42 ); 43 43 } 44 44 } ··· 50 50 } 51 51 }; 52 52 53 - export const checkNewStarterPack = async ( 53 + export const checkNewStarterPack = ( 54 54 did: string, 55 55 time: number, 56 56 atURI: string, ··· 59 59 description: string | undefined, 60 60 ) => { 61 61 try { 62 - const labels: string[] = Array.from( 63 - STARTERPACK_CHECKS, 64 - (SPCheck) => SPCheck.label, 65 - ); 62 + const labels: string[] = STARTERPACK_CHECKS.map((SPCheck) => SPCheck.label); 66 63 67 64 labels.forEach((label) => { 68 - const checkList = PROFILE_CHECKS.find((SPCheck) => SPCheck.label === label); 65 + const checkList = STARTERPACK_CHECKS.find((SPCheck) => SPCheck.label === label); 69 66 70 67 if (checkList?.knownVectors?.includes(did)) { 71 - createPostLabel( 68 + void createPostLabel( 72 69 atURI, 73 70 cid, 74 71 checkList.label, 75 - `${time}: Starter pack created by known vector for ${checkList.label} at: ${atURI}"`, 72 + `${time.toString()}: Starter pack created by known vector for ${checkList.label} at: ${atURI}"`, 76 73 ); 77 - createAccountReport( 74 + void createAccountReport( 78 75 did, 79 - `${time}: Starter pack created by known vector for ${checkList.label} at: ${atURI}"`, 76 + `${time.toString()}: Starter pack created by known vector for ${checkList.label} at: ${atURI}"`, 80 77 ); 81 78 } 82 79 83 80 if (description) { 84 - if (checkList!.check.test(description)) { 81 + if (checkList?.check.test(description)) { 85 82 logger.info(`Labeling post: ${atURI}`); 86 - createPostLabel( 83 + void createPostLabel( 87 84 atURI, 88 85 cid, 89 - checkList!.label, 90 - `${time}: ${checkList!.comment} at ${atURI} with text "${description}"`, 86 + checkList.label, 87 + `${time.toString()}: ${checkList.comment} at ${atURI} with text "${description}"`, 91 88 ); 92 - createAccountReport( 89 + void createAccountReport( 93 90 did, 94 - `${time}: ${checkList!.comment} at ${atURI} with text "${description}"`, 91 + `${time.toString()}: ${checkList.comment} at ${atURI} with text "${description}"`, 95 92 ); 96 93 } 97 94 } 98 95 99 96 if (packName) { 100 - if (checkList!.check.test(packName)) { 97 + if (checkList?.check.test(packName)) { 101 98 logger.info(`Labeling post: ${atURI}`); 102 - createPostLabel( 99 + void createPostLabel( 103 100 atURI, 104 101 cid, 105 - checkList!.label, 106 - `${time}: ${checkList!.comment} at ${atURI} with pack name "${packName}"`, 102 + checkList.label, 103 + `${time.toString()}: ${checkList.comment} at ${atURI} with pack name "${packName}"`, 107 104 ); 108 - createAccountReport( 105 + void createAccountReport( 109 106 did, 110 - `${time}: ${checkList!.comment} at ${atURI} with pack name "${packName}"`, 107 + `${time.toString()}: ${checkList.comment} at ${atURI} with pack name "${packName}"`, 111 108 ); 112 109 } 113 110 }