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

feat: add react-compiler eslint plugin #37139

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

znamenskii-ilia
Copy link
Contributor

@znamenskii-ilia znamenskii-ilia commented Oct 30, 2024

Description

Added react-compiler eslint plugin as the first step in preparation for adding React Compiler
https://react.dev/learn/react-compiler#installing-eslint-plugin-react-compiler

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11613472733
Commit: 89b1e8f
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Thu, 31 Oct 2024 14:48:54 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced linting capabilities with the addition of the eslint-plugin-react-compiler for improved React code quality.
  • Chores

    • Updated ESLint configuration to include a new rule for the React compiler, issuing warnings to maintain coding standards.
    • Added eslint-plugin-react-compiler as a new development dependency.

Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Walkthrough

The pull request introduces updates to the ESLint configuration and the package dependencies for the appsmith project. Specifically, it adds the eslint-plugin-react-compiler plugin and a corresponding rule to the ESLint configuration file, enhancing linting capabilities for React components. Additionally, the package.json file is modified to include this new plugin as a development dependency. The overall structure of both files remains unchanged, with no alterations to existing rules or dependencies.

Changes

File Change Summary
app/client/.eslintrc.base.json Added plugin eslint-plugin-react-compiler and rule react-compiler/react-compiler: "warn"
app/client/package.json Added dependency eslint-plugin-react-compiler: "beta" under devDependencies

Possibly related PRs

Suggested labels

Task

Suggested reviewers

  • AmanAgarwal041
  • KelvinOm

Poem

In the land of code where rules do play,
A new plugin joins the ESLint fray.
With warnings to guide on React's path,
Clean code awaits, avoiding the wrath.
So let’s lint with cheer, our standards high,
For every component, let errors fly! 🎉


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5cfdd21 and 89b1e8f.

⛔ Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • app/client/.eslintrc.base.json (2 hunks)
  • app/client/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/.eslintrc.base.json
  • app/client/package.json

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

@github-actions github-actions bot added the Enhancement New feature or request label Oct 30, 2024
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 and nitpick comments (2)
app/client/.eslintrc.base.json (2)

45-45: Consider documenting the rule's purpose.

Adding a comment above the rule would help other developers understand why this warning-level rule was added and its relationship to the React Compiler integration.

+  // Enable React Compiler warnings to prepare for full integration
   "react-compiler/react-compiler": "warn",

14-14: Review beta dependency status.

The React Compiler ESLint plugin is currently in beta. Consider:

  1. Adding a TODO comment to update once a stable version is released
  2. Documenting any known limitations or issues
  3. Setting up a process to monitor for stable release

Also applies to: 45-45

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 764d8f3 and 5cfdd21.

⛔ Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • app/client/.eslintrc.base.json (2 hunks)
  • app/client/package.json (1 hunks)
🔇 Additional comments (1)
app/client/package.json (1)

324-324: ⚠️ Potential issue

Consider pinning the beta version for stability.

Using an unpinned beta version ("eslint-plugin-react-compiler": "beta") could lead to unexpected breaking changes. Consider pinning to a specific beta version number.

Let's verify the package's latest beta version and maintenance status:

-    "eslint-plugin-react-compiler": "beta",
+    "eslint-plugin-react-compiler": "0.1.0-beta.1",
✅ Verification successful

Update the version to the latest beta for stability

Based on the npm registry data, let's pin to the current beta version 19.0.0-beta-6fc168f-20241025. This package is officially maintained by the React team and was recently published.

-    "eslint-plugin-react-compiler": "beta",
+    "eslint-plugin-react-compiler": "19.0.0-beta-6fc168f-20241025"
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Get package information from npm
echo "Package Information:"
npm view eslint-plugin-react-compiler

# Check package download statistics for popularity
echo -e "\nDownload Statistics:"
npm view eslint-plugin-react-compiler downloads

Length of output: 1421

@@ -11,6 +11,7 @@
],
"plugins": [
"react",
"eslint-plugin-react-compiler",
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

Beta dependency poses production risk

The eslint-plugin-react-compiler is currently using a beta version (19.0.0-beta-6fc168f-20241025). Using beta dependencies in production code can lead to instability and unexpected behavior.

  • Consider waiting for a stable release before integrating this plugin
  • If beta version is required, document the decision and potential risks in the project documentation
  • Set up a process to track and upgrade the plugin once a stable version is available
🔗 Analysis chain

Verify plugin installation and version.

Let's ensure the plugin is properly installed and its version is appropriate for production use.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the plugin is installed and get its version
jq '.devDependencies["eslint-plugin-react-compiler"]' app/client/package.json

Length of output: 86


Script:

#!/bin/bash
# Check if the plugin is published on npm and get its latest version
npm view eslint-plugin-react-compiler version 2>/dev/null || echo "Package not found"

# Search for any documentation or usage of this plugin in the codebase
rg -l "react-compiler" --type md

Length of output: 109

@alex-golovanov alex-golovanov self-requested a review October 30, 2024 11:29
@znamenskii-ilia znamenskii-ilia added the ok-to-test Required label for CI label Oct 30, 2024
@znamenskii-ilia znamenskii-ilia force-pushed the feat/react-compiler-eslint-plugin branch from 5cfdd21 to 89b1e8f Compare October 31, 2024 14:07
@znamenskii-ilia znamenskii-ilia merged commit 951be4a into release Oct 31, 2024
45 checks passed
@znamenskii-ilia znamenskii-ilia deleted the feat/react-compiler-eslint-plugin branch October 31, 2024 15:40
@coderabbitai coderabbitai bot mentioned this pull request Nov 6, 2024
2 tasks
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
## Description
Added react-compiler eslint plugin as the first step in preparation for
adding React Compiler

https://react.dev/learn/react-compiler#installing-eslint-plugin-react-compiler


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11613472733>
> Commit: 89b1e8f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11613472733&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 31 Oct 2024 14:48:54 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


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

## Summary by CodeRabbit

- **New Features**
- Enhanced linting capabilities with the addition of the
`eslint-plugin-react-compiler` for improved React code quality.

- **Chores**
- Updated ESLint configuration to include a new rule for the React
compiler, issuing warnings to maintain coding standards.
	- Added `eslint-plugin-react-compiler` as a new development dependency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Dec 31, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants