Skip to content

chore(lint): enforce import/no-duplicates on bot+shared (#1378) - #1379

Merged
LucasSantana-Dev merged 3 commits into
mainfrom
chore/1378-import-no-duplicates
Jun 13, 2026
Merged

LucasSantana-Dev merged 3 commits into
mainfrom
chore/1378-import-no-duplicates

Conversation

@LucasSantana-Dev

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

Copy link
Copy Markdown
Owner

What

First cleanup slice of #1378. Adds eslint-plugin-import and swaps the core no-duplicate-imports rule (which has no autofixer) for import/no-duplicates (autofixable + type-aware) in the packages/{bot,shared} ratchet block of eslint.config.js.

  • Autofix consolidated 41 duplicate imports across 10 bot files — pure import merges, no logic changes.
  • Rule promoted from warn → error: the inventory is cleaned, so it's now a regression guard, not a ratchet warning.
  • shared had no genuine same-kind duplicates — its only core-rule hits were import type/value separations, which import/no-duplicates correctly leaves intact (safer than the core rule under verbatimModuleSyntax).

This drops bot duplicate-import warnings 41→0 and shared 2→0 (under the type-aware rule). Remaining #1378 inventory (no-unsafe-*, complexity, no-unused-vars) is staged separately per that issue.

Verification (first-hand)

  • All four workspaces lint clean (npm run lint --workspace=… exit 0).
  • bot tsc + full suite: 2530 passed; shared suite: 818 passed.
  • Diff is surgical: every changed source line is a duplicate-import consolidation (plus pre-commit Prettier normalization enforced by lint-staged).

Part of #1378.

@cubic-dev-ai please review.


Summary by cubic

Enforce type‑aware duplicate import linting in bot and shared by switching to eslint-plugin-import-x and import-x/no-duplicates. Autofixed 41 duplicate imports in bot, promoted the rule to error, fixed ESLint 10 install issues, and removed an unused createSuccessEmbed import in seek.ts (part of #1378).

  • Refactors

    • Replace core no-duplicate-imports with import-x/no-duplicates in eslint.config.js for packages/{bot,shared}; set to error.
    • Consolidate duplicate imports in bot; shared type/value splits stay.
  • Dependencies

    • Add eslint-plugin-import-x and eslint-import-resolver-node (dev) to root package.json for ESLint 10 compatibility.

Written for commit 79a28d8. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores
    • Added eslint-plugin-import dependency to enhance code quality checks.
    • Consolidated and reorganized imports across the codebase for consistency.
    • Reformatted code structures for improved readability.

Add eslint-plugin-import and replace the core no-duplicate-imports rule
(no autofixer) with import/no-duplicates (autofixable, type-aware) in the
bot/shared ratchet block. Autofix consolidates 41 duplicate imports across
10 bot files; the rule is promoted to error as a regression guard. shared
had no same-kind duplicates (its only hits were type/value separations the
new rule correctly leaves intact). Behavior-identical: bot tsc + full bot
suite (2530) and shared suite (818) green.
@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 4:24am

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.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file bot labels Jun 13, 2026
@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

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 33 minutes and 46 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: 9e84e156-659b-45e1-8784-fc26ef2ee90a

📥 Commits

Reviewing files that changed from the base of the PR and between 49ca5b4 and 79a28d8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • eslint.config.js
  • package.json
  • packages/bot/src/functions/music/commands/seek.ts
📝 Walkthrough

Walkthrough

This PR adds eslint-plugin-import to enforce consistent import ordering across the codebase, then consolidates scattered import statements in bot modules and reformats music command response handlers and validation logic to align with the new linting rules.

Changes

Import organization and ESLint configuration

Layer / File(s) Summary
ESLint plugin installation and configuration
eslint.config.js, package.json
Add eslint-plugin-import devDependency and register the plugin in ESLint's TypeScript override. Replace core no-duplicate-imports rule with import/no-duplicates at error level in the packages/{bot,shared} override.
Import consolidation across bot modules
packages/bot/src/handlers/auditHandler.ts, packages/bot/src/handlers/memberHandler.ts, packages/bot/src/index.ts, packages/bot/src/services/AiDevToolkitService.ts, packages/bot/src/utils/music/namedSessions.ts, packages/bot/src/utils/music/sessionSnapshots.ts, packages/bot/src/utils/music/titleComparison/service.ts
Consolidate separate imports from @lucky/shared/services and @lucky/shared/utils into single grouped import statements across handlers, services, and utility modules.
Music command imports, validation, and response formatting
packages/bot/src/functions/music/commands/replay.ts, packages/bot/src/functions/music/commands/seek.ts, packages/bot/src/functions/music/commands/skipto.ts
Consolidate command validation imports in replay, seek, and skipto. Reformat seek's parseTimeToMs validation into explicit multi-line checks for mm:ss/ss input. Split track embed and interactionReply construction across multiple lines in all three commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • LucasSantana-Dev/Lucky#522: This PR refactors and reformats the /replay, /seek, and /skipto command modules that were introduced in PR #522, consolidating their imports and restructuring response formatting.

Suggested labels

dependencies, bot, shared, size/m

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enforcing the import/no-duplicates ESLint rule on the bot and shared packages, which aligns with the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/1378-import-no-duplicates

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.

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) June 13, 2026 03:58
@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@socket-security

socket-security Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedeslint-import-resolver-node@​0.4.01001007991100
Addedeslint-plugin-import-x@​4.16.29910010082100

View full report

@socket-security

socket-security Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm es-abstract is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.json → npm/eslint-import-resolver-node@0.4.0 → npm/es-abstract@1.24.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/es-abstract@1.24.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Low adoption: npm @package-json/types

Location: Package overview

From: package-lock.json → npm/eslint-plugin-import-x@4.16.2 → npm/@package-json/types@0.0.12

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@package-json/types@0.0.12. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Low adoption: npm node-exports-info

Location: Package overview

From: package-lock.json → npm/eslint-import-resolver-node@0.4.0 → npm/node-exports-info@1.6.0

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/node-exports-info@1.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Comment thread packages/bot/src/functions/music/commands/seek.ts Fixed
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 13, 2026
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Jun 13, 2026

@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 13 files

Auto-approved: Lint rule migration (no-duplicate-imports to import/no-duplicates) with 41 autofixed import consolidations, a dev-dependency addition, and no logic changes. All tests pass.

Re-trigger cubic

eslint-plugin-import@2.32.0 peer-caps at eslint 9, but the repo runs
eslint 10.4.0 — it resolved as invalid/extraneous and broke fresh
npm installs (ERESOLVE) in the compressed-size and queueResolver CI
jobs. Swap to the maintained fork eslint-plugin-import-x@4.16.2
(peer: eslint ^8.57 || ^9 || ^10) and rename the rule to
import-x/no-duplicates. Add eslint-import-resolver-node to satisfy
the plugin's peer dep.

@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.

@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.

0 issues found across 3 files (changes from recent commits).

Requires human review: The diff includes Prettier formatting changes that restructure function call parameters and conditionals across multiple bot files, not just pure import merges. While the stated goal is lint rule changes, the formatting changes could introduce subtle logic errors and need human review.

Re-trigger cubic

@github-actions

github-actions Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 435 kB

ℹ️ View Unchanged
Filename Size
packages/frontend/dist/assets/Admin-C4w1kFX8.js 2.3 kB
packages/frontend/dist/assets/AdminSupport-C815E1AU.js 1.57 kB
packages/frontend/dist/assets/api-CpI_tX0-.js 3.52 kB
packages/frontend/dist/assets/AutoMessages-Bu6N0gxw.js 3.21 kB
packages/frontend/dist/assets/AutoMod-CuEUidGk.js 4.17 kB
packages/frontend/dist/assets/badge-rFh0xT8v.js 499 B
packages/frontend/dist/assets/Card-aCaYZJK0.js 506 B
packages/frontend/dist/assets/Changelog-CQ9TA059.js 32.8 kB
packages/frontend/dist/assets/CommandsConfig-UtBkIUea.js 1.48 kB
packages/frontend/dist/assets/Config-Ctzc3aiA.js 1.93 kB
packages/frontend/dist/assets/CustomCommands-COh8Tn3T.js 2.11 kB
packages/frontend/dist/assets/DashboardOverview-DV4sp2wr.js 3.9 kB
packages/frontend/dist/assets/Docs-Dwb8AYh_.js 17.6 kB
packages/frontend/dist/assets/DocsShell-D40oBRso.js 1.42 kB
packages/frontend/dist/assets/EmbedBuilder-O4L3KUZZ.js 3.32 kB
packages/frontend/dist/assets/Features-BH-If4JZ.js 757 B
packages/frontend/dist/assets/GuildAutomation-CdJPiKyX.js 3 kB
packages/frontend/dist/assets/index-Cj-P3kjO.js 59.4 kB
packages/frontend/dist/assets/index-CyVlclma.css 18 kB
packages/frontend/dist/assets/input-D-6_bn9D.js 463 B
packages/frontend/dist/assets/label-mgO9pcsY.js 477 B
packages/frontend/dist/assets/Landing-YR_KsujM.js 5.04 kB
packages/frontend/dist/assets/LastFm-CXzyY6jI.js 1.94 kB
packages/frontend/dist/assets/legalNav-B6k3CWsW.js 274 B
packages/frontend/dist/assets/Levels-UN4OgrQT.js 2.26 kB
packages/frontend/dist/assets/Login-BUKpEXFH.js 2.5 kB
packages/frontend/dist/assets/Lyrics-CcirhaMW.js 1.33 kB
packages/frontend/dist/assets/Moderation-5uQN7oVy.js 3.76 kB
packages/frontend/dist/assets/Music-4WNDxWg5.js 5.96 kB
packages/frontend/dist/assets/MusicConfig-CJsb80IZ.js 1.63 kB
packages/frontend/dist/assets/PreferredArtists-9zhi2deb.js 3.79 kB
packages/frontend/dist/assets/PrivacyPolicy-D8kQBP_J.js 1.77 kB
packages/frontend/dist/assets/ReactionRoles-2MHb0E-h.js 1.87 kB
packages/frontend/dist/assets/rolldown-runtime-Cyuzqnbw.js 471 B
packages/frontend/dist/assets/routeMeta-BYnvx1U1.js 582 B
packages/frontend/dist/assets/SectionHeader-BN3aKzf-.js 893 B
packages/frontend/dist/assets/select-CaMM4hAg.js 1.23 kB
packages/frontend/dist/assets/ServerLogs-C1IextS5.js 3.05 kB
packages/frontend/dist/assets/ServerSettings-D7LqhoS2.js 4.16 kB
packages/frontend/dist/assets/ServersPage-D8k9HJMs.js 2.99 kB
packages/frontend/dist/assets/Skeleton-DLG6Idzy.js 235 B
packages/frontend/dist/assets/Spotify-DwSWYn0b.js 1.94 kB
packages/frontend/dist/assets/Starboard-DzFY306Q.js 1.76 kB
packages/frontend/dist/assets/StatTile-BIAoHnT_.js 639 B
packages/frontend/dist/assets/Support-D-8geOfg.js 1.53 kB
packages/frontend/dist/assets/switch-DW_HT2_i.js 544 B
packages/frontend/dist/assets/TermsOfService-67YATMnh.js 1.59 kB
packages/frontend/dist/assets/TrackHistory-AfgPm2UD.js 2.29 kB
packages/frontend/dist/assets/TwitchNotifications-Sh7LCA5S.js 2.43 kB
packages/frontend/dist/assets/useActiveHeading-D4jOwzwB.js 1.36 kB
packages/frontend/dist/assets/useFeatures-CFKLJHNR.js 2.06 kB
packages/frontend/dist/assets/usePageMetadata-DTv-6eVb.js 327 B
packages/frontend/dist/assets/vendor-forms-C-bof8GF.js 25.9 kB
packages/frontend/dist/assets/vendor-radix-DVFBfctr.js 38.9 kB
packages/frontend/dist/assets/vendor-react-2KsUHTcu.js 55.7 kB
packages/frontend/dist/assets/vendor-state-BOzOBCsh.js 24.2 kB
packages/frontend/dist/assets/vendor-ui-BO85gKJ7.js 65.4 kB

compressed-size-action

The duplicate-import autofix in 49ca5b4 surfaced an orphaned
createSuccessEmbed import; seek.ts only uses createErrorEmbed.

@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.

@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.

0 issues found across 1 file (changes from recent commits).

Auto-approved: Lint config and dependency changes: swap core no-duplicate-imports for autofixable import-x/no-duplicates rule plus ESLint plugin addition. All source changes are autofixed import consolidations with zero logic changes.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 965f8c8 into main Jun 13, 2026
44 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the chore/1378-import-no-duplicates branch June 13, 2026 04:29

This branch was successfully deployed

1 active deployment
Preview — 79a28d8a 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

Labels

bot dependencies Pull requests that update a dependency file size/xl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants