Skip to content

chore(lint): clear final no-unsafe inventory in bot handlers (#1378) - #1385

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
chore/1378-no-unsafe-handlers
Jun 13, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
chore/1378-no-unsafe-handlers

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jun 13, 2026 •

Copy link
Copy Markdown
Owner

Part of #1378 (ratchet tail). Clears the last 16 no-unsafe-* warnings (bot handlers), taking the whole family to 0. Typing-only, no behavior change.

Fixes

  • memberHandler (14 sites, welcome + leave blocks) — embedData came from JSON.parse(...) (any). Cast the parsed result to the shared EmbedData type and pass setTitle(embedData.title || null) to match discord.js's setTitle(string | null).
  • giveaway (2 sites) — typed the require('../../../client') fallback cast. ⚠️ That path is broken (resolves to a non-existent module → throws → silently returns); tracked in giveaway end/reroll silently no-ops: require('../../../client') resolves to a non-existent module #1383. This PR only makes the type honest.

Promotion deferred (was reverted in this branch)

I initially promoted the five no-unsafe-* rules warn → error, but CI's quality / Lint job runs eslint . without db:generate / build:shared, so the type-aware rules emit ~4200 phantom "type could not be resolved" / "error typed" diagnostics across untouched files. At warn those are silent; at error the job goes permanently red. So the rules stay at warn; promotion is gated on #1386 (make CI lint type-aware). See the comment block in eslint.config.js.

Cumulative across #1382/#1384/this PR: 50 no-unsafe-* → 0 (cleared; enforcement pending #1386).

Validation

  • root lint (typed env) exit 0 — 0 errors
  • bot tsc clean (local TS 6.0); 4-workspace tsc clean (pre-commit)
  • full bot suite green (2536 passed)

Lands the no-unsafe-* family at 0 globally and promotes all five rules
warn -> error in the bot+shared ratchet block, so they now guard against
regressions instead of accumulating. Typing-only; no behavior change.

- memberHandler: type the welcome/leave embedData (JSON.parse result) as the
  shared `EmbedData` and pass `setTitle(... || null)` to match its signature.
- giveaway: type the `require('../../../client')` fallback cast; note that the
  path is broken (#1383) so the require throws and the catch returns.

Validation: root lint exit 0 (0 errors, no-unsafe family enforced), bot tsc
clean (local TS 6.0), full bot suite green (2536 passed). Remaining ratchet
warnings: no-non-null-assertion (86, Phase 4) + small core rules.
@vercel

vercel Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Jun 13, 2026 6:05am

Request Review

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@LucasSantana-Dev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 40 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f8fbe05-a342-41d6-ad06-2c873153186b

📥 Commits

Reviewing files that changed from the base of the PR and between b054840 and afa7479.

📒 Files selected for processing (3)
  • eslint.config.js
  • packages/bot/src/functions/general/commands/giveaway.ts
  • packages/bot/src/handlers/memberHandler.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/1378-no-unsafe-handlers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the bot label Jun 13, 2026
@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

@cubic-dev-ai please review

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) June 13, 2026 06:04
@cubic-dev-ai

cubic-dev-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

@cubic-dev-ai please review

@LucasSantana-Dev I have started the AI code review. It will take a few minutes to complete.

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Auto-approved: Clears remaining no-unsafe-* warnings with type casts and promotes rules to error; changes are typing-only with no behavioral impact.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 71f1303 into main Jun 13, 2026
41 of 42 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the chore/1378-no-unsafe-handlers branch June 13, 2026 06:08
@LucasSantana-Dev
LucasSantana-Dev restored the chore/1378-no-unsafe-handlers branch June 13, 2026 06:10
@LucasSantana-Dev LucasSantana-Dev changed the title chore(lint): clear final no-unsafe and enforce the family (#1378) chore(lint): clear final no-unsafe inventory in bot handlers (#1378) Jun 13, 2026
@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

Heads up @cubic-dev-ai — reverted the warn→error promotion in 45df9ad. CI quality / Lint lints without generating Prisma / building shared, so the type-aware no-unsafe-* rules report ~4200 phantom "type could not be resolved" errors there. Kept the rules at warn; promotion is gated on #1386. This PR now just clears the inventory to 0.

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Heads up @cubic-dev-ai — reverted the warn→error promotion in 45df9ad. CI quality / Lint lints without generating Prisma / building shared, so the type-aware no-unsafe-* rules report ~4200 phantom "type could not be resolved" errors there. Kept the rules at warn; promotion is gated on #1386. This PR now just clears the inventory to 0.

@LucasSantana-Dev Understood — acknowledged. I see the revert in the latest commit (that's the commit 45df9ad you mentioned, which is the most recent one pushed). The diff in eslint.config.js now shows the five rules back at "warn" with a comment explaining the CI limitation and the gate on #1386.

To confirm what I'll check against:

  • The no-unsafe-* rules stay at warn — no promotion in this PR.
  • The actual inventory cleanup (memberHandler cast, giveaway cast) still stands.
  • No behavioral change, just typing fixes.

I'll keep the review aligned to that scope. The PR description above that still says "promotes" is stale — I'll ignore that and go off the actual file state.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

LucasSantana-Dev added a commit that referenced this pull request Jun 13, 2026
cubic review: the no-unsafe comment referenced #1378 (the tracking issue) as
if it cleaned the inventory; the actual cleanup landed in #1382/#1384/#1385.
LucasSantana-Dev added a commit that referenced this pull request Jun 13, 2026
#1387)

Fast follow-up to #1385.

#1385 auto-merged on its **promotion** commit before the revert push
landed, so `main` shipped the five `no-unsafe-*` rules at `error` in the
bot/shared ratchet block. The CI **`quality / Lint`** job runs `eslint
.` **without `db:generate` / `build:shared`**, so those **type-aware**
rules emit ~4200 phantom *"type could not be resolved"* / *"error
typed"* diagnostics across untouched files — making that (non-required)
job permanently red.

This sets the five rules back to **`warn`**. The inventory is still 0
(the #1382/#1384/#1385 fixes stand); only the enforcement is deferred.
Promotion is gated on **#1386** (make CI lint type-aware: run the
Prisma/shared codegen before `eslint .`).

Note: `quality / Lint` is not a required check, so `main` still
merges/deploys fine — this just restores a green lint signal. Syntactic
rules (`import-x/no-duplicates`, etc.) are unaffected and remain at
`error`.

## Validation
- root lint (typed env) exit 0
- only `eslint.config.js` changed (5 rules `error` → `warn`)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Set the five `@typescript-eslint` `no-unsafe-*` rules back to `warn` in
`eslint.config.js` to avoid false type errors when CI runs `eslint .`
without codegen, keeping the `quality / Lint` job green until linting is
type-aware. Also updated the inline comment to cite the actual cleanup
PRs (#1382/#1384/#1385) and note that promotion to `error` is gated on
#1386.

<sup>Written for commit a1e71a6.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1387?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->
LucasSantana-Dev added a commit that referenced this pull request Jun 13, 2026
#1392)

Closes #1386.

## Problem
The reusable `quality / Lint` job ran `eslint .` **without** generating
the Prisma client or building `@lucky/shared` first, so the
`@typescript-eslint` **type-aware** rules couldn't resolve types and
emitted ~4200 phantom diagnostics (`Unsafe call/return/member-access …
could not be resolved`) on untouched files (PR #1385: 4336 problems).
This blocked the #1378 ratchet from promoting the `no-unsafe-*` family
`warn → error`.

## Fix
- Bump the `LucasSantana-Dev/.github` reusable-workflow pin `6ec7fbe →
aae80785` (adds the optional `pre-lint-script` input + guarded pre-lint
step, .github PR #6).
- Pass `pre-lint-script: 'npm run db:generate && npm run build:shared'`
so eslint has the generated Prisma client and built shared types
available before `eslint .`.

## Verification
Both root scripts exist; `db:generate` has a `DATABASE_URL` fallback so
`prisma generate` runs without a live DB. **Acceptance check:** confirm
the `quality / Lint` job on this PR reports 0 phantom "could not be
resolved" diagnostics.

## Follow-up
Once `quality / Lint` is clean here, a follow-up promotes `no-unsafe-*`
`warn → error` in `eslint.config.js` (#1378).

@cubic-dev-ai @coderabbitai

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Run `npm run db:generate` and `npm run build:shared` before `eslint .`
in the quality lint workflow. This ensures the Prisma client and
`@lucky/shared` types exist, so `@typescript-eslint` resolves types and
stops emitting phantom "could not be resolved" errors, unblocking the
`no-unsafe-*` warn→error change (#1378).

<sup>Written for commit 3bd1778.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1392?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Chores
* Updated code quality workflow to include database generation and
shared library compilation steps before linting checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

This branch was successfully deployed

1 active deployment
Preview — afa74799 Deployed Jun 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant