a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
99
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: enable curly rule

Mary 5ebe199e 62d38e96

+271 -90
+1
.oxlintrc.json
··· 7 7 "perf": "warn" 8 8 }, 9 9 "rules": { 10 + "curly": "warn", 10 11 "no-await-in-loop": "off", 11 12 "no-shadow": "off", 12 13 "unicorn/prefer-add-event-listener": "off"
+3 -1
packages/lexicons/lexicons/lib/syntax/handle.ts
··· 19 19 } 20 20 21 21 if (len > 1) { 22 - if (!isAsciiAlphaNum(input.charCodeAt(end - 1))) return false; 22 + if (!isAsciiAlphaNum(input.charCodeAt(end - 1))) { 23 + return false; 24 + } 23 25 for (let j = start + 1; j < end - 1; j++) { 24 26 const c = input.charCodeAt(j); 25 27 if (!isAsciiAlphaNum(c) && c !== 0x2d) {
+81 -27
packages/misc/uint8array/lib/index.bun.ts
··· 62 62 const _shortString = (from: Uint8Array, p: number, length: number): string | null => { 63 63 if (length < 4) { 64 64 if (length < 2) { 65 - if (length === 0) return ''; 65 + if (length === 0) { 66 + return ''; 67 + } 66 68 const a = from[p]; 67 - if (a & 0x80) return null; 69 + if (a & 0x80) { 70 + return null; 71 + } 68 72 return _fromCharCode(a); 69 73 } 70 74 const a = from[p]; 71 75 const b = from[p + 1]; 72 - if ((a | b) & 0x80) return null; 73 - if (length === 2) return _fromCharCode(a, b); 76 + if ((a | b) & 0x80) { 77 + return null; 78 + } 79 + if (length === 2) { 80 + return _fromCharCode(a, b); 81 + } 74 82 const c = from[p + 2]; 75 - if (c & 0x80) return null; 83 + if (c & 0x80) { 84 + return null; 85 + } 76 86 return _fromCharCode(a, b, c); 77 87 } 78 88 const a = from[p]; 79 89 const b = from[p + 1]; 80 90 const c = from[p + 2]; 81 91 const d = from[p + 3]; 82 - if ((a | b | c | d) & 0x80) return null; 92 + if ((a | b | c | d) & 0x80) { 93 + return null; 94 + } 83 95 if (length < 8) { 84 - if (length === 4) return _fromCharCode(a, b, c, d); 96 + if (length === 4) { 97 + return _fromCharCode(a, b, c, d); 98 + } 85 99 const e = from[p + 4]; 86 - if (e & 0x80) return null; 87 - if (length === 5) return _fromCharCode(a, b, c, d, e); 100 + if (e & 0x80) { 101 + return null; 102 + } 103 + if (length === 5) { 104 + return _fromCharCode(a, b, c, d, e); 105 + } 88 106 const f = from[p + 5]; 89 - if (f & 0x80) return null; 90 - if (length === 6) return _fromCharCode(a, b, c, d, e, f); 107 + if (f & 0x80) { 108 + return null; 109 + } 110 + if (length === 6) { 111 + return _fromCharCode(a, b, c, d, e, f); 112 + } 91 113 const g = from[p + 6]; 92 - if (g & 0x80) return null; 114 + if (g & 0x80) { 115 + return null; 116 + } 93 117 return _fromCharCode(a, b, c, d, e, f, g); 94 118 } 95 119 const e = from[p + 4]; 96 120 const f = from[p + 5]; 97 121 const g = from[p + 6]; 98 122 const h = from[p + 7]; 99 - if ((e | f | g | h) & 0x80) return null; 123 + if ((e | f | g | h) & 0x80) { 124 + return null; 125 + } 100 126 if (length < 12) { 101 - if (length === 8) return _fromCharCode(a, b, c, d, e, f, g, h); 127 + if (length === 8) { 128 + return _fromCharCode(a, b, c, d, e, f, g, h); 129 + } 102 130 const i = from[p + 8]; 103 - if (i & 0x80) return null; 104 - if (length === 9) return _fromCharCode(a, b, c, d, e, f, g, h, i); 131 + if (i & 0x80) { 132 + return null; 133 + } 134 + if (length === 9) { 135 + return _fromCharCode(a, b, c, d, e, f, g, h, i); 136 + } 105 137 const j = from[p + 9]; 106 - if (j & 0x80) return null; 107 - if (length === 10) return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 138 + if (j & 0x80) { 139 + return null; 140 + } 141 + if (length === 10) { 142 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 143 + } 108 144 const k = from[p + 10]; 109 - if (k & 0x80) return null; 145 + if (k & 0x80) { 146 + return null; 147 + } 110 148 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k); 111 149 } 112 150 const i = from[p + 8]; 113 151 const j = from[p + 9]; 114 152 const k = from[p + 10]; 115 153 const l = from[p + 11]; 116 - if ((i | j | k | l) & 0x80) return null; 117 - if (length === 12) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 154 + if ((i | j | k | l) & 0x80) { 155 + return null; 156 + } 157 + if (length === 12) { 158 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 159 + } 118 160 const m = from[p + 12]; 119 - if (m & 0x80) return null; 120 - if (length === 13) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 161 + if (m & 0x80) { 162 + return null; 163 + } 164 + if (length === 13) { 165 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 166 + } 121 167 const n = from[p + 13]; 122 - if (n & 0x80) return null; 123 - if (length === 14) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 168 + if (n & 0x80) { 169 + return null; 170 + } 171 + if (length === 14) { 172 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 173 + } 124 174 const o = from[p + 14]; 125 - if (o & 0x80) return null; 175 + if (o & 0x80) { 176 + return null; 177 + } 126 178 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); 127 179 }; 128 180 ··· 140 192 ): string => { 141 193 if (length <= 15) { 142 194 const result = _shortString(from, offset, length); 143 - if (result !== null) return result; 195 + if (result !== null) { 196 + return result; 197 + } 144 198 } 145 199 return _utf8Slice.call(from, offset, offset + length); 146 200 };
+81 -27
packages/misc/uint8array/lib/index.node.ts
··· 60 60 const _shortString = (from: Uint8Array, p: number, length: number): string | null => { 61 61 if (length < 4) { 62 62 if (length < 2) { 63 - if (length === 0) return ''; 63 + if (length === 0) { 64 + return ''; 65 + } 64 66 const a = from[p]; 65 - if (a & 0x80) return null; 67 + if (a & 0x80) { 68 + return null; 69 + } 66 70 return _fromCharCode(a); 67 71 } 68 72 const a = from[p]; 69 73 const b = from[p + 1]; 70 - if ((a | b) & 0x80) return null; 71 - if (length === 2) return _fromCharCode(a, b); 74 + if ((a | b) & 0x80) { 75 + return null; 76 + } 77 + if (length === 2) { 78 + return _fromCharCode(a, b); 79 + } 72 80 const c = from[p + 2]; 73 - if (c & 0x80) return null; 81 + if (c & 0x80) { 82 + return null; 83 + } 74 84 return _fromCharCode(a, b, c); 75 85 } 76 86 const a = from[p]; 77 87 const b = from[p + 1]; 78 88 const c = from[p + 2]; 79 89 const d = from[p + 3]; 80 - if ((a | b | c | d) & 0x80) return null; 90 + if ((a | b | c | d) & 0x80) { 91 + return null; 92 + } 81 93 if (length < 8) { 82 - if (length === 4) return _fromCharCode(a, b, c, d); 94 + if (length === 4) { 95 + return _fromCharCode(a, b, c, d); 96 + } 83 97 const e = from[p + 4]; 84 - if (e & 0x80) return null; 85 - if (length === 5) return _fromCharCode(a, b, c, d, e); 98 + if (e & 0x80) { 99 + return null; 100 + } 101 + if (length === 5) { 102 + return _fromCharCode(a, b, c, d, e); 103 + } 86 104 const f = from[p + 5]; 87 - if (f & 0x80) return null; 88 - if (length === 6) return _fromCharCode(a, b, c, d, e, f); 105 + if (f & 0x80) { 106 + return null; 107 + } 108 + if (length === 6) { 109 + return _fromCharCode(a, b, c, d, e, f); 110 + } 89 111 const g = from[p + 6]; 90 - if (g & 0x80) return null; 112 + if (g & 0x80) { 113 + return null; 114 + } 91 115 return _fromCharCode(a, b, c, d, e, f, g); 92 116 } 93 117 const e = from[p + 4]; 94 118 const f = from[p + 5]; 95 119 const g = from[p + 6]; 96 120 const h = from[p + 7]; 97 - if ((e | f | g | h) & 0x80) return null; 121 + if ((e | f | g | h) & 0x80) { 122 + return null; 123 + } 98 124 if (length < 12) { 99 - if (length === 8) return _fromCharCode(a, b, c, d, e, f, g, h); 125 + if (length === 8) { 126 + return _fromCharCode(a, b, c, d, e, f, g, h); 127 + } 100 128 const i = from[p + 8]; 101 - if (i & 0x80) return null; 102 - if (length === 9) return _fromCharCode(a, b, c, d, e, f, g, h, i); 129 + if (i & 0x80) { 130 + return null; 131 + } 132 + if (length === 9) { 133 + return _fromCharCode(a, b, c, d, e, f, g, h, i); 134 + } 103 135 const j = from[p + 9]; 104 - if (j & 0x80) return null; 105 - if (length === 10) return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 136 + if (j & 0x80) { 137 + return null; 138 + } 139 + if (length === 10) { 140 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 141 + } 106 142 const k = from[p + 10]; 107 - if (k & 0x80) return null; 143 + if (k & 0x80) { 144 + return null; 145 + } 108 146 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k); 109 147 } 110 148 const i = from[p + 8]; 111 149 const j = from[p + 9]; 112 150 const k = from[p + 10]; 113 151 const l = from[p + 11]; 114 - if ((i | j | k | l) & 0x80) return null; 115 - if (length === 12) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 152 + if ((i | j | k | l) & 0x80) { 153 + return null; 154 + } 155 + if (length === 12) { 156 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 157 + } 116 158 const m = from[p + 12]; 117 - if (m & 0x80) return null; 118 - if (length === 13) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 159 + if (m & 0x80) { 160 + return null; 161 + } 162 + if (length === 13) { 163 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 164 + } 119 165 const n = from[p + 13]; 120 - if (n & 0x80) return null; 121 - if (length === 14) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 166 + if (n & 0x80) { 167 + return null; 168 + } 169 + if (length === 14) { 170 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 171 + } 122 172 const o = from[p + 14]; 123 - if (o & 0x80) return null; 173 + if (o & 0x80) { 174 + return null; 175 + } 124 176 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); 125 177 }; 126 178 ··· 138 190 ): string => { 139 191 if (length <= 15) { 140 192 const result = _shortString(from, offset, length); 141 - if (result !== null) return result; 193 + if (result !== null) { 194 + return result; 195 + } 142 196 } 143 197 return _utf8Slice.call(from, offset, offset + length); 144 198 };
+81 -27
packages/misc/uint8array/lib/index.ts
··· 142 142 const _shortString = (from: Uint8Array, p: number, length: number): string | null => { 143 143 if (length < 4) { 144 144 if (length < 2) { 145 - if (length === 0) return ''; 145 + if (length === 0) { 146 + return ''; 147 + } 146 148 const a = from[p]; 147 - if (a & 0x80) return null; 149 + if (a & 0x80) { 150 + return null; 151 + } 148 152 return _fromCharCode(a); 149 153 } 150 154 const a = from[p]; 151 155 const b = from[p + 1]; 152 - if ((a | b) & 0x80) return null; 153 - if (length === 2) return _fromCharCode(a, b); 156 + if ((a | b) & 0x80) { 157 + return null; 158 + } 159 + if (length === 2) { 160 + return _fromCharCode(a, b); 161 + } 154 162 const c = from[p + 2]; 155 - if (c & 0x80) return null; 163 + if (c & 0x80) { 164 + return null; 165 + } 156 166 return _fromCharCode(a, b, c); 157 167 } 158 168 const a = from[p]; 159 169 const b = from[p + 1]; 160 170 const c = from[p + 2]; 161 171 const d = from[p + 3]; 162 - if ((a | b | c | d) & 0x80) return null; 172 + if ((a | b | c | d) & 0x80) { 173 + return null; 174 + } 163 175 if (length < 8) { 164 - if (length === 4) return _fromCharCode(a, b, c, d); 176 + if (length === 4) { 177 + return _fromCharCode(a, b, c, d); 178 + } 165 179 const e = from[p + 4]; 166 - if (e & 0x80) return null; 167 - if (length === 5) return _fromCharCode(a, b, c, d, e); 180 + if (e & 0x80) { 181 + return null; 182 + } 183 + if (length === 5) { 184 + return _fromCharCode(a, b, c, d, e); 185 + } 168 186 const f = from[p + 5]; 169 - if (f & 0x80) return null; 170 - if (length === 6) return _fromCharCode(a, b, c, d, e, f); 187 + if (f & 0x80) { 188 + return null; 189 + } 190 + if (length === 6) { 191 + return _fromCharCode(a, b, c, d, e, f); 192 + } 171 193 const g = from[p + 6]; 172 - if (g & 0x80) return null; 194 + if (g & 0x80) { 195 + return null; 196 + } 173 197 return _fromCharCode(a, b, c, d, e, f, g); 174 198 } 175 199 const e = from[p + 4]; 176 200 const f = from[p + 5]; 177 201 const g = from[p + 6]; 178 202 const h = from[p + 7]; 179 - if ((e | f | g | h) & 0x80) return null; 203 + if ((e | f | g | h) & 0x80) { 204 + return null; 205 + } 180 206 if (length < 12) { 181 - if (length === 8) return _fromCharCode(a, b, c, d, e, f, g, h); 207 + if (length === 8) { 208 + return _fromCharCode(a, b, c, d, e, f, g, h); 209 + } 182 210 const i = from[p + 8]; 183 - if (i & 0x80) return null; 184 - if (length === 9) return _fromCharCode(a, b, c, d, e, f, g, h, i); 211 + if (i & 0x80) { 212 + return null; 213 + } 214 + if (length === 9) { 215 + return _fromCharCode(a, b, c, d, e, f, g, h, i); 216 + } 185 217 const j = from[p + 9]; 186 - if (j & 0x80) return null; 187 - if (length === 10) return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 218 + if (j & 0x80) { 219 + return null; 220 + } 221 + if (length === 10) { 222 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j); 223 + } 188 224 const k = from[p + 10]; 189 - if (k & 0x80) return null; 225 + if (k & 0x80) { 226 + return null; 227 + } 190 228 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k); 191 229 } 192 230 const i = from[p + 8]; 193 231 const j = from[p + 9]; 194 232 const k = from[p + 10]; 195 233 const l = from[p + 11]; 196 - if ((i | j | k | l) & 0x80) return null; 197 - if (length === 12) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 234 + if ((i | j | k | l) & 0x80) { 235 + return null; 236 + } 237 + if (length === 12) { 238 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l); 239 + } 198 240 const m = from[p + 12]; 199 - if (m & 0x80) return null; 200 - if (length === 13) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 241 + if (m & 0x80) { 242 + return null; 243 + } 244 + if (length === 13) { 245 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m); 246 + } 201 247 const n = from[p + 13]; 202 - if (n & 0x80) return null; 203 - if (length === 14) return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 248 + if (n & 0x80) { 249 + return null; 250 + } 251 + if (length === 14) { 252 + return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n); 253 + } 204 254 const o = from[p + 14]; 205 - if (o & 0x80) return null; 255 + if (o & 0x80) { 256 + return null; 257 + } 206 258 return _fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); 207 259 }; 208 260 ··· 220 272 ): string => { 221 273 if (length <= 15) { 222 274 const result = _shortString(from, offset, length); 223 - if (result !== null) return result; 275 + if (result !== null) { 276 + return result; 277 + } 224 278 } 225 279 if (offset === 0 && length === from.length) { 226 280 return textDecoder.decode(from);
+3 -1
packages/servers/xrpc-server/lib/auth/jwt-verifier.test.ts
··· 297 297 const replayStore: ReplayStore = { 298 298 async check({ iss, jti }) { 299 299 const key = `${iss}:${jti}`; 300 - if (seen.has(key)) return false; 300 + if (seen.has(key)) { 301 + return false; 302 + } 301 303 seen.add(key); 302 304 return true; 303 305 },
+18 -6
packages/servers/xrpc-server/lib/main/router.ts
··· 125 125 126 126 #observeError(error: unknown, request: Request): void { 127 127 // client-induced errors are not bugs; skip telemetry 128 - if (request.signal.aborted) return; 129 - if (error instanceof XRPCError) return; 130 - if (error instanceof Response) return; 128 + if (request.signal.aborted) { 129 + return; 130 + } 131 + if (error instanceof XRPCError) { 132 + return; 133 + } 134 + if (error instanceof Response) { 135 + return; 136 + } 131 137 132 138 try { 133 139 this.#onError?.({ error, request }); ··· 137 143 } 138 144 139 145 #observeSocketError(error: unknown, request: Request): void { 140 - if (request.signal.aborted) return; 141 - if (error instanceof XRPCSubscriptionError) return; 146 + if (request.signal.aborted) { 147 + return; 148 + } 149 + if (error instanceof XRPCSubscriptionError) { 150 + return; 151 + } 142 152 143 153 try { 144 154 this.#onSocketError?.({ error, request }); ··· 418 428 const frame = encodeMessageFrame(body, type); 419 429 await ws.send(frame); 420 430 const drained = ws.drain(); 421 - if (drained) await drained; 431 + if (drained) { 432 + await drained; 433 + } 422 434 } 423 435 424 436 ws.close(1000);
+3 -1
packages/utilities/cbor/lib/encode.ts
··· 373 373 writeValue(state, value); 374 374 375 375 const final = state.b.subarray(0, state.p); 376 - if (!state.c.length) return final; 376 + if (!state.c.length) { 377 + return final; 378 + } 377 379 378 380 state.c.push(final); 379 381 return concat(state.c, state.l + state.p);