Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Jan 10, 2025

Bump all lint dependencies to their latest available versions except for the followings which will be updated later:

  • typescript plugin: use the latest version of the 7.x line. 8.x introduces new rules in the recommended configuration
  • eslint: use the latest version of the 8.x line. 9.x requires configuration changes (switch to flat config)

Lint the code according to the new rules.

Summary by CodeRabbit

  • Chores

    • Updated development dependencies:
      • Upgraded TypeScript ESLint plugins and parser
      • Updated ESLint and related plugins
      • Refreshed Prettier version
  • Refactor

    • Minor code readability improvements across multiple files
    • Added parentheses to clarify conditional expressions in various methods
    • Simplified logic in the toggleCellStyles method
    • No functional changes to existing code logic

Bump all lint dependencies to their latest available versions except for the followings which will be updated later:
  - typescript plugin: use the latest version of the 7.x line. 8.x introduces new rules in the recommended configuration
  - eslint: use the latest version of the 8.x line. 9.x requires configuration changes (switch to flat config)

Lint the code according to the new rules.
@tbouffard tbouffard added dependencies skip-changelog Do not include in Changelog and Release Notes javascript Pull requests that update Javascript code labels Jan 10, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2025

Walkthrough

This pull request involves a series of modifications across multiple files in the packages/core/src directory. The changes primarily focus on enhancing code readability by adding parentheses to clarify conditional expressions and nullish coalescing operations. Additionally, the package.json file has been updated with version upgrades for several development dependencies, including linting and formatting tools.

Changes

File Change Summary
package.json Updated versions of development dependencies:
- @typescript-eslint/eslint-plugin: ~7.0.2~7.18.0
- @typescript-eslint/parser: ~7.0.2~7.18.0
- eslint: ~8.56.0~8.57.1
- eslint-plugin-import: ~2.29.1~2.31.0
- eslint-plugin-prettier: ~5.1.3~5.2.1
- prettier: ~3.1.1~3.4.2
packages/core/src/serialization/ModelXmlSerializer.ts Added parentheses to conditional expression in export method
packages/core/src/view/GraphView.ts Added parentheses to conditional expressions in getEdgeStyle, getRoutingCenterX, and getRoutingCenterY methods
packages/core/src/view/cell/CellRenderer.ts Added parentheses to rotation style retrieval in redrawControl method
packages/core/src/view/geometry/Shape.ts Added parentheses to stroke width determination in getSvgScreenOffset method
packages/core/src/view/handler/ConstraintHandler.ts Modified connection constraints retrieval in setFocus method
packages/core/src/view/mixins/CellsMixin.ts Simplified style value assignment in toggleCellStyles method
packages/core/src/view/mixins/TooltipMixin.ts Added parentheses to tooltip retrieval in getTooltip method

Possibly related PRs


📜 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 807177a and 50b94ee.

📒 Files selected for processing (1)
  • packages/core/src/view/mixins/CellsMixin.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/view/mixins/CellsMixin.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build (macos-14)
  • GitHub Check: build
  • GitHub Check: build (ubuntu-22.04)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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)
packages/core/src/view/mixins/CellsMixin.ts (1)

336-336: Simplify the boolean expression.

The current expression can be simplified by using the logical NOT operator instead of a ternary with boolean literals.

Apply this diff to simplify the code:

-      value = (style[key] ?? defaultValue) ? false : true;
+      value = !(style[key] ?? defaultValue);
🧰 Tools
🪛 Biome (1.9.4)

[error] 336-336: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ce7d72f and 807177a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • package.json (1 hunks)
  • packages/core/src/serialization/ModelXmlSerializer.ts (1 hunks)
  • packages/core/src/view/GraphView.ts (2 hunks)
  • packages/core/src/view/cell/CellRenderer.ts (1 hunks)
  • packages/core/src/view/geometry/Shape.ts (1 hunks)
  • packages/core/src/view/handler/ConstraintHandler.ts (1 hunks)
  • packages/core/src/view/mixins/CellsMixin.ts (1 hunks)
  • packages/core/src/view/mixins/TooltipMixin.ts (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • packages/core/src/view/cell/CellRenderer.ts
  • packages/core/src/serialization/ModelXmlSerializer.ts
  • packages/core/src/view/geometry/Shape.ts
  • packages/core/src/view/mixins/TooltipMixin.ts
  • packages/core/src/view/GraphView.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/core/src/view/mixins/CellsMixin.ts

[error] 336-336: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (windows-2022)
  • GitHub Check: build
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-22.04)
🔇 Additional comments (4)
packages/core/src/view/handler/ConstraintHandler.ts (1)

392-392: LGTM! Improved operator precedence clarity.

The addition of parentheses around the nullish coalescing operation (this.graph.getAllConnectionConstraints(state, source) ?? []) enhances code readability by making the operator precedence explicit.

package.json (3)

24-25: LGTM! TypeScript ESLint packages are in sync

The update to v7.18.0 for both @typescript-eslint/eslint-plugin and @typescript-eslint/parser maintains version parity and adheres to the constraint of staying on the 7.x line to avoid new recommended rules.


26-26: Verify ESLint compatibility matrix

The ESLint update to 8.57.1 maintains compatibility with 8.x as required. Let's verify the compatibility of the updated plugins with this version.

Also applies to: 28-29

✅ Verification successful

✓ ESLint and plugin versions are compatible and up-to-date

  • ESLint 8.57.1 is the latest available 8.x version
  • Both eslint-plugin-import 2.31.0 and eslint-plugin-prettier 5.2.1 are compatible with ESLint 8.x
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check latest versions and peer dependencies

# Check latest versions within constraints
echo "Latest ESLint 8.x version:"
curl -s https://registry.npmjs.org/eslint | jq -r '[.versions[] | select(startswith("8."))] | max_by(.)'

echo "\nESLint Plugin Import peer dependencies:"
curl -s https://registry.npmjs.org/eslint-plugin-import/2.31.0 | jq '.peerDependencies'

echo "\nESLint Plugin Prettier peer dependencies:"
curl -s https://registry.npmjs.org/eslint-plugin-prettier/5.2.1 | jq '.peerDependencies'

Length of output: 779


Script:

#!/bin/bash
# Description: Check if ESLint 8.57.1 is the latest 8.x version
echo "Latest ESLint 8.x versions:"
curl -s https://registry.npmjs.org/eslint | jq -r '.versions | keys[] | select(startswith("8."))' | sort -V | tail -n 5

Length of output: 221


30-30: Verify Prettier compatibility and breaking changes

The update to Prettier 3.4.2 is a significant jump. Let's verify compatibility and check for breaking changes.

✅ Verification successful

Prettier update is compatible

The update to Prettier 3.4.2 is safe with the current eslint-plugin-prettier version (~5.2.1). Both versions are up-to-date and compatible.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Prettier compatibility and changelog

# Check latest versions and release notes
echo "Latest Prettier versions:"
curl -s https://registry.npmjs.org/prettier | jq -r '[.versions[] | select(startswith("3."))] | max_by(.)'

# Check compatibility with eslint-plugin-prettier
echo "\nPrettier peer dependencies:"
curl -s https://registry.npmjs.org/prettier/3.4.2 | jq '.peerDependencies'

# Look for CHANGELOG.md to check breaking changes
fd -t f "CHANGELOG.md" | xargs rg -A 5 "3\.4\.0"

Length of output: 897


Script:

#!/bin/bash
# Description: Retry compatibility check with corrected commands

# Check Prettier versions correctly
echo "Latest Prettier version:"
curl -s https://registry.npmjs.org/prettier | jq -r '."dist-tags".latest'

# Check local eslint-plugin-prettier version
echo "\nLocal ESLint Prettier plugin version:"
cat package.json | jq -r '.dependencies["eslint-plugin-prettier"] // .devDependencies["eslint-plugin-prettier"] // "not found"'

# Try to find breaking changes in release notes
echo "\nPrettier 3.4.0 release notes:"
curl -s "https://api.github.com/repos/prettier/prettier/releases/tags/3.4.0" | jq -r '.body'

Length of output: 666

@tbouffard tbouffard merged commit ca30dad into main Jan 10, 2025
6 checks passed
@tbouffard tbouffard deleted the chore/bump_some_eslint_dependencies branch January 10, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies javascript Pull requests that update Javascript code skip-changelog Do not include in Changelog and Release Notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant