chore: linting updates
0ecddb26
6 file(s) · +15 −15
| 15 | 15 | "linter": { |
|
| 16 | 16 | "enabled": true, |
|
| 17 | 17 | "rules": { |
|
| 18 | - | "recommended": true |
|
| 18 | + | "recommended": true, |
|
| 19 | + | "style": { |
|
| 20 | + | "noNonNullAssertion": "off" |
|
| 21 | + | } |
|
| 19 | 22 | } |
|
| 20 | 23 | }, |
|
| 21 | 24 | "javascript": { |
| 199 | 199 | ||
| 200 | 200 | const s = spinner(); |
|
| 201 | 201 | s.start("Connecting to ATProto..."); |
|
| 202 | - | let agent; |
|
| 202 | + | let agent: Awaited<ReturnType<typeof createAgent>> | undefined; |
|
| 203 | 203 | try { |
|
| 204 | 204 | agent = await createAgent(credentials); |
|
| 205 | 205 | s.stop("Connected!"); |
|
| 206 | - | } catch (error) { |
|
| 206 | + | } catch (_error) { |
|
| 207 | 207 | s.stop("Failed to connect"); |
|
| 208 | 208 | log.error( |
|
| 209 | 209 | "Failed to connect. Check your credentials with 'sequoia auth'.", |
|
| 288 | 288 | placeholder: "7", |
|
| 289 | 289 | validate: (value) => { |
|
| 290 | 290 | const num = parseInt(value, 10); |
|
| 291 | - | if (isNaN(num) || num < 1) { |
|
| 291 | + | if (Number.isNaN(num) || num < 1) { |
|
| 292 | 292 | return "Please enter a positive number"; |
|
| 293 | 293 | } |
|
| 294 | 294 | }, |
|
| 351 | 351 | if (!gitignoreContent.includes(stateFilename)) { |
|
| 352 | 352 | await fs.writeFile( |
|
| 353 | 353 | gitignorePath, |
|
| 354 | - | gitignoreContent + `\n${stateFilename}\n`, |
|
| 354 | + | `${gitignoreContent}\n${stateFilename}\n`, |
|
| 355 | 355 | ); |
|
| 356 | 356 | log.info(`Added ${stateFilename} to .gitignore`); |
|
| 357 | 357 | } |
|
| 207 | 207 | ||
| 208 | 208 | // Create agent |
|
| 209 | 209 | s.start(`Connecting to ${credentials.pdsUrl}...`); |
|
| 210 | - | let agent; |
|
| 210 | + | let agent: Awaited<ReturnType<typeof createAgent>> | undefined; |
|
| 211 | 211 | try { |
|
| 212 | 212 | agent = await createAgent(credentials); |
|
| 213 | 213 | s.stop(`Logged in as ${agent.session?.handle}`); |
| 73 | 73 | // Create agent |
|
| 74 | 74 | const s = spinner(); |
|
| 75 | 75 | s.start(`Connecting to ${credentials.pdsUrl}...`); |
|
| 76 | - | let agent; |
|
| 76 | + | let agent: Awaited<ReturnType<typeof createAgent>> | undefined; |
|
| 77 | 77 | try { |
|
| 78 | 78 | agent = await createAgent(credentials); |
|
| 79 | 79 | s.stop(`Logged in as ${agent.session?.handle}`); |
| 420 | 420 | const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" }); |
|
| 421 | 421 | const segments = [...segmenter.segment(str)]; |
|
| 422 | 422 | if (segments.length <= maxGraphemes) return str; |
|
| 423 | - | return ( |
|
| 424 | - | segments |
|
| 425 | - | .slice(0, maxGraphemes - 3) |
|
| 426 | - | .map((s) => s.segment) |
|
| 427 | - | .join("") + "..." |
|
| 428 | - | ); |
|
| 423 | + | return `${segments |
|
| 424 | + | .slice(0, maxGraphemes - 3) |
|
| 425 | + | .map((s) => s.segment) |
|
| 426 | + | .join("")}...`; |
|
| 429 | 427 | } |
|
| 430 | 428 | // Fallback |
|
| 431 | 429 | const chars = [...str]; |
|
| 432 | 430 | if (chars.length <= maxGraphemes) return str; |
|
| 433 | - | return chars.slice(0, maxGraphemes - 3).join("") + "..."; |
|
| 431 | + | return `${chars.slice(0, maxGraphemes - 3).join("")}...`; |
|
| 434 | 432 | } |
|
| 435 | 433 | ||
| 436 | 434 | /** |
| 220 | 220 | break; |
|
| 221 | 221 | } |
|
| 222 | 222 | ||
| 223 | - | case "filename": |
|
| 224 | 223 | default: |
|
| 225 | 224 | slug = getSlugFromFilename(path.basename(relativePath)); |
|
| 226 | 225 | break; |