Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettier #2636

Merged
merged 7 commits into from
Jan 11, 2025
Merged

prettier #2636

merged 7 commits into from
Jan 11, 2025

Conversation

aymericdelab
Copy link
Collaborator

@aymericdelab aymericdelab commented Jan 11, 2025

Summary by CodeRabbit

Based on the comprehensive summary, here are the high-level release notes:

  • Library Migration

    • Migrated client components and contract definitions from local modules to @bibliothecadao/eternum package.
    • Updated import statements across multiple files to use centralized library.
  • Code Formatting

    • Standardized code formatting across multiple projects.
    • Added Prettier configuration and formatting scripts.
    • Updated .prettierignore to exclude generated and specific files.
  • GraphQL Schema

    • Enhanced readability of GraphQL schema definitions.
    • Reformatted query signatures and type declarations.
  • Minor Improvements

    • Adjusted import statements and type definitions.
    • Improved code readability without changing core functionality.

Copy link

vercel bot commented Jan 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 11, 2025 8:18pm
eternum-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 11, 2025 8:18pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
eternum-landing ⬜️ Ignored (Inspect) Visit Preview Jan 11, 2025 8:18pm

Copy link
Contributor

mentatbot bot commented Jan 11, 2025

Hi @aymericdelab! You need to be added as a user to interact with me. Please ask @ponderingdemocritus to add you on the settings page.

You are receiving this comment because I am set to review all PRs. That is configurable here.

Copy link
Contributor

coderabbitai bot commented Jan 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces significant changes to the project's component and import management, primarily focusing on migrating component definitions and imports from local files to the @bibliothecadao/eternum package. This involves removing local files like contractComponents.ts and createClientComponents.ts across multiple applications and updating import statements to use the centralized library. The changes streamline the codebase by consolidating component definitions and reducing local implementation redundancy.

Changes

File/Path Change Summary
client/apps/game/src/dojo/ Removed contractComponents.ts and createClientComponents.ts, updated import statements in setup.ts and setupNetwork.ts to use @bibliothecadao/eternum
client/apps/landing/src/dojo/ Similar changes to game app, removing local component files and updating import statements
Multiple hook files Updated ClientComponents import from local file to @bibliothecadao/eternum
Various UI component files Consolidated and updated import statements for ClientComponents

Sequence Diagram

sequenceDiagram
    participant Local as Local Implementation
    participant Library as @bibliothecadao/eternum
    participant App as Application

    Local->>Library: Migrate component definitions
    Library-->>App: Provide centralized components
    App->>Library: Import components directly
    Note over Local,Library: Simplify component management
Loading

Possibly related PRs

  • Fix docs build #2631: The changes in this PR involve modifications to the documentation build scripts, which are indirectly related to the main PR's changes in the game engine's component definitions. While they do not directly affect the game logic, they reflect a reorganization that may impact how documentation is generated for the components defined in the main PR.

Suggested reviewers

  • aymericdelab

Poem

🐰 Hopping through code with glee,
Components migrate, now library-free!
From local paths to centralized might,
Eternum's magic shines so bright!
A rabbit's dance of refactoring delight! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6849d1a and 798a244.

📒 Files selected for processing (2)
  • contracts/season_resources/contracts/src/lib.cairo (1 hunks)
  • contracts/world/src/lib.cairo (1 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Failed to generate code suggestions for PR

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
client/apps/game/src/ui/modules/military/battle-view/BattleActions.tsx (1)

Line range hint 279-309: Fix missing dependencies in useCallback hooks.

The tooltip handlers are recreated on every render because setTooltip is missing from the dependency array. This could lead to potential memory leaks and performance issues.

Add the missing dependency:

 const mouseEnterRaid = useCallback(() => {
   // ... existing code ...
   setTooltip({
     content: <div className="w-[250px]">{content}</div>,
     position: "top",
   });
-}, [raidStatus, selectedArmy, defenderArmy]);
+}, [raidStatus, selectedArmy, defenderArmy, setTooltip]);

 const mouseEnterLeave = useCallback(() => {
   if (leaveStatus !== LeaveStatus.Leave) {
     setTooltip({ content: <div>{leaveStatus}</div>, position: "top" });
   }
-}, [leaveStatus]);
+}, [leaveStatus, setTooltip]);

 const mouseEnterBattle = useCallback(() => {
   if (battleStartStatus !== BattleStartStatus.BattleStart && battleStartStatus !== BattleStartStatus.ForceStart) {
     setTooltip({ content: <div>{battleStartStatus}</div>, position: "top" });
   }
-}, [battleStartStatus]);
+}, [battleStartStatus, setTooltip]);

 const mouseEnterClaim = useCallback(() => {
   if (claimStatus !== ClaimStatus.Claimable) {
     setTooltip({ content: <div>{claimStatus}</div>, position: "top" });
   }
-}, [claimStatus]);
+}, [claimStatus, setTooltip]);
🧹 Nitpick comments (2)
client/apps/game/src/ui/modules/military/battle-view/BattleActions.tsx (1)

Line range hint 95-106: Enhance error handling in battle actions.

While error handling exists, consider enhancing user feedback for better UX:

  1. Add specific error messages for different failure scenarios
  2. Show error notifications to users
  3. Log structured error information for debugging

Example enhancement for the raid action:

 const handleRaid = async () => {
   if (selectedArmy?.battle_id !== 0 && !raidWarning) {
     setRaidWarning(true);
     return;
   }

   setLoading(Loading.Raid);
   setRaidWarning(false);
   try {
     await battleManager.pillageStructure(account, selectedArmy!, structure!.entity_id);
     toggleModal(
       <ModalContainer size="half">
         <Headline>Pillage History</Headline>
         <PillageHistory structureId={structure!.entity_id} />
       </ModalContainer>,
     );
     setBattleView(null);
     setView(LeftView.None);
   } catch (error) {
-    console.error("Error during pillage:", error);
+    const errorMessage = error instanceof Error ? error.message : "Unknown error during pillage";
+    console.error("Pillage error:", { error, army: selectedArmy?.entity_id, structure: structure?.entity_id });
+    toggleModal(
+      <ModalContainer size="half">
+        <Headline>Raid Failed</Headline>
+        <div className="text-red">{errorMessage}</div>
+      </ModalContainer>,
+    );
   }
   setLoading(Loading.None);
 };

Also applies to: 134-145, 166-177, 189-200

client/apps/landing/src/dojo/setupNetwork.ts (1)

Line range hint 9-9: Consider updating the SetupNetworkResult type

For better type safety, consider explicitly defining the return type interface instead of relying on the inferred type from ReturnType.

-export type SetupNetworkResult = Awaited<ReturnType<typeof setupNetwork>>;
+export interface SetupNetworkResult {
+  toriiClient: torii.Client;
+  contractComponents: ReturnType<typeof defineContractComponents>;
+  provider: EternumProvider;
+  world: World;
+  burnerManager: BurnerManager;
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e63503 and d192a1a.

📒 Files selected for processing (43)
  • client/.prettierignore (1 hunks)
  • client/apps/game/src/dojo/contractComponents.ts (0 hunks)
  • client/apps/game/src/dojo/createClientComponents.ts (0 hunks)
  • client/apps/game/src/dojo/setup.ts (1 hunks)
  • client/apps/game/src/dojo/setupNetwork.ts (1 hunks)
  • client/apps/game/src/hooks/helpers/battles/useBattles.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/use-resource-arrivals.tsx (0 hunks)
  • client/apps/game/src/hooks/helpers/useArmies.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/useContributions.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/useEntities.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/useGuilds.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/useHyperstructures.tsx (1 hunks)
  • client/apps/game/src/hooks/helpers/useRealm.tsx (1 hunks)
  • client/apps/game/src/three/components/InstancedBiome.tsx (1 hunks)
  • client/apps/game/src/three/sound/utils.ts (1 hunks)
  • client/apps/game/src/three/systems/SystemManager.ts (1 hunks)
  • client/apps/game/src/ui/components/construction/SelectPreviewBuilding.tsx (1 hunks)
  • client/apps/game/src/ui/components/military/PillageHistory.tsx (2 hunks)
  • client/apps/game/src/ui/components/military/TroopChip.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/Battle.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/BattleActions.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/BattleHistory.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/BattleSideView.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/Troops.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx (1 hunks)
  • client/apps/game/src/ui/modules/military/battle-view/utils.tsx (1 hunks)
  • client/apps/game/src/ui/modules/stream/eventDetails.tsx (1 hunks)
  • client/apps/game/src/ui/utils/realms.tsx (1 hunks)
  • client/apps/landing/src/dojo/contractComponents.ts (0 hunks)
  • client/apps/landing/src/dojo/createClientComponents.ts (0 hunks)
  • client/apps/landing/src/dojo/setup.ts (1 hunks)
  • client/apps/landing/src/dojo/setupNetwork.ts (1 hunks)
  • client/apps/landing/src/hooks/gql/fragment-masking.ts (1 hunks)
  • client/apps/landing/src/hooks/gql/gql.ts (2 hunks)
  • client/apps/landing/src/hooks/gql/graphql.ts (0 hunks)
  • client/apps/landing/src/hooks/helpers/useDonkeyArrivals.tsx (0 hunks)
  • client/apps/landing/src/hooks/helpers/useResources.tsx (1 hunks)
  • client/apps/landing/src/hooks/query/capacityConfig.tsx (1 hunks)
  • client/apps/landing/src/hooks/query/entityOwners.tsx (1 hunks)
  • client/apps/landing/src/hooks/useTravel.tsx (1 hunks)
  • client/sdk/packages/eternum/src/dojo/createClientComponents.ts (1 hunks)
  • contracts/src/utils/map/.prettierignore (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (7)
  • client/apps/landing/src/dojo/createClientComponents.ts
  • client/apps/game/src/dojo/createClientComponents.ts
  • client/apps/landing/src/hooks/helpers/useDonkeyArrivals.tsx
  • client/apps/game/src/hooks/helpers/use-resource-arrivals.tsx
  • client/apps/game/src/dojo/contractComponents.ts
  • client/apps/landing/src/dojo/contractComponents.ts
  • client/apps/landing/src/hooks/gql/graphql.ts
✅ Files skipped from review due to trivial changes (24)
  • client/apps/landing/src/hooks/query/entityOwners.tsx
  • client/apps/landing/src/hooks/useTravel.tsx
  • client/apps/game/src/hooks/helpers/useRealm.tsx
  • contracts/src/utils/map/.prettierignore
  • client/apps/landing/src/hooks/helpers/useResources.tsx
  • client/apps/game/src/hooks/helpers/useEntities.tsx
  • client/apps/landing/src/hooks/query/capacityConfig.tsx
  • client/apps/game/src/ui/components/military/TroopChip.tsx
  • client/apps/game/src/ui/modules/military/battle-view/BattleSideView.tsx
  • client/apps/game/src/three/components/InstancedBiome.tsx
  • client/apps/game/src/ui/components/military/PillageHistory.tsx
  • client/apps/game/src/hooks/helpers/useArmies.tsx
  • client/apps/game/src/hooks/helpers/battles/useBattles.tsx
  • client/apps/game/src/ui/modules/military/battle-view/Battle.tsx
  • client/apps/game/src/three/sound/utils.ts
  • client/.prettierignore
  • client/apps/game/src/ui/modules/stream/eventDetails.tsx
  • client/apps/game/src/ui/modules/military/battle-view/Troops.tsx
  • client/apps/game/src/ui/utils/realms.tsx
  • client/apps/game/src/hooks/helpers/useGuilds.tsx
  • client/apps/game/src/three/systems/SystemManager.ts
  • client/apps/game/src/hooks/helpers/useHyperstructures.tsx
  • client/apps/game/src/ui/modules/military/battle-view/utils.tsx
  • client/apps/game/src/hooks/helpers/useContributions.tsx
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: test-various (guild_test)
  • GitHub Check: test-various (resource_bridge_test)
  • GitHub Check: test-various (map_test)
  • GitHub Check: test-various (bank_test)
  • GitHub Check: test-various (hyperstructure_test)
  • GitHub Check: test-various (config_test)
  • GitHub Check: test-various (position_test)
  • GitHub Check: test-various (owner_test)
  • GitHub Check: test-various (combat_test)
  • GitHub Check: Run pr agent on every pull request, respond to user comments
  • GitHub Check: clippy
🔇 Additional comments (16)
client/apps/game/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx (1)

5-5: LGTM! Import consolidation looks good.

The addition of ClientComponents to the existing imports from @bibliothecadao/eternum aligns with the PR's objective of centralizing component imports. The type is correctly used in the component's props interface.

client/apps/game/src/ui/components/construction/SelectPreviewBuilding.tsx (1)

Line range hint 29-36: LGTM! Import consolidation looks good.

The migration of ClientComponents to @bibliothecadao/eternum aligns with the PR's objective of consolidating component definitions.

Let's verify that all imports of ClientComponents have been updated consistently:

✅ Verification successful

Import changes are consistent across the game client

The migration of ClientComponents to @bibliothecadao/eternum has been properly implemented across all game client files. The only files using the old import path are test mocks within the eternum package itself, which is expected and correct.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining imports of ClientComponents from the old location
rg "import.*ClientComponents.*from.*@/dojo/createClientComponents"

# Search for the new import pattern to confirm the migration
rg "import.*ClientComponents.*from.*@bibliothecadao/eternum"

Length of output: 2267

client/apps/game/src/ui/modules/military/battle-view/BattleActions.tsx (2)

15-15: LGTM! Import change aligns with centralization effort.

The addition of ClientComponents import from @bibliothecadao/eternum aligns with the PR's objective of centralizing component definitions.


Line range hint 40-50: LGTM! Type safety improvement.

The use of ClientComponents type for battleAdjusted prop enhances type safety and makes the component's interface more explicit.

client/apps/landing/src/hooks/gql/gql.ts (2)

18-18: LGTM! Formatting improvements.

The whitespace changes in the GraphQL queries improve readability while maintaining functionality.

Also applies to: 20-20


36-36: Verify the removal of player registration queries.

The removal of hasPlayerRegistered and hasPlayerClaimed queries suggests these operations have been moved or are no longer needed. Let's verify there are no remaining references to these queries.

Also applies to: 44-44

✅ Verification successful

Removal of player registration queries is safe

The removed queries hasPlayerRegistered and hasPlayerClaimed have no remaining references in the codebase. The registration-related code found in the codebase uses different queries for leaderboard functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the removed queries
# to ensure they're not being used elsewhere in the codebase

echo "Checking for hasPlayerRegistered references..."
rg -l "hasPlayerRegistered|HasPlayerRegisteredDocument" --type ts

echo "Checking for hasPlayerClaimed references..."
rg -l "hasPlayerClaimed|HasPlayerClaimedDocument" --type ts

Length of output: 329


Script:

#!/bin/bash
# Case-insensitive search with partial matches
echo "Checking for any player registration query references..."
rg -i "player.*regist|regist.*player" --type ts

echo "Checking for any player claim query references..."
rg -i "player.*claim|claim.*player" --type ts

echo "Checking generated types file..."
fd "graphql.ts" --type f --exec cat {}

Length of output: 66695

client/apps/landing/src/dojo/setup.ts (1)

1-1: LGTM! Clean import refactoring

The change to import from @bibliothecadao/eternum aligns with the broader effort to consolidate component management.

client/sdk/packages/eternum/src/dojo/createClientComponents.ts (1)

6-6: Verify all callers of createClientComponents

The function signature has changed from accepting a direct parameter to using destructuring. While this change is valid, we should ensure all calling code has been updated.

Let's verify all callers have been updated:

✅ Verification successful

✓ Callers are compatible with new signature

The function signature change is safe. Both callers in client/apps/landing/src/dojo/setup.ts and client/apps/game/src/dojo/setup.ts pass a network object that contains the required contractComponents property, which is created via defineContractComponents(world) in their respective setupNetwork implementations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for direct calls to createClientComponents that might need updating
rg "createClientComponents\(" --type ts

Length of output: 394


Script:

#!/bin/bash
# Check the content of both setup files to understand the network parameter
echo "=== Landing setup.ts ==="
cat client/apps/landing/src/dojo/setup.ts
echo -e "\n=== Game setup.ts ==="
cat client/apps/game/src/dojo/setup.ts

Length of output: 8480


Script:

#!/bin/bash
# Check setupNetwork implementation
echo "=== Landing setupNetwork.ts ==="
cat client/apps/landing/src/dojo/setupNetwork.ts
echo -e "\n=== Game setupNetwork.ts ==="
cat client/apps/game/src/dojo/setupNetwork.ts

Length of output: 3128

client/apps/game/src/dojo/setupNetwork.ts (1)

1-1: LGTM! Consistent import refactoring

The import changes align with the centralization of components in @bibliothecadao/eternum.

client/apps/landing/src/hooks/gql/fragment-masking.ts (2)

2-2: LGTM! Import ordering

The reordering of imports improves code organization.


6-6: LGTM! Type export

Making FragmentType exportable improves module reusability.

client/apps/game/src/ui/modules/military/battle-view/BattleHistory.tsx (1)

4-4: LGTM! Import consolidation looks good.

The addition of ClientComponents to the import statement from @bibliothecadao/eternum aligns with the PR's objective of consolidating component-related imports.

client/apps/game/src/dojo/setup.ts (2)

4-9: LGTM! Import consolidation looks good.

Moving createClientComponents import to @bibliothecadao/eternum aligns with the PR's objective of centralizing component management.


Line range hint 31-37: Verify the impact of increased debounce time.

The debounce time has been increased to 200ms for handling larger batches. While this might help with batch processing, it could affect the responsiveness of entity updates in the UI.

Please ensure this change doesn't introduce noticeable delays in:

  1. UI updates when entities change
  2. Real-time synchronization requirements
  3. Game state responsiveness

Consider adding metrics or logging to monitor the entity update frequency and batch sizes to validate this change.

client/apps/landing/src/dojo/setupNetwork.ts (2)

Line range hint 42-48: Verify the impact of adding contractComponents to the return object

The addition of contractComponents to the return object is consistent with the refactoring effort. However, we should verify that all consumers of setupNetwork are updated to handle this change.

Let's check for potential breaking changes:

✅ Verification successful

Change is verified and safe to proceed

The addition of contractComponents to the return object of setupNetwork is properly integrated into the codebase. It's consumed by createClientComponents which enhances it with overridable components, and this pattern is consistently used across both game and landing applications.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all files that import and use setupNetwork
rg -l "setupNetwork" | xargs rg "setupNetwork|SetupNetworkResult" -A 5

Length of output: 6581


Script:

#!/bin/bash
# Check how contractComponents is used in createClientComponents
rg "createClientComponents" -A 5
ast-grep --pattern 'function createClientComponents($_) {
  $$$
}'

Length of output: 14340


1-1: Verify @bibliothecadao/eternum package dependency

The import statement has been updated to use the centralized package. This aligns with the refactoring effort to consolidate components.

Let's verify the package dependency is properly specified:

✅ Verification successful

Import statement is valid and properly configured

The package @bibliothecadao/eternum exists as a workspace package in client/sdk/packages/eternum and properly exports the required components through its module system. The workspace dependency is correctly configured.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the package is properly specified in package.json files
fd package.json | xargs jq -r '.dependencies["@bibliothecadao/eternum"] // empty'

Length of output: 95


Script:

#!/bin/bash
# Check for the package directory
fd -t d bibliothecadao

# Check for any files exporting the required components
ast-grep --pattern 'export { defineContractComponents, EternumProvider }'

Length of output: 100


Script:

#!/bin/bash
# Look for workspace packages
fd package.json --exec grep -l "name.*bibliothecadao" {} \;

# Search for component references with broader patterns
ast-grep --pattern 'export $_ defineContractComponents'
ast-grep --pattern 'export $_ EternumProvider'

# Fallback to text search
rg -l "bibliothecadao"

Length of output: 13045


Script:

#!/bin/bash
# Check the package's main source files for exports
cat client/sdk/packages/eternum/src/index.ts || true
# Fallback to checking all typescript files in the package for exports
rg -l "defineContractComponents|EternumProvider" client/sdk/packages/eternum/src/

Length of output: 799

package.json Outdated
Comment on lines 14 to 15
"format": "pnpm --dir ./client prettier --write .",
"format:check": "pnpm --dir ./client prettier --check .",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Formatting scope is too restrictive

The current changes limit formatting to only the client directory, but there are important files that should be formatted:

  • Configuration files (package.json, biome.json)
  • Documentation (*.md files)
  • Contract-related code (deployment scripts, configs)

Consider either:

  • Removing --dir ./client to format all files
  • Or creating separate format commands (e.g., format:client, format:contracts) if different formatting rules are needed
🔗 Analysis chain

LGTM! Verify scope of formatting.

The changes align with the project's script pattern of using --dir ./client. This provides consistent formatting behavior with other commands.

Let's verify no critical files are excluded from formatting:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potentially important files that might need formatting outside client/
fd -t f -e ts -e tsx -e js -e jsx -e json -e md \
  --exclude client \
  --exclude node_modules \
  --exclude dist \
  --exec echo "File outside client dir: {}"

Length of output: 2013

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
client/package.json (1)

13-14: Consider documenting the root directory change.

Adding a comment in the package.json or updating the README to explain why the root directory is set to parent would help future maintainers understand the setup.

Example documentation to add to README:

+ ## Development
+ 
+ The project uses Prettier for code formatting. The formatting commands are configured to use the root directory's 
+ prettier configuration to ensure consistent formatting across all packages.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d192a1a and 6849d1a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • .github/workflows/lint.yml (1 hunks)
  • .prettierignore (1 hunks)
  • client/apps/balancing/package.json (1 hunks)
  • client/apps/game-docs/package.json (1 hunks)
  • client/apps/game/package.json (1 hunks)
  • client/apps/landing/package.json (1 hunks)
  • client/apps/landing/schema.graphql (3 hunks)
  • client/apps/landing/src/hooks/gql/fragment-masking.ts (1 hunks)
  • client/apps/landing/src/hooks/gql/gql.ts (2 hunks)
  • client/apps/landing/src/hooks/gql/index.ts (1 hunks)
  • client/apps/landing/src/routeTree.gen.ts (2 hunks)
  • client/common/manifests/manifest_dev.json (24 hunks)
  • client/common/manifests/manifest_mainnet.json (22 hunks)
  • client/common/manifests/manifest_prod.json (22 hunks)
  • client/package.json (1 hunks)
  • contracts/formula/battles/battle_time.js (1 hunks)
  • contracts/manifest_dev.json (16 hunks)
  • contracts/manifest_mainnet.json (16 hunks)
  • contracts/manifest_prod.json (16 hunks)
  • contracts/world/manifest_prod.json (1 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (11)
  • contracts/formula/battles/battle_time.js
  • client/apps/landing/src/hooks/gql/index.ts
  • contracts/world/manifest_prod.json
  • .prettierignore
  • client/common/manifests/manifest_dev.json
  • client/apps/landing/src/routeTree.gen.ts
  • client/common/manifests/manifest_prod.json
  • contracts/manifest_prod.json
  • contracts/manifest_mainnet.json
  • contracts/manifest_dev.json
  • client/common/manifests/manifest_mainnet.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • package.json
  • client/apps/landing/src/hooks/gql/fragment-masking.ts
  • client/apps/landing/src/hooks/gql/gql.ts
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: test-various (test_ownership_systems)
  • GitHub Check: test-various (transport_test)
  • GitHub Check: test-various (guild_test)
  • GitHub Check: test-various (realm_test)
  • GitHub Check: test-various (trade_test)
  • GitHub Check: test-various (resource_bridge_test)
  • GitHub Check: test-various (map_test)
  • GitHub Check: test-various (bank_test)
  • GitHub Check: test-various (hyperstructure_test)
  • GitHub Check: test-various (config_test)
  • GitHub Check: test-various (resources_test)
  • GitHub Check: test-various (owner_test)
  • GitHub Check: test-various (combat_test)
  • GitHub Check: test-various (season_test)
🔇 Additional comments (9)
client/apps/landing/schema.graphql (3)

38-154: LGTM! Improved readability of ModelUnion type.

The vertical formatting of union types makes the schema more readable and maintainable.


329-1555: LGTM! Consistent query parameter formatting.

Breaking down query parameters into multiple lines improves readability while maintaining functionality.


11284-11284: LGTM! Appropriate scalar placement.

Moving the u256 scalar declaration to group it with other scalar types is a good organization practice.

client/apps/game-docs/package.json (1)

7-8: LGTM! Verify prettier configuration in parent directory.

The format scripts are correctly configured to use the parent directory as root.

Run this script to verify the prettier configuration:

✅ Verification successful

Prettier configuration verified and consistent

The root-level prettier configuration is properly set up with standard formatting rules. The format scripts in game-docs will correctly use this configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for prettier config files in parent directory
fd -H -t f "^\.prettier(rc|ignore).*$|prettier\.config\.[jt]s$" ..

Length of output: 204


Script:

#!/bin/bash
# Check content of prettier config files
echo "=== Root .prettierrc ==="
cat ../git/.prettierrc
echo -e "\n=== Root .prettierignore ==="
cat ../git/.prettierignore
echo -e "\n=== SDK eternum .prettierrc ==="
cat ../git/client/sdk/packages/eternum/.prettierrc
echo -e "\n=== Contracts map .prettierignore ==="
cat ../git/contracts/src/utils/map/.prettierignore

Length of output: 1389

client/apps/balancing/package.json (1)

10-11: LGTM! Format scripts are consistent.

The format scripts match the project-wide standardization.

.github/workflows/lint.yml (1)

31-31: LGTM! CI workflow updated to use new format:check script.

The workflow correctly uses the newly standardized script name.

client/apps/game/package.json (1)

10-11: LGTM! Format scripts are consistent.

The format scripts maintain consistency with the project-wide standardization.

client/apps/landing/package.json (1)

12-13: LGTM! Format scripts complete the project-wide standardization.

The format scripts are consistent across all package.json files, establishing a unified approach to code formatting.

client/package.json (1)

13-14: LGTM! Verify prettier configuration location.

The changes to use npx and specify the root directory are good practices. However, let's verify the prettier configuration setup.

Run this script to check the prettier configuration:

✅ Verification successful

Prettier configuration verified and correct

The --root=.. setting is properly configured to use the root-level prettier configuration. For better maintenance, consider removing the identical config at client/sdk/packages/eternum/.prettierrc as it's redundant.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify prettier configuration location and consistency

# Check for prettier config files in root and client directories
echo "Checking prettier configuration files:"
fd -H -t f "^\.prettier" ..

# Verify if the root directory setting works as expected
cd .. && npx prettier --check client/package.json --root=. || echo "Root directory setting might be incorrect"

Length of output: 499


Script:

#!/bin/bash
# Check content of prettier configs to understand the setup
echo "Root prettier config:"
cat ../git/.prettierrc

echo -e "\nSub-package prettier config:"
cat ../git/client/sdk/packages/eternum/.prettierrc

# Check if configs are identical
diff ../git/.prettierrc ../git/client/sdk/packages/eternum/.prettierrc || echo "Configs are different"

Length of output: 756

@bob0005 bob0005 merged commit c14c48c into next Jan 11, 2025
20 of 29 checks passed
@bob0005 bob0005 deleted the raschel/clean branch January 11, 2025 20:16
@coderabbitai coderabbitai bot mentioned this pull request Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants