-
Notifications
You must be signed in to change notification settings - Fork 4
Add js ci #2
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
Add js ci #2
Conversation
WalkthroughThis pull request introduces comprehensive updates to the frontend project's configuration, tooling, and workflow. A new GitHub Actions workflow for JavaScript linting has been added, along with the introduction of Biome as the primary linting and formatting tool. The project has been renamed from "next-demo" to "parallel-evm-explorer", and several configuration files have been updated to reflect new development practices. Environment-related files have been removed, and dependencies have been updated to their latest versions. Changes
Possibly related PRs
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🔭 Outside diff range comments (1)
frontend/src/static/iconfont/iconfont.css (1)
Fix invalid font-family syntax in iconfont.css
The font-family declarations are missing required commas between font names:
- Line 2:
font-family: "iconfont" sans-serif !important;- Line 9:
font-family: "iconfont" sans-serif !important;Correct syntax should be:
font-family: "iconfont", sans-serif !important;🔗 Analysis chain
Line range hint
1-38: Verify unintended font-family changes from Biome formattingWhile the switch to double quotes aligns with Biome's formatting rules, the changes to font-family declarations appear to be unintended side effects of the formatting process. After fixing the syntax issues, please verify that the font still renders correctly.
Run this script to check if similar unintended changes occurred in other CSS files:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for potentially incorrect font-family declarations in CSS files rg -t css 'font-family:.*[^,]\s+sans-serif'Length of output: 252
🧹 Nitpick comments (4)
frontend/src/app/page.js (1)
99-103: Consider implementing i18n for text localizationThe loading text has been changed from Chinese ("加载中...") to English ("loading..."). Consider implementing a proper internationalization system to handle multiple languages consistently.
frontend/README.md (1)
3-7: Enhance pre-push check documentationThe pre-push checks section could benefit from explaining what each command does and why it's important.
Consider adding brief descriptions:
## Checks before push ```sh +# Format code using Biome npm run format +# Run linting checks npm run lint</blockquote></details> <details> <summary>frontend/biome.json (2)</summary><blockquote> `3-7`: **Consider enabling VCS integration** VCS integration is currently disabled. Enabling it would allow Biome to: 1. Respect `.gitignore` 2. Only format tracked files ```diff "vcs": { - "enabled": false, + "enabled": true, "clientKind": "git", "useIgnoreFile": true }
25-39: Review disabled accessibility rulesSeveral important accessibility rules are disabled. Consider enabling critical ones like:
useAltTextuseButtonTypeuseHtmlLang"a11y": { "noAriaHiddenOnFocusable": "off", "noAutofocus": "off", "noBlankTarget": "error", "noNoninteractiveElementToInteractiveRole": "off", "noNoninteractiveTabindex": "off", "noPositiveTabindex": "off", "noSvgWithoutTitle": "off", - "useAltText": "off", + "useAltText": "error", - "useButtonType": "off", + "useButtonType": "error", - "useHtmlLang": "off", + "useHtmlLang": "error", "useIframeTitle": "off", "useKeyWithClickEvents": "off", "useKeyWithMouseEvents": "off", "useValidAnchor": "off" }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
.github/workflows/js.yml(1 hunks).github/workflows/rust.yml(2 hunks).mise.toml(1 hunks)frontend/.env.development(0 hunks)frontend/.env.production(0 hunks)frontend/.gitignore(1 hunks)frontend/README.md(1 hunks)frontend/biome.json(1 hunks)frontend/package.json(1 hunks)frontend/src/app/layout.js(1 hunks)frontend/src/app/page.js(4 hunks)frontend/src/components/Graph.js(2 hunks)frontend/src/static/iconfont/iconfont.css(1 hunks)frontend/src/static/iconfont/iconfont.js(1 hunks)frontend/src/utils/api.js(1 hunks)frontend/tailwind.config.js(1 hunks)
💤 Files with no reviewable changes (2)
- frontend/.env.production
- frontend/.env.development
✅ Files skipped from review due to trivial changes (4)
- .mise.toml
- frontend/tailwind.config.js
- frontend/.gitignore
- frontend/src/app/layout.js
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/js.yml
15-15: both "paths" and "paths-ignore" filters cannot be used for the same event "pull_request". note: use '!' to negate patterns
(events)
🪛 yamllint (1.35.1)
.github/workflows/js.yml
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
🪛 Biome (1.9.4)
frontend/src/static/iconfont/iconfont.js
[error] 4-6: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 4-4: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 31-31: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 33-33: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 34-34: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 35-35: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 36-36: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 37-37: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 37-37: e is assigned to itself.
This is where is assigned.
(lint/correctness/noSelfAssign)
[error] 38-38: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 45-47: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 50-50: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 51-51: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 52-52: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 54-57: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 56-56: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 60-60: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
(lint/suspicious/noAssignInExpressions)
[error] 4-4: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 4-4: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 5-5: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 7-7: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
🔇 Additional comments (8)
frontend/src/components/Graph.js (2)
12-14: Improved iteration performance with for...ofThe change from
forEachtofor...ofis a good optimization. Thefor...ofloop is more performant for large datasets and allows usingbreak/continuestatements if needed in future modifications.
15-17: Consistent iteration pattern appliedGood consistency in applying the same iteration pattern improvement to edge processing.
frontend/src/utils/api.js (1)
23-26: Verify environment variable configurationThe API base URL now uses
PARALLEL_EVM_EXPLORER_SERVER. Ensure this environment variable is properly configured in all deployment environments.frontend/src/app/page.js (1)
31-31: Improved error handling messagesGood improvement in error message clarity and consistency. The error messages are now more descriptive and follow a consistent format.
Also applies to: 39-39
frontend/package.json (3)
9-11: LGTM! Clear and consistent script namingThe new Biome-related scripts are well-organized with clear purposes:
lint: For checking codefix: For automatically fixing issuesformat: For formatting code
15-17: Verify the impact of React version updateThe update from RC version to stable React 19.0.0 is good, but ensure all components are compatible.
✅ Verification successful
React 19.0.0 upgrade appears safe
The codebase only uses stable core hooks (useState, useEffect, useRef) that maintain compatibility across versions. No deprecated patterns or experimental features were found that could be affected by the upgrade.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for React features that might be affected by the version update rg -l 'use(Transition|Suspense|Deferred)' frontend/Length of output: 53
Script:
#!/bin/bash # Search for React hooks and patterns that might need attention in v19 rg -l 'use(Effect|State|Context|Ref|Callback|LayoutEffect|ImperativeHandle|Debug|Id|Memo|Reducer|Server|Client)' frontend/ # Search for concurrent mode and streaming features rg -l 'Suspense|startTransition|useTransition|useDeferredValue|createRoot|hydrateRoot' frontend/ # Search for legacy lifecycle methods that might need attention rg -l 'componentWill(Mount|Update|Receive)|UNSAFE_' frontend/ # Use ast-grep to find class components (might need updates) ast-grep --pattern 'class $_ extends React.Component { $$$ }'Length of output: 411
Script:
#!/bin/bash # Check the specific hooks usage in the identified files echo "=== Graph.js hooks usage ===" rg 'use[A-Z]' frontend/src/components/Graph.js -A 1 echo -e "\n=== page.js hooks usage ===" rg 'use[A-Z]' frontend/src/app/page.js -A 1Length of output: 792
21-23: Consider adding peer dependenciesThe removal of echarts might affect existing visualizations. Please verify if this was intentional.
✅ Verification successful
Echarts removal is safe to proceed
The codebase uses Sigma.js and Graphology for graph visualizations, with no remaining references to echarts. The removal appears intentional and won't affect existing visualizations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any remaining echarts usage rg -l 'echarts' frontend/Length of output: 25
Script:
#!/bin/bash # Case-insensitive search for echarts and related terms rg -il 'echarts|ECharts|vue-echarts' frontend/ # Search for visualization/chart related files and their content fd -e vue -e js -e ts . frontend/ --exec rg -l 'chart|graph|visualization|visualisation' # Search package.json history for echarts git log -p frontend/package.json | rg -B5 -A5 'echarts'Length of output: 197
Script:
#!/bin/bash # Check content of files with graph/chart matches echo "=== Content of frontend/src/app/page.js ===" cat frontend/src/app/page.js echo -e "\n=== Content of frontend/src/components/Graph.js ===" cat frontend/src/components/Graph.jsLength of output: 5060
.github/workflows/rust.yml (1)
13-14: LGTM! Clear path filteringThe path filter for
src/**is appropriate for Rust-specific changes.
There was a problem hiding this 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 (2)
.github/workflows/js.yml (2)
13-16:⚠️ Potential issueFix paths configuration in workflow
The workflow has conflicting path filters. According to actionlint, you cannot use both
pathsandpaths-ignorefor the same event.Apply this fix:
pull_request: paths: - 'frontend/**' - paths-ignore: - - '**.md'🧰 Tools
🪛 actionlint (1.7.4)
15-15: both "paths" and "paths-ignore" filters cannot be used for the same event "pull_request". note: use '!' to negate patterns
(events)
30-35:⚠️ Potential issueFix working directory configuration
The
cd frontendcommand only affects the current step. Subsequent steps will revert to the repository root.Replace the directory change with proper working-directory configuration:
- - name: Change directory to frontend - run: cd frontend - name: npm install - run: npm install --no-audit + run: npm install --no-audit + working-directory: ./frontend - name: npm lint - run: npm run lint --if-present + run: npm run lint --if-present + working-directory: ./frontend🧰 Tools
🪛 yamllint (1.35.1)
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
🧹 Nitpick comments (2)
.github/workflows/js.yml (2)
25-35: Add npm dependency cachingAdd caching to speed up the workflow and reduce load on npm servers.
Add this step after checkout:
- name: Checkout uses: actions/checkout@v4 + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-🧰 Tools
🪛 yamllint (1.35.1)
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
35-35: Add newline at end of fileAdd a newline character at the end of the file to comply with POSIX standards.
run: npm run lint --if-present +🧰 Tools
🪛 yamllint (1.35.1)
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/js.yml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/js.yml
15-15: both "paths" and "paths-ignore" filters cannot be used for the same event "pull_request". note: use '!' to negate patterns
(events)
🪛 yamllint (1.35.1)
.github/workflows/js.yml
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
.github/workflows/js.yml (1)
20-24: LGTM!The job configuration is clear and appropriate for the task.
There was a problem hiding this 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
🧹 Nitpick comments (3)
frontend/README.md (2)
5-7: Add descriptions for the pre-push checksThe commands are listed without explanation of what they do. Consider adding brief descriptions:
## Checks before push ```sh +# Format code using Biome npm run format +# Run linting checks npm run lint--- `18-21`: **Add development server URL information** After running `npm run dev`, add information about where the development server will be accessible. ```diff ```sh npm install npm run dev +# The development server will be available at http://localhost:3000</blockquote></details> <details> <summary>.github/workflows/js.yml (1)</summary><blockquote> `23-35`: **Consider adding caching for npm dependencies** Add caching to speed up the workflow and reduce load on npm servers: ```diff steps: - name: Checkout uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: 'frontend/.node-version' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json - name: mise uses: jdx/mise-action@v2 - - name: Change directory to frontend - run: cd frontend - name: npm install run: npm install --no-audit working-directory: ./frontend - name: npm lint run: npm run lint --if-present working-directory: ./frontend +🧰 Tools
🪛 yamllint (1.35.1)
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/js.yml(1 hunks).github/workflows/rust.yml(2 hunks)frontend/README.md(1 hunks)frontend/src/static/iconfont/iconfont.css(1 hunks)frontend/src/utils/api.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- .github/workflows/rust.yml
- frontend/src/static/iconfont/iconfont.css
- frontend/src/utils/api.js
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/js.yml
[error] 35-35: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (4)
frontend/README.md (1)
14-16: Consider using a placeholder for the server URLHardcoding the server URL in the README is not recommended as it may change in different environments and could expose sensitive infrastructure information.
.github/workflows/js.yml (3)
10-15: Fix paths configuration in workflowThe workflow has conflicting path filters. According to actionlint, you cannot use both
pathsandpaths-ignorefor the same event.
3-17: Add explicit permissions configurationThe workflow should explicitly declare its required permissions for security best practices.
28-30: Fix working directory configurationThe
cd frontendcommand only affects the current step. Subsequent steps will revert to the repository root.
Summary by CodeRabbit
Release Notes
CI/CD
Development Tools
Frontend
Chores