Skip to content

chore: Cleanup lint warnings #6503

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

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft

Conversation

sidharthv96
Copy link
Member

📑 Summary

Brief description about the content of your PR.

Resolves #

📏 Design Decisions

Describe the way your implementation works or what design decisions you made if applicable.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Apr 19, 2025

⚠️ No Changeset found

Latest commit: 6462f73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Apr 19, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 6462f73
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/68032befbd733800086fef95
😎 Deploy Preview https://deploy-preview-6503--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Apr 19, 2025

Open in StackBlitz

npm i https://pkg.pr.new/mermaid-js/mermaid@6503
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@6503
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@6503
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@6503

commit: 6462f73

@sidharthv96 sidharthv96 force-pushed the sidv/cleanupEslintNullish branch from fcb32ff to 6462f73 Compare April 19, 2025 04:51
@sidharthv96 sidharthv96 requested a review from Copilot April 19, 2025 04:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR cleans up several lint warnings by replacing explicit undefined checks with the nullish coalescing (??/??=) operators throughout the codebase. The changes enhance readability and consistency without altering the underlying logic.

  • Replaces if-check assignments with nullish coalescing assignments.
  • Updates conditional checks and attribute assignments to use the modern operator syntax.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/parser/src/language/common/valueConverter.ts Uses nullish assignment for custom converter fallback.
packages/mermaid/src/diagrams/packet/parser.ts Replaces undefined block.end assignment with nullish coalescing.
packages/mermaid/src/diagrams/class/classRenderer-v2.ts Updates tooltip retrieval using nullish coalescing.
packages/mermaid/src/diagrams/class/classDiagram.ts Simplifies configuration object initialization.
packages/mermaid/src/diagrams/class/classDiagram-v2.ts Simplifies configuration object initialization.
packages/mermaid/src/diagrams/class/classDb.ts Defines function array type and refactors tooltip element check.
packages/mermaid/src/diagrams/block/renderHelpers.ts Refines class string derivation with nullish coalescing.
packages/mermaid/src/diagrams/block/blockDB.ts Implements nullish coalescing for classes assignment.
packages/mermaid/src/diagrams/architecture/architectureRenderer.ts Uses nullish coalescing in transform attribute assignment.
packages/mermaid/src/dagre-wrapper/nodes.js Applies nullish coalescing for id and class concatenation.
packages/mermaid/src/dagre-wrapper/mermaid-graphlib.js Adds type annotations via JSDoc comments.
packages/mermaid/src/dagre-wrapper/edges.js Refactors terminalLabels assignments and path lookup.
packages/mermaid/src/dagre-wrapper/createLabel.js Updates the default assignment for vertexText.
packages/mermaid/src/dagre-wrapper/clusters.js Uses nullish coalescing for shape determination.
packages/mermaid/src/config.ts Applies nullish coalescing for themeVariables assignment.
packages/mermaid-layout-elk/src/render.ts Replaces various default assignments with nullish coalescing.
cypress/integration/rendering/journey.spec.js Uses nullish coalescing when computing maxLineWidth.
cypress/integration/rendering/imageShape.spec.ts Updates label position description default using nullish coalescing.
cypress/integration/rendering/iconShape.spec.ts Updates label position description default using nullish coalescing.
cypress/helpers/util.ts Modernizes default assignment with nullish coalescing for batch id and noteFontFamily.

Copy link

codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 34 lines in your changes missing coverage. Please review.

Project coverage is 3.87%. Comparing base (9d838d4) to head (6462f73).
Report is 14 commits behind head on develop.

Files with missing lines Patch % Lines
packages/mermaid-layout-elk/src/render.ts 0.00% 7 Missing ⚠️
packages/mermaid/src/dagre-wrapper/nodes.js 0.00% 7 Missing ⚠️
packages/mermaid/src/dagre-wrapper/edges.js 0.00% 5 Missing ⚠️
...ages/mermaid/src/dagre-wrapper/mermaid-graphlib.js 0.00% 2 Missing ⚠️
packages/mermaid/src/diagrams/class/classDb.ts 0.00% 2 Missing ⚠️
packages/mermaid/src/config.ts 0.00% 1 Missing ⚠️
packages/mermaid/src/dagre-wrapper/clusters.js 0.00% 1 Missing ⚠️
packages/mermaid/src/dagre-wrapper/createLabel.js 0.00% 1 Missing ⚠️
.../src/diagrams/architecture/architectureRenderer.ts 0.00% 1 Missing ⚠️
packages/mermaid/src/diagrams/block/blockDB.ts 0.00% 1 Missing ⚠️
... and 6 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6503   +/-   ##
=======================================
  Coverage     3.87%   3.87%           
=======================================
  Files          412     411    -1     
  Lines        43134   43101   -33     
  Branches       664     664           
=======================================
  Hits          1672    1672           
+ Misses       41462   41429   -33     
Flag Coverage Δ
unit 3.87% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/config.ts 23.14% <0.00%> (ø)
packages/mermaid/src/dagre-wrapper/clusters.js 0.00% <0.00%> (ø)
packages/mermaid/src/dagre-wrapper/createLabel.js 0.00% <0.00%> (ø)
.../src/diagrams/architecture/architectureRenderer.ts 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/block/blockDB.ts 0.00% <0.00%> (ø)
...ckages/mermaid/src/diagrams/block/renderHelpers.ts 0.00% <0.00%> (ø)
...ages/mermaid/src/diagrams/class/classDiagram-v2.ts 6.25% <0.00%> (+0.69%) ⬆️
...ackages/mermaid/src/diagrams/class/classDiagram.ts 6.25% <0.00%> (+0.69%) ⬆️
...ges/mermaid/src/diagrams/class/classRenderer-v2.ts 0.37% <0.00%> (ø)
packages/mermaid/src/diagrams/packet/parser.ts 1.47% <0.00%> (+0.04%) ⬆️
... and 6 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

argos-ci bot commented Apr 19, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Apr 19, 2025, 5:10 AM

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.

1 participant