Skip to content

Conversation

@alexeyr-ci2
Copy link
Contributor

@alexeyr-ci2 alexeyr-ci2 commented Apr 7, 2025

Upgrade to the current version of typescript-eslint.

Part 1 of #489.

Summary by CodeRabbit

  • Chores
    • Updated developer dependencies and linting configurations to improve code quality.
  • Refactor
    • Streamlined asynchronous operations by eliminating redundant promise wrapping for clearer execution.
  • Style
    • Refined inline guidance and error-handling patterns for consistent development practices.
  • Tests
    • Adjusted test directives to align with updated standards.

These internal improvements enhance maintainability and performance without altering visible features for end-users.

@coderabbitai
Copy link

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request updates several ESLint configurations and dependency versions for TypeScript. The changes adjust rule options (e.g., adding a caughtErrorsIgnorePattern), update package versions, and modify ESLint directive comments to reflect new linting practices. In addition, asynchronous functions in the worker modules have been streamlined by removing redundant promise wrapping and adding necessary await statements. Overall, these modifications improve code clarity around lint rules and asynchronous handling without affecting core functionality.

Changes

File(s) Change Summary
.eslintrc Updated the @typescript-eslint/no-unused-vars rule by adding caughtErrorsIgnorePattern: "^_" to ignore caught errors starting with an underscore.
package.json Upgraded the typescript-eslint dependency from ^7.4.0 to ^8.29.1.
packages/node-renderer/src/{ReactOnRailsProNodeRenderer.ts, sentry6.ts, shared/log.ts} Revised ESLint directive comments: replaced no-var-requires with no-require-imports and renamed error variable e to _e for indicating intentional non-use.
packages/node-renderer/src/shared/tracing.ts Added ESLint disable/enable comments to manage rules for empty object types used in interface declarations.
packages/node-renderer/src/worker/{handleRenderRequest.ts, vm.ts} Removed unnecessary Promise.resolve wrappers and incorporated await calls to streamline asynchronous response handling.
packages/node-renderer/tests/shared/tracing.test.ts Inserted an ESLint disable comment for deprecated feature usage in a test case.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant H as RenderRequestHandler
    participant P as prepareResult
    participant N as handleNewBundleProvided

    C->>H: Send render request
    H->>P: await prepareResult(...)
    P-->>H: Return result
    alt New bundle available
        H->>N: await handleNewBundleProvided(...)
        N-->>H: Return bundle response
    end
    H-->>C: Return final response
Loading

Poem

I'm a happy rabbit in the code garden,
Skipping through lint rules with a gentle pardon.
Unused vars and caught errors now unseen,
Promises unwrap like a fresh spring green.
With hops and beats, my joy's complete,
Celebrating changes with a rhythmic tweet!
🥕 Code carrots make the journey sweet.

Warning

Review ran into problems

🔥 Problems

GitHub Actions and Pipeline Checks: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository.

Please grant the required permissions to the CodeRabbit GitHub App under the organization or repository settings.


📜 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 6d65e3b and 7df2d8a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • .eslintrc (1 hunks)
  • package.json (1 hunks)
  • packages/node-renderer/src/ReactOnRailsProNodeRenderer.ts (1 hunks)
  • packages/node-renderer/src/integrations/sentry6.ts (2 hunks)
  • packages/node-renderer/src/shared/log.ts (1 hunks)
  • packages/node-renderer/src/shared/tracing.ts (2 hunks)
  • packages/node-renderer/src/worker/handleRenderRequest.ts (6 hunks)
  • packages/node-renderer/src/worker/vm.ts (1 hunks)
  • packages/node-renderer/tests/shared/tracing.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/node-renderer/tests/shared/tracing.test.ts
  • packages/node-renderer/src/integrations/sentry6.ts
  • package.json
  • .eslintrc
  • packages/node-renderer/src/shared/tracing.ts
  • packages/node-renderer/src/ReactOnRailsProNodeRenderer.ts
  • packages/node-renderer/src/worker/vm.ts
  • packages/node-renderer/src/shared/log.ts
  • packages/node-renderer/src/worker/handleRenderRequest.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-test

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

log.info('buildVM, bundleFilePathPerTimestamp', bundleFilePathPerTimestamp);
await buildVM(bundleFilePathPerTimestamp);
return prepareResult(renderingRequest, bundleFilePathPerTimestamp);
return await prepareResult(renderingRequest, bundleFilePathPerTimestamp);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://typescript-eslint.io/rules/return-await

@alexeyr-ci2 alexeyr-ci2 force-pushed the alexeyr/upgrade-typescript-eslint branch from 6d65e3b to 7df2d8a Compare April 7, 2025 18:52
@alexeyr-ci2 alexeyr-ci2 mentioned this pull request Apr 9, 2025
Copy link
Contributor

@Judahmeek Judahmeek left a comment

Choose a reason for hiding this comment

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

Can you explain why you removed so many Promise.resolve calls?

@alexeyr-ci2
Copy link
Contributor Author

@Judahmeek

Can you explain why you removed so many Promise.resolve calls?

In async functions, returning Promise.resolve(x) is just a slower and less clear version of returning x. It's possible those functions were non-async some long time ago, and then the calls weren't removed when it changed. The new TypeScript-ESLint version can detect them.

@alexeyr-ci2
Copy link
Contributor Author

@Judahmeek return Promise.reject(x) can similarly be replaced by throw x but I believe that's slower, so I didn't make that change.

@alexeyr-ci2 alexeyr-ci2 merged commit 7ae2bf7 into master Apr 10, 2025
10 checks passed
@alexeyr-ci2 alexeyr-ci2 deleted the alexeyr/upgrade-typescript-eslint branch April 10, 2025 07:10
alexeyr-ci2 added a commit that referenced this pull request Apr 10, 2025
Upgrade ESLint and plugins and switch to flat config.

Part 2 of #489, needs #528 to be merged.

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

## Summary by CodeRabbit

- **Chores**
- Enhanced the linting setup and configurations to improve coding
standards and error detection.
	- Adjusted linting commands to streamline the process.
- Updated development dependencies to their latest versions for better
performance and consistency.
- Upgraded Ruby version across various configuration files to ensure
compatibility and improvements.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alexey Romanov <[email protected]>
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.

4 participants