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

fix: en_7 recommendations... #1749

Merged
merged 26 commits into from
Jan 31, 2025
Merged

fix: en_7 recommendations... #1749

merged 26 commits into from
Jan 31, 2025

Conversation

lucanicoladebiasi
Copy link
Collaborator

@lucanicoladebiasi lucanicoladebiasi commented Jan 27, 2025

Description

EN_7 recommendations.

Specify target JS.

Fixes # EN_7

Type of change

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • yarn examples
  • yarn test:solo
  • yarn test:unit

Test Configuration:

  • Node.js Version: v23.1.0
  • Yarn Version: 1.22.22

Summary by CodeRabbit

  • TypeScript Configuration Updates

    • Updated module system to Node16 across multiple projects
    • Updated ECMAScript target to ES2023
    • Modified module resolution strategy
    • Added support for importing TypeScript files with .ts extensions
  • Import and Export Path Updates

    • Added .js file extensions to import statements in Vite integration
    • Updated type and constant import paths
  • Testing Improvements

    • Enhanced type safety in test cases
    • Improved address formatting in contract tests

@lucanicoladebiasi lucanicoladebiasi added this to the 1.0.0 milestone Jan 27, 2025
@lucanicoladebiasi lucanicoladebiasi self-assigned this Jan 27, 2025
@lucanicoladebiasi lucanicoladebiasi linked an issue Jan 27, 2025 that may be closed by this pull request
Copy link

coderabbitai bot commented Jan 27, 2025

Walkthrough

This pull request encompasses a comprehensive set of TypeScript configuration updates across multiple packages and applications. The changes primarily focus on updating module systems, compiler targets, and module resolution strategies to align with Node.js version 16 and ECMAScript 2023 standards. Additionally, several import statements have been modified to include explicit file extensions, particularly in the Vite integration project.

Changes

File Change Summary
**/tsconfig.json Updated module from ESNext to Node16, target to ES2023, and moduleResolution to Node16. Added allowImportingTsExtensions option in apps/sdk-vite-integration/tsconfig.json.
apps/sdk-vite-integration/src/**/*.tsx Added .tsx file extensions to import statements for components.
packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts Added TypedDataDomain type import and casting in signTypedData method calls.
packages/network/tests/**/*.test.ts Updated address handling using Address.of() method for filtering criteria.

Possibly related PRs

  • build: 1.0.0-rc.5 #1568: Similar updates to tsconfig.json files for sdk-cloudflare-integration and sdk-nextjs-integration.

Suggested Labels

Type: Enhancement, Type: Documentation, Size: Small

Suggested Reviewers

  • claytonneal

Poem

🚀 Configs dance, modules align,
TypeScript whispers, "All is fine!"
Node16 beckons with its might,
Imports now shine, extensions bright!
Code evolves, a technical rhyme 🌟


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.

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

github-actions bot commented Jan 27, 2025

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.98% (4378/4423) 97.01% (1398/1441) 98.9% (906/916)
Title Tests Skipped Failures Errors Time
core 838 0 💤 0 ❌ 0 🔥 2m 35s ⏱️
network 731 0 💤 0 ❌ 0 🔥 5m 24s ⏱️
errors 40 0 💤 0 ❌ 0 🔥 18.408s ⏱️
logging 3 0 💤 0 ❌ 0 🔥 19.361s ⏱️
hardhat-plugin 19 0 💤 0 ❌ 0 🔥 1m 11s ⏱️
aws-kms-adapter 23 0 💤 0 ❌ 0 🔥 1m 31s ⏱️
ethers-adapter 5 0 💤 0 ❌ 0 🔥 1m 25s ⏱️
rpc-proxy 37 0 💤 0 ❌ 0 🔥 1m 31s ⏱️

@victhorbi victhorbi removed this from the 1.0.0 milestone Jan 28, 2025
@lucanicoladebiasi lucanicoladebiasi added this to the 1.0.0 milestone Jan 31, 2025
@lucanicoladebiasi lucanicoladebiasi marked this pull request as ready for review January 31, 2025 09:50
@lucanicoladebiasi lucanicoladebiasi requested a review from a team as a code owner January 31, 2025 09:50
Copy link

@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: 2

🧹 Nitpick comments (3)
apps/sdk-vite-integration/src/components/Hash.tsx (1)

3-3: Consider using import type for type-only imports.

Since HashedContent is only used as a type, we can improve type safety by using the import type syntax.

-import { HashedContent } from '../types/index.js';
+import type { HashedContent } from '../types/index.js';
🧰 Tools
🪛 ESLint

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

apps/sdk-vite-integration/src/main.tsx (1)

4-4: Add semicolon for consistency.

The static analysis tool suggests adding a semicolon after the import statement for consistent code formatting.

-import App from './App.js'
+import App from './App.js';
🧰 Tools
🪛 ESLint

[error] 4-4: Insert ;

(prettier/prettier)

apps/sdk-vite-integration/tsconfig.app.json (1)

6-6: LGTM! Module configuration updates look good.

The changes to use Node16 for both module and moduleResolution are appropriate for modern Node.js applications. Note: The JSON comments in the file might cause issues with some tools - consider removing them if they're not essential.

Also applies to: 10-10

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3eecea9 and bc93ea0.

📒 Files selected for processing (20)
  • apps/sdk-cloudflare-integration/tsconfig.json (2 hunks)
  • apps/sdk-nextjs-integration/tsconfig.json (2 hunks)
  • apps/sdk-vite-integration/src/App.tsx (1 hunks)
  • apps/sdk-vite-integration/src/components/GetLastBlock.tsx (1 hunks)
  • apps/sdk-vite-integration/src/components/Hash.tsx (1 hunks)
  • apps/sdk-vite-integration/src/components/TransferLogs.tsx (1 hunks)
  • apps/sdk-vite-integration/src/const/index.tsx (1 hunks)
  • apps/sdk-vite-integration/src/main.tsx (1 hunks)
  • apps/sdk-vite-integration/src/types/index.tsx (1 hunks)
  • apps/sdk-vite-integration/tests/Hash.spec.tsx (1 hunks)
  • apps/sdk-vite-integration/tsconfig.app.json (1 hunks)
  • apps/sdk-vite-integration/tsconfig.json (2 hunks)
  • apps/sdk-vite-integration/tsconfig.node.json (1 hunks)
  • docs/tsconfig.json (1 hunks)
  • packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts (3 hunks)
  • packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts (7 hunks)
  • packages/network/tests/thor-client/contracts/contract.event.solo.test.ts (4 hunks)
  • packages/network/tests/thor-client/contracts/contract.solo.test.ts (1 hunks)
  • packages/rpc-proxy/tsconfig.json (1 hunks)
  • tsconfig.json (2 hunks)
✅ Files skipped from review due to trivial changes (4)
  • apps/sdk-vite-integration/src/const/index.tsx
  • apps/sdk-vite-integration/src/App.tsx
  • apps/sdk-vite-integration/src/components/GetLastBlock.tsx
  • apps/sdk-vite-integration/src/types/index.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
apps/sdk-vite-integration/tsconfig.node.json

[error] 8-8: JSON standard does not allow comments.

(parse)


[error] 9-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 9-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 9-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 9-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

apps/sdk-vite-integration/tsconfig.app.json

[error] 9-9: JSON standard does not allow comments.

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

🪛 ESLint
apps/sdk-vite-integration/src/components/Hash.tsx

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

apps/sdk-vite-integration/src/components/TransferLogs.tsx

[error] 7-7: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 7-7: Replace "../types/index.js" with '../types/index.js'

(prettier/prettier)


[error] 8-8: Replace "../const/index.js" with '../const/index.js'

(prettier/prettier)

apps/sdk-vite-integration/src/main.tsx

[error] 4-4: Insert ;

(prettier/prettier)

apps/sdk-vite-integration/tests/Hash.spec.tsx

[error] 3-3: Insert ;

(prettier/prettier)


[error] 6-6: Replace ··const·{·getByText·}·=·render(<Hash·/>) with ····const·{·getByText·}·=·render(<Hash·/>);

(prettier/prettier)


[error] 8-8: Replace ··await·expect.element(getByText('0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00')).toBeInTheDocument() with ····await·expect⏎········.element(⏎············getByText(⏎················'0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00'⏎············)⏎········)⏎········.toBeInTheDocument();

(prettier/prettier)


[error] 9-9: Insert ;

(prettier/prettier)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: unit-integration-test-browser / Build & Lint (latest)
  • GitHub Check: unit-integration-test-browser / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test-browser / Build & Lint (18)
  • GitHub Check: unit-integration-test / Build & Lint (latest)
  • GitHub Check: unit-integration-test / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test / Build & Lint (18)
🔇 Additional comments (14)
apps/sdk-vite-integration/tests/Hash.spec.tsx (1)

3-3: LGTM! Import path update aligns with module resolution requirements.

The addition of the .js extension in the import statement is consistent with the PR's objective to improve module resolution.

🧰 Tools
🪛 ESLint

[error] 3-3: Insert ;

(prettier/prettier)

packages/network/tests/thor-client/contracts/contract.event.solo.test.ts (1)

104-104: LGTM! Consistent address formatting across test cases.

The use of Address.of() ensures proper address validation and formatting, which aligns with best practices for handling Ethereum addresses in tests.

Also applies to: 479-479, 540-540

packages/network/tests/thor-client/contracts/contract.solo.test.ts (1)

657-657: LGTM! Consistent with address formatting in other tests.

The use of Address.of() here maintains consistency with the address formatting pattern used in other test files.

packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts (2)

9-14: LGTM! Clean import restructuring.

The multi-line import structure improves readability and the addition of TypedDataDomain type enhances type safety.


305-308: Type safety improvement with TypedDataDomain.

The explicit type casting of typedData.domain to TypedDataDomain enhances type safety and helps catch potential type-related issues at compile time.

Also applies to: 315-317

packages/network/tests/signer/signers/vechain-private-key-signer/vechain-private-key-signer.unit.test.ts (2)

15-15: LGTM! Consistent type import.

The addition of TypedDataDomain type import maintains consistency with other files.


297-300: Comprehensive type safety improvements.

The consistent application of TypedDataDomain type casting across all test cases improves type safety and helps catch potential issues during testing. This includes:

  • Invalid case testing
  • Exception handling
  • Ethers compatibility testing
  • VeChain chainId variations

Also applies to: 321-324, 330-333, 352-355, 360-362, 382-387, 393-398

apps/sdk-vite-integration/tsconfig.json (1)

3-6: LGTM! TypeScript configuration updates look good.

The changes to use ES2023 target and Node16 module system are appropriate and align with the PR objectives to specify concrete JavaScript versions.

Let's verify the Node.js version compatibility:

✅ Verification successful

✅ TypeScript configuration is compatible with the project setup

The ES2023 target and Node16 module system align perfectly with:

  • TypeScript ~5.6.2 which fully supports these features
  • Modern development stack (Vite 6, React 18)
  • ESM package type configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Node.js version compatibility with ES2023 and verify package.json settings

# Check if package.json specifies Node.js engine requirements
rg '"engines":\s*{[^}]*"node":\s*"[^"]*"' package.json

# Look for any TypeScript version specifications
rg '"typescript":\s*"[^"]*"' package.json

Length of output: 265


Script:

#!/bin/bash
# Check package.json for Node.js engine requirements with fixed regex
rg -U '"engines".*"node":\s*"[^"]*"' package.json

# Check for any .nvmrc or .node-version files that might specify Node version
fd -e nvmrc -e node-version

Length of output: 81


Script:

#!/bin/bash
# Check if package.json exists and show its content
if [ -f "apps/sdk-vite-integration/package.json" ]; then
  cat "apps/sdk-vite-integration/package.json"
else
  # Check root package.json if project-specific one doesn't exist
  cat package.json
fi

Length of output: 1067

docs/tsconfig.json (1)

3-5: LGTM! Consistent TypeScript configuration for both compilation and ts-node.

The changes maintain consistency between the main compiler options and ts-node settings, which is important for reliable behavior.

Also applies to: 11-13

packages/rpc-proxy/tsconfig.json (1)

7-8: LGTM! Package-specific TypeScript configuration is properly updated.

The changes maintain consistency with the project-wide standards while preserving package-specific settings.

Also applies to: 12-12

apps/sdk-cloudflare-integration/tsconfig.json (1)

4-5: LGTM! Configuration updates are compatible with Cloudflare Workers.

The TypeScript configuration changes align with project standards while maintaining Cloudflare Workers compatibility through appropriate type definitions.

Let's verify Cloudflare Workers compatibility:

Also applies to: 9-9

✅ Verification successful

✅ Configuration verified as compatible with Cloudflare Workers

The nodejs_compat flag in wrangler.toml explicitly enables Node.js compatibility mode, confirming that the Node16 module system and ES2023 target are fully supported in the Workers runtime.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Cloudflare Workers compatibility with Node16 module system

# Check Cloudflare Workers types version
rg '"@cloudflare/workers-types":\s*"[^"]*"' package.json

# Look for any wrangler configuration that might affect module compatibility
fd -t f wrangler.toml -x cat {}

Length of output: 228

apps/sdk-vite-integration/tsconfig.node.json (1)

5-5: LGTM! Node-specific TypeScript configuration for Vite is properly updated.

The changes maintain compatibility with Vite while aligning with the project's Node16 module system standards.

Let's verify Vite compatibility:

Also applies to: 9-9

✅ Verification successful

✅ Verified: Node16 module system is fully compatible with the Vite setup

The Vite configuration follows standard practices and doesn't contain any module resolution customizations that could conflict with the Node16 module system.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Vite compatibility with Node16 module system

# Check Vite version
rg '"vite":\s*"[^"]*"' package.json

# Look for any Vite configuration that might affect module resolution
fd -t f 'vite.config.ts' -x cat {}

Length of output: 234

tsconfig.json (1)

8-9: Consider aligning ES target versions across configurations.

While the Node16 module configuration is consistent, there's a discrepancy in the ES target versions:

  • Root config uses ES2023
  • Vite app config uses ES2020

Consider aligning these for consistency, unless there's a specific reason for the difference.

Let's check for other ES target configurations in the project:

Also applies to: 13-13, 25-25

✅ Verification successful

ES target differences appear to be intentionally environment-specific

The varying ES targets across the project actually follow a logical pattern:

  • Browser-focused integrations (NextJS, Hardhat) use ES2020 for broader compatibility
  • Node.js-focused components use ES2023 to leverage newer features

These differences appear to be a deliberate choice based on runtime requirements rather than an inconsistency that needs to be addressed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for target configurations in all tsconfig files
fd tsconfig.json | xargs grep -l "target"

Length of output: 278


Script:

#!/bin/bash
# Extract target configurations from all tsconfig files
echo "=== Checking ES target configurations ==="
fd tsconfig.json | while read -r file; do
    echo "File: $file"
    grep -A 1 '"target"' "$file" || grep -A 1 "'target'" "$file" || true
    echo "---"
done

Length of output: 3781

apps/sdk-nextjs-integration/tsconfig.json (1)

11-12: LGTM! Configuration updates are consistent.

The changes to use Node16 for both module and moduleResolution align well with the other configurations and modern Node.js practices. The ES2020 target is consistent with the Vite integration configuration.

Also applies to: 33-33

apps/sdk-vite-integration/src/main.tsx Outdated Show resolved Hide resolved
apps/sdk-vite-integration/src/components/TransferLogs.tsx Outdated Show resolved Hide resolved
Copy link

@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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc93ea0 and 6946e6e.

📒 Files selected for processing (3)
  • apps/sdk-vite-integration/src/components/TransferLogs.tsx (1 hunks)
  • apps/sdk-vite-integration/src/main.tsx (1 hunks)
  • apps/sdk-vite-integration/tsconfig.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/sdk-vite-integration/tsconfig.json
🧰 Additional context used
🪛 ESLint
apps/sdk-vite-integration/src/components/TransferLogs.tsx

[error] 7-7: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 7-7: Replace "../types/index.js" with '../types/index.js'

(prettier/prettier)


[error] 8-8: Replace "../const/index.tsx" with '../const/index.tsx'

(prettier/prettier)

apps/sdk-vite-integration/src/main.tsx

[error] 4-4: Insert ;

(prettier/prettier)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: rpc-proxy / test / test
  • GitHub Check: unit-integration-test-browser / Build & Lint (latest)
  • GitHub Check: unit-integration-test / Build & Lint (latest)
  • GitHub Check: unit-integration-test-browser / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test-browser / Build & Lint (18)
  • GitHub Check: unit-integration-test / Build & Lint (18)
  • GitHub Check: install-build / Build & Lint
  • GitHub Check: test-apps / Install and test example apps
  • GitHub Check: Execute doc examples
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/sdk-vite-integration/src/main.tsx (1)

4-4: LGTM! Verify Vite configuration for TypeScript extensions.

The explicit .tsx extension aligns with Node16 module resolution standards and the PR objectives. However, ensure that your Vite configuration properly handles TypeScript extensions.

#!/bin/bash
# Description: Verify Vite handles TypeScript extensions correctly

# Check Vite configuration
echo "Checking Vite resolve.extensions configuration..."
rg -A 5 'resolve.*extensions' apps/sdk-vite-integration/vite.config.*

# Check if TypeScript is configured for Node16 resolution
echo "Checking TypeScript module resolution..."
rg '"moduleResolution"' apps/sdk-vite-integration/tsconfig.*
🧰 Tools
🪛 ESLint

[error] 4-4: Insert ;

(prettier/prettier)

apps/sdk-vite-integration/src/components/TransferLogs.tsx Outdated Show resolved Hide resolved
Copy link

@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

♻️ Duplicate comments (1)
apps/sdk-vite-integration/src/components/TransferLogs.tsx (1)

7-8: 🛠️ Refactor suggestion

Optimize imports and maintain consistent style.

The import statements need the following improvements:

  1. Use import type for the Transfer type since it's only used as a type annotation
  2. Use single quotes for consistency with the project style

Apply this diff to optimize the imports:

-import { Transfer } from "../types/index.tsx";
-import { explorerUrl, thorClient } from "../const/index.tsx";
+import type { Transfer } from '../types/index.tsx';
+import { explorerUrl, thorClient } from '../const/index.tsx';
🧰 Tools
🪛 ESLint

[error] 7-7: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 7-7: Replace "../types/index.tsx" with '../types/index.tsx'

(prettier/prettier)


[error] 8-8: Replace "../const/index.tsx" with '../const/index.tsx'

(prettier/prettier)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6946e6e and cfb6697.

📒 Files selected for processing (1)
  • apps/sdk-vite-integration/src/components/TransferLogs.tsx (1 hunks)
🧰 Additional context used
🪛 ESLint
apps/sdk-vite-integration/src/components/TransferLogs.tsx

[error] 7-7: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 7-7: Replace "../types/index.tsx" with '../types/index.tsx'

(prettier/prettier)


[error] 8-8: Replace "../const/index.tsx" with '../const/index.tsx'

(prettier/prettier)

⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: rpc-proxy / test / test
  • GitHub Check: unit-integration-test-browser / Build & Lint (latest)
  • GitHub Check: unit-integration-test-browser / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test-browser / Build & Lint (18)
  • GitHub Check: test-apps / Install and test example apps
  • GitHub Check: unit-integration-test / Build & Lint (latest)
  • GitHub Check: unit-integration-test / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test / Build & Lint (18)
  • GitHub Check: install-build / Build & Lint
  • GitHub Check: Execute doc examples

apps/sdk-vite-integration/src/App.tsx Outdated Show resolved Hide resolved
apps/sdk-vite-integration/src/main.tsx Show resolved Hide resolved
Copy link

@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)
apps/sdk-vite-integration/src/components/Hash.tsx (1)

3-3: Use import type for type-only imports.

Since HashedContent is only used as a type, we should use the import type syntax to make this explicit and help with bundle optimization.

Apply this change:

-import { HashedContent } from '../types/index.tsx';
+import type { HashedContent } from '../types/index.tsx';
🧰 Tools
🪛 ESLint

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfb6697 and 5d30fb8.

📒 Files selected for processing (4)
  • apps/sdk-vite-integration/src/App.tsx (1 hunks)
  • apps/sdk-vite-integration/src/components/GetLastBlock.tsx (1 hunks)
  • apps/sdk-vite-integration/src/components/Hash.tsx (1 hunks)
  • apps/sdk-vite-integration/src/const/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/sdk-vite-integration/src/components/GetLastBlock.tsx
  • apps/sdk-vite-integration/src/const/index.tsx
  • apps/sdk-vite-integration/src/App.tsx
🧰 Additional context used
🪛 ESLint
apps/sdk-vite-integration/src/components/Hash.tsx

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: rpc-proxy / test / test
  • GitHub Check: unit-integration-test / Build & Lint (latest)
  • GitHub Check: unit-integration-test-browser / Build & Lint (latest)
  • GitHub Check: unit-integration-test / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test-browser / Build & Lint (lts/*)
  • GitHub Check: unit-integration-test / Build & Lint (18)
  • GitHub Check: unit-integration-test-browser / Build & Lint (18)
  • GitHub Check: test-apps / Install and test example apps
  • GitHub Check: install-build / Build & Lint
  • GitHub Check: Execute doc examples
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/sdk-vite-integration/src/components/Hash.tsx (1)

3-3: LGTM! The explicit file extension improves module resolution.

The updated import path with explicit .tsx extension aligns with modern TypeScript best practices and improves module resolution clarity.

Let's verify that this change is consistent across the codebase:

✅ Verification successful

The explicit file extension in import path is verified and consistent with the codebase structure.

The import path update to include .tsx extension is correct and isolated to this file. The types directory exists at the expected location and no other files need similar updates.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports from '../types' without file extension
# to ensure consistency across the codebase

rg "from '\.\./types';" --type ts --type tsx

Length of output: 80


Script:

#!/bin/bash
# First, let's find all files in the types directory
echo "=== Files in types directory ==="
fd . -e ts -e tsx --full-path "**/types/"

echo -e "\n=== Checking import statements from types (with various extensions) ==="
# Use -t typescript to handle both .ts and .tsx files
rg "from ['\"].*types.*['\"]" -t typescript

echo -e "\n=== Using ast-grep to find import statements ==="
ast-grep --pattern 'import { $_ } from "../types$_"'

Length of output: 627


Script:

#!/bin/bash
# Find all TypeScript/React files
echo "=== TypeScript/React Files ==="
fd . -e ts -e tsx

echo -e "\n=== Checking type imports with correct flags ==="
rg "from.*types" --type-add 'ts:*.{ts,tsx}' -t ts

echo -e "\n=== Directory structure around the file ==="
fd . --full-path "**/sdk-vite-integration/src/"

Length of output: 66517

🧰 Tools
🪛 ESLint

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

@lucanicoladebiasi lucanicoladebiasi removed the request for review from saraantole January 31, 2025 19:48
@lucanicoladebiasi lucanicoladebiasi merged commit f52a556 into main Jan 31, 2025
16 of 17 checks passed
@lucanicoladebiasi lucanicoladebiasi deleted the 1662-en_7 branch January 31, 2025 19:49
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.

EN_7
4 participants