Skip to content

Conversation

@alexeyr-ci2
Copy link
Contributor

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

Upgrade ESLint and plugins and switch to flat config.

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

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.

@coderabbitai
Copy link

coderabbitai bot commented Apr 7, 2025

Walkthrough

The pull request removes the .eslintignore file and introduces a new ESLint configuration file (eslint.config.mjs) that defines linting rules, plugins, and ignore patterns. The linting command in the package-scripts.yml file is updated to remove explicit file extension options. In addition, the package.json file has been modified to add new dependencies and update several ESLint-related packages. The Ruby version is also updated across multiple files. No changes were made to the declarations of exported or public entities.

Changes

File(s) Change Summary
.eslintignore, .eslintrc, eslint.config.mjs, package-scripts.yml Removed .eslintignore and .eslintrc; added new ESLint configuration in eslint.config.mjs with defined rules and ignore patterns; updated ESLint script by removing the --ext flag in package-scripts.yml.
package.json Added new dependencies (@eslint/compat, globals) and updated versions for eslint, eslint-config-prettier, and multiple ESLint plugins (import, jest, jsx-a11y, prettier, react, react-hooks).
.circleci/config.yml, .controlplane/Dockerfile, Gemfile.development_dependencies, spec/execjs-compatible-dummy/Dockerfile, spec/execjs-compatible-dummy/Gemfile Updated Ruby version from 3.3.0 to 3.3.7 across multiple files.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Script as PackageScripts
    participant ESL as ESLint Engine
    participant Conf as eslint.config.mjs

    Dev->>Script: Run ESLint command
    Script->>ESL: Execute linting process
    ESL->>Conf: Load linting configuration
    Conf-->>ESL: Provide rules and ignore patterns
    ESL->>Dev: Return linting results
Loading

Possibly related PRs

Suggested reviewers

  • AbanoubGhadban
  • Judahmeek

Poem

I'm Bunny the coder in a techy wonderland,
Hopping through configs with a skip so grand.
I left old ignores in the past, you see,
Now new rules guide my every code spree.
Dependencies updated, the path is now clear—
With rhythmic hops, I cheer our linting cheer! 🐇✨

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.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@alexeyr-ci2
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Apr 7, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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)
eslint.config.mjs (1)

42-92: Revisit disabled lint rules for tighter code hygiene.

Turning off rules such as no-console, no-restricted-syntax, and import/no-extraneous-dependencies can lead to less strict enforcement. Consider re-enabling them (at least set no-console to warn) if you wish to maintain stricter standards and catch potential errors or oversights.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7df2d8a and f032b49.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .eslintignore (0 hunks)
  • eslint.config.mjs (1 hunks)
  • package-scripts.yml (1 hunks)
  • package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • .eslintignore
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-test
🔇 Additional comments (8)
package-scripts.yml (1)

59-59:

❓ Verification inconclusive

Consider verifying lint coverage for all desired file types.

Removing the --ext option causes ESLint to rely on default extension detection, which may cause unintentional files to be linted or some files to be skipped depending on your configuration. Ensure that the new approach aligns with your project needs and doesn't degrade lint coverage.


🏁 Script executed:

#!/bin/bash
# This script checks for potential coverage of .jsx, .ts, and .tsx files
# to see if they're being linted. Adjust the pattern if needed.
eslint "packages/**/*.jsx" "packages/**/*.ts" "packages/**/*.tsx" --print-config | grep "filePath"

Length of output: 195


Important: Manual Verification of ESLint Configuration Required

Removing the --ext option means that ESLint now relies on its default extension handling, which could lead to unintended file inclusions or exclusions (e.g., .jsx, .ts, .tsx files). Note that the verification script failed because ESLint wasn’t found (it may not be installed globally). Please manually confirm that:

  • ESLint is accessible (consider using npx eslint if it’s only installed locally).
  • The lint configuration indeed covers all desired file types, including .jsx, .ts, and .tsx.
  • The removal of the --ext option doesn’t inadvertently degrade lint coverage.
eslint.config.mjs (6)

1-17: Good adoption of FlatCompat for legacy configuration bridging.

Defining a FlatCompat instance to bridge existing configs with the new flat config is a standard approach. This setup appears correct, ensuring your older .eslintrc.* features carry over smoothly.


18-41: Global ignore patterns look appropriate.

Excluding coverage, node_modules, and other generated assets is a common best practice. No issues spotted here.


93-133: Strict TypeScript checks are solid.

Including typescript-eslint/configs/strictTypeChecked and enabling rules like @typescript-eslint/no-shadow will help catch subtle bugs and improve type safety. Good job!


134-156: Well-configured Jest plugin settings.

Enforcing jest/no-focused-tests and similar rules helps maintain proper test hygiene. This configuration aligns with best practices for test code.


157-170: Effective use of restricted imports for integrations.

Prohibiting relative parent imports ensures that integration code only uses the public API, improving modularity and maintainability. Nicely done!


171-174: Ensuring Prettier plugin is last is correct.

Placing prettierRecommended as the final configuration ensures that Prettier rules override any conflicting style settings from previous configs.

package.json (1)

54-54:

❓ Verification inconclusive

Check for potential version conflicts when upgrading ESLint and plugins.

You've introduced or updated several ESLint-related dependencies (@eslint/compat, eslint, plugin packages, etc.). Verify that there are no unmet peer dependencies or version mismatches, especially if other packages still depend on older ESLint versions.

Also applies to: 64-65, 67-73, 76-76


🏁 Script executed:

#!/bin/bash
# Investigate installed versions of ESLint and its plugins for potential conflicts
yarn list --pattern eslint
yarn list --pattern eslint-plugin

Length of output: 1709


ESLint Dependency Versions Review

The yarn output confirms that most ESLint-related dependencies—including @eslint/compat (v1.2.8), eslint (v9.24.0), and various plugins—are consistently upgraded. However, note that there is a minor version discrepancy for @eslint/core: one instance is at v0.12.0 while @eslint/plugin-kit pulls in v0.13.0. Although nested dependencies sometimes legitimately use slightly different versions, please verify that this difference won’t lead to runtime issues or unmet peer dependency warnings, especially if any part of the codebase still expects the older version.

Action Items:

  • Confirm that the minor version difference in @eslint/core is intentional and compatible with your ESLint configuration.
  • Ensure that no other packages are enforcing older ESLint versions which might cause conflicts.
  • Re-assess similar dependency updates on lines 64-65, 67-73, and 76-76 of package.json.

lint-js-and-ruby:
docker:
- image: &docker_image cimg/ruby:3.3.0-browsers
- image: &docker_image cimg/ruby:3.3.7-browsers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous version includes Node 20.10, which doesn't have import.meta.dirname. Other Ruby version changes are for consistency with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or I could replace import.meta.dirname with the older approach.

Base automatically changed from alexeyr/upgrade-typescript-eslint to master April 10, 2025 07:10
@alexeyr-ci2 alexeyr-ci2 force-pushed the alexeyr/upgrade-eslint branch from 7cf6736 to 55275fc Compare April 10, 2025 07:12
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 (6)
eslint.config.mjs (6)

1-11: Confirm the correctness of typescript-eslint import.
Most setups rely on packages such as @typescript-eslint/eslint-plugin or @typescript-eslint/parser rather than a generic typescript-eslint import. Double-check that you have the correct package installed and that this import path is supported by your dependencies.


19-41: Remove duplicate ignore patterns.
You appear to ignore both the top-level folders and their children (e.g., **/coverage and **/coverage/**/*). This duplication is unnecessary. One ignore pattern per folder typically suffices.

Apply this diff to simplify:

-    '**/coverage',
-    '**/coverage/**/*',
-    '**/node_modules',
-    '**/node_modules/**/*',
+    '**/coverage/',
+    '**/node_modules/',

42-44: Include ctsx/mtsx files if needed.
Currently, patterns cover **/*.[cm][jt]s and **/*.[jt]sx, but not ctsx/mtsx (like .ctsx or .mtsx). If you have or foresee ctsx/mtsx usage, consider incorporating these extensions.


70-97: Reevaluate turning off key ESLint rules.
Rules like no-console: off, no-restricted-syntax: off, and import/no-extraneous-dependencies: off can mask issues, especially for production builds or maintainability. Consider enabling them with lower severities (e.g., warn) or adjusting them specifically rather than completely disabling.


99-136: Add recommended TypeScript rules for safer code.
You are extending strictTypeChecked, which is great. Consider adding additional rules such as @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-function-return-type, or @typescript-eslint/strict-boolean-expressions if you want stricter checks on your TS codebase.


137-173: Enhance test and integration rules.
For Jest, you may benefit from rules like jest/prefer-expect-assertions or jest/prefer-lowercase-title to further standardize test style. For integration files, ensure no unintentional imports are accidentally permitted.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f032b49 and 55275fc.

⛔ Files ignored due to path filters (4)
  • Gemfile.lock is excluded by !**/*.lock
  • spec/dummy/Gemfile.lock is excluded by !**/*.lock
  • spec/execjs-compatible-dummy/Gemfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • .circleci/config.yml (1 hunks)
  • .controlplane/Dockerfile (1 hunks)
  • .eslintignore (0 hunks)
  • .eslintrc (0 hunks)
  • Gemfile.development_dependencies (1 hunks)
  • eslint.config.mjs (1 hunks)
  • package-scripts.yml (1 hunks)
  • package.json (2 hunks)
  • spec/execjs-compatible-dummy/Dockerfile (1 hunks)
  • spec/execjs-compatible-dummy/Gemfile (1 hunks)
💤 Files with no reviewable changes (2)
  • .eslintignore
  • .eslintrc
🚧 Files skipped from review as they are similar to previous changes (2)
  • package-scripts.yml
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-test
🔇 Additional comments (6)
.controlplane/Dockerfile (1)

1-1: Ruby version update looks good

Updating the base Ruby image from 3.3.0 to 3.3.7 ensures you get the latest security patches and bug fixes. This change aligns with the Ruby version updates in other files.

Gemfile.development_dependencies (1)

6-6: Ruby version update is consistent

The update to Ruby 3.3.7 in the Gemfile.development_dependencies matches the Docker image update, maintaining consistency across development and runtime environments.

spec/execjs-compatible-dummy/Gemfile (1)

5-5: Ruby version update is aligned with other files

The Ruby version update to 3.3.7 in this test application Gemfile is consistent with the changes made to other files, ensuring uniform Ruby versions across all environments.

spec/execjs-compatible-dummy/Dockerfile (1)

4-4: Ruby version ARG updated properly

The update of the RUBY_VERSION argument to 3.3.7 ensures that the test Docker container uses the same Ruby version as specified in other configuration files. This maintains consistency across all environments.

.circleci/config.yml (1)

113-116: Ruby Docker Image Version Upgraded

The Docker image for the lint-js-and-ruby job has been updated from cimg/ruby:3.3.0-browsers to cimg/ruby:3.3.7-browsers. This change aligns the CI configuration with Ruby version upgrades made elsewhere in the project, ensuring consistency across jobs. The update looks correct and should help avoid potential compatibility issues with newer Ruby enhancements.

-      - image: &docker_image cimg/ruby:3.3.0-browsers
+      - image: &docker_image cimg/ruby:3.3.7-browsers
eslint.config.mjs (1)

174-177: Nice placement of Prettier configuration.
Keeping prettierRecommended at the end ensures its rules properly override other styling conflicts.

@alexeyr-ci2 alexeyr-ci2 merged commit 156d5a2 into master Apr 10, 2025
10 checks passed
@alexeyr-ci2 alexeyr-ci2 deleted the alexeyr/upgrade-eslint branch April 10, 2025 07:25
alexeyr-ci2 added a commit that referenced this pull request Apr 27, 2025
Part 3 of #489, needs #529 to be merged.

Closes #489.

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


- **Chores**
- Upgraded dependencies and streamlined build configurations for
improved stability.
- Added new steps for installing Node modules and Ruby gems in the CI
workflow.
- **Refactor**
	- Simplified component interfaces and standardized code styles.
- Improved type safety and clarity in function parameters across various
components.
	- Modified promise handling and control flow for better readability.
	- Updated object property merging syntax for better clarity.
- **Style**
- Enhanced accessibility with explicit image alt texts, button type
definitions, and clearer label associations.
- **Tests**
- Refined test assertions for consistency and improved CI workflow for
more reliable validations.

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