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

chore: replace babel-eslint with @babel/eslint-parser #812

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

houhoucoop
Copy link
Contributor

@houhoucoop houhoucoop commented Nov 13, 2024

What this PR does / why we need it

Replaces babel-eslint with @babel/eslint-parser, which requires ESLint 7.5.0 or higher.
The bot PR failed, so we’re upgrading ESLint manually in this PR.

Issue

#776

Test Result

0 error from npm run lint

Additional documentation or context

Some new rules are disabled to avoid many file changes in this PR.
They can be reviewed again when we introduce Prettier in the future.

Summary by CodeRabbit

  • Chores
    • Updated ESLint configuration to enhance linting capabilities.
    • Removed outdated dependencies and added new ones for improved compatibility.
    • Upgraded several ESLint-related packages to their latest versions.

@houhoucoop houhoucoop self-assigned this Nov 13, 2024
Copy link

coderabbitai bot commented Nov 13, 2024

Walkthrough

The changes involve significant updates to the ESLint configuration and related dependencies within the project. The .eslintrc file has been modified to disable several rules, update the parser to @babel/eslint-parser, and adjust ECMAScript version settings. Additionally, the package.json file reflects the removal of babel-eslint, the addition of @babel/eslint-parser, and updates to various ESLint-related packages, enhancing the linting capabilities and ensuring compatibility with newer JavaScript features.

Changes

File Change Summary
.eslintrc Updated parser from babel-eslint to @babel/eslint-parser, changed ecmaVersion from 8 to 2020, disabled multiple rules, and added new rules for Airbnb config version 18.
package.json Added @babel/eslint-parser, removed babel-eslint, and updated versions for several ESLint-related packages (eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react).

Poem

In the land of code where rabbits play,
ESLint rules have changed today! 🐇✨
With new tools and settings bright,
Our linting game is now just right.
Hopping through the code with glee,
Clean and clear, as it should be!


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.

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.

@houhoucoop houhoucoop added the dependencies Pull requests that update a dependency file label Nov 13, 2024
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -78,12 +78,11 @@
"css-loader": "^2.1.1",
"cssnano": "^4.1.10",
"es5-imcompatible-versions": "^0.1.34",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-compat": "^2.2.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is used in the code.

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

🧹 Outside diff range and nitpick comments (1)
.eslintrc (1)

Line range hint 12-87: Document the temporary nature of disabled rules

While disabling these rules is intentional as per PR objectives (pending Prettier integration), it would be helpful to document this in the configuration file itself to prevent these temporary changes from becoming permanent.

Add a comment at the top of the rules section:

  "rules": {
+   // Note: Many rules are temporarily disabled pending Prettier integration
    "semi": [
      2,
      "never"
    ],
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 55c62be and 5c80080.

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

89-95: LGTM: Parser and ECMAScript version updates

The changes align well with the PR objectives:

  • Upgrade to @babel/eslint-parser is the main goal
  • ECMAScript 2020 support enables modern JavaScript features

96-96: Verify impact of disabling Babel config requirement

Setting requireConfigFile: false bypasses the need for a Babel configuration file. While this simplifies setup, it could lead to unexpected parsing behavior if Babel-specific features are used.

Let's check if there are any Babel-specific features in use:

package.json (2)

81-85: Consider upgrading to ESLint 8.x and verify breaking changes

The updates look compatible, but there are a few considerations:

  1. ESLint 7.x is approaching end-of-life. Consider upgrading to ESLint 8.x in a future PR.
  2. The upgrade from eslint-config-airbnb 17.x to 18.x might introduce breaking changes.
#!/bin/bash
# Check for breaking changes in eslint-config-airbnb
echo "Checking eslint-config-airbnb changelog for breaking changes between v17 and v18:"
gh api repos/airbnb/javascript/releases | jq -r '.[] | select(.tag_name | startswith("eslint-config-airbnb-v18")) | .body'

# Verify peer dependency requirements
echo "\nVerifying peer dependencies:"
npm info [email protected] peerDependencies

Consider creating a separate PR for upgrading to ESLint 8.x after this change is stable. This would help isolate any potential issues and make the changes more manageable.


43-43: Verify @babel/eslint-parser version and consider upgrading

While the migration from babel-eslint to @babel/eslint-parser is correct, version 7.25.9 is relatively old.

✅ Verification successful

@babel/eslint-parser version is up-to-date and secure

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for latest version and any security advisories
echo "Latest version from npm:"
npm view @babel/eslint-parser version

echo "\nChecking for security advisories:"
npm audit --json @babel/[email protected] | jq '.advisories'

Length of output: 350


Script:

#!/bin/bash
# Check for latest version and any security advisories
echo "Latest version from npm:"
npm view @babel/eslint-parser version

echo -e "\nChecking for security advisories:"
npm audit --json @babel/[email protected] | jq '.advisories'

Length of output: 257

Copy link
Contributor

@a110605 a110605 left a comment

Choose a reason for hiding this comment

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

npm run lint is good.

Screenshot 2024-11-14 at 4 25 17 PM

@houhoucoop houhoucoop merged commit 91265da into longhorn:master Nov 15, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants