Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ShenQingchuan
Copy link
Member

@ShenQingchuan ShenQingchuan commented Aug 15, 2025

  • fix: avoid empty unsafe panic in eslint format self-closing rule
  • hmr: don't apply ts-morph API on non-ts files.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented potential crashes during HTML self-closing tag autofixes by safely handling missing tag nodes, improving lint autofix stability.
  • Chores

    • Pinned several workspace tooling dependencies to exact versions to ensure consistent installs and builds.
  • Developer Experience

    • Reduced unnecessary processing during hot updates by limiting updates to TypeScript-like files, improving dev-server HMR efficiency.

Copy link

netlify bot commented Aug 15, 2025

Deploy Preview for vue-vine ready!

Name Link
🔨 Latest commit cc608b4
🔍 Latest deploy log https://app.netlify.com/projects/vue-vine/deploys/689ede5491ed6f00080634ef
😎 Deploy Preview https://deploy-preview-304--vue-vine.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 project configuration.

Copy link
Contributor

coderabbitai bot commented Aug 15, 2025

Walkthrough

Added defensive guards to an ESLint rule fixer to avoid errors when HTML start/end tags are missing; pinned three pnpm workspace anchors from tilde ranges to exact versions; and gated ts-morph hot-update work in the Vite plugin to only run for TypeScript-like files.

Changes

Cohort / File(s) Summary of Changes
ESLint rule safety guard
packages/eslint-plugin/src/rules/format/format-html-self-closing.ts
Allow startTag/endTag to be undefined and return no fixes when either is missing; keep existing replacement/removal fix logic when both tags exist.
Workspace version pinning
pnpm-workspace.yaml
Replace tilde ranges with exact pins for anchors: &vue-lang-tools (~3.0.1 → 3.0.1), &volar (~2.4.17 → 2.4.17), &volar-service (~0.0.64 → 0.0.64).
Vite plugin hot-update guard
packages/vite-plugin/src/index.ts
Add isTsFileRegex = /\.[cm]?tsx?$/ and only run ts-morph update path when tsMorphCache exists AND the updated file matches the TS-like regex; comments updated to reflect the gating.

Sequence Diagram(s)

sequenceDiagram
  participant ESLint as ESLint Engine
  participant Rule as format-html-self-closing Rule
  participant Fixer as Fix Function

  ESLint->>Rule: Visit HTML node
  Rule->>Fixer: Request fixes
  Fixer->>Fixer: Check startTag/endTag present?
  alt Missing tag
    Fixer-->>Rule: Return []
  else Both present
    Fixer->>Fixer: Replace '>' with '/>'
    Fixer->>Fixer: Remove endTag range
    Fixer-->>Rule: Return fixes
  end
Loading
sequenceDiagram
  participant Vite as Vite HMR
  participant Plugin as vite-plugin.handleHotUpdate
  participant tsMorph as ts-morph cache/workflow

  Vite->>Plugin: File changed (ctx.file)
  Plugin->>Plugin: Test isTsFileRegex && tsMorphCache
  alt Not TS-like OR no tsMorphCache
    Plugin-->>Vite: Skip ts-morph update
  else TS-like && tsMorphCache
    Plugin->>tsMorph: Ensure project/source file entry
    tsMorph->>tsMorph: Update or replace source file content
    tsMorph-->>Plugin: Updated
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Poem

I twitch my whiskers, hop and mend,
I guard the tags before they rend.
I pin the versions neat and small,
I skip ts-morph when files don't call.
A rabbit's patch — succinct and all! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 09d170a and cc608b4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • packages/eslint-plugin/src/rules/format/format-html-self-closing.ts (1 hunks)
  • packages/vite-plugin/src/index.ts (2 hunks)
  • pnpm-workspace.yaml (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch next-patch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@ShenQingchuan ShenQingchuan changed the title release: next patch version releasing: next patch version Aug 15, 2025
Copy link

pkg-pr-new bot commented Aug 15, 2025

Open in StackBlitz

@vue-vine/compiler

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/compiler@304

create-vue-vine

npm i https://pkg.pr.new/vue-vine/vue-vine/create-vue-vine@304

@vue-vine/eslint-config

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/eslint-config@304

@vue-vine/eslint-parser

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/eslint-parser@304

@vue-vine/eslint-plugin

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/eslint-plugin@304

@vue-vine/language-server

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/language-server@304

@vue-vine/language-service

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/language-service@304

@vue-vine/nuxt

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/nuxt@304

vue-vine-tsc

npm i https://pkg.pr.new/vue-vine/vue-vine/vue-vine-tsc@304

@vue-vine/vite-plugin

npm i https://pkg.pr.new/vue-vine/vue-vine/@vue-vine/vite-plugin@304

vue-vine

npm i https://pkg.pr.new/vue-vine/vue-vine@304

commit: cc608b4

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: 0

🧹 Nitpick comments (4)
packages/eslint-plugin/src/rules/format/format-html-self-closing.ts (4)

154-165: Prefer range-based fixes to avoid type casts and fragile string replacement

Current approach forces casting to TSESTree.Node and uses string replace on the entire startTag, which can inadvertently replace a '>' inside an attribute value. You can avoid both by using range-based fixes for the last '>' in the start tag.

Apply this diff:

-              const startTag = node.startTag as any as (TSESTree.Node | undefined)
-              const endTag = node.endTag as any as (TSESTree.Node | undefined)
+              const startTag = node.startTag
+              const endTag = node.endTag
               if (!startTag || !endTag) {
                 return []
               }
 
-              return [
-                // Replace '>' of startTag with '/>'
-                fixer.replaceText(startTag, context.sourceCode.getText(startTag).replace('>', '/>')),
-                // Remove the text from the end of startTag to the end of endTag
-                fixer.removeRange([startTag.range[1], endTag.range[1]]),
-              ]
+              // Replace the last '>' of the start tag with '/>'
+              const gt = startTag.range[1] - 1
+              return [
+                fixer.replaceTextRange([gt, gt + 1], '/>'),
+                // Remove the text from the end of startTag to the end of endTag
+                fixer.removeRange([startTag.range[1], endTag.range[1]]),
+              ]

131-133: Tighten types: avoid optional chaining for options

createEslintRule supplies defaultOptions, so context.options[0] should always exist. Dropping ?. improves type safety and avoids unnecessary Option | undefined union types.

-    const options = context.options?.[0]
+    const options = context.options[0]

24-34: Fix minor typo in comment

Typo: “wil” → “will”.

- * These strings wil be displayed in error messages.
+ * These strings will be displayed in error messages.

153-166: Consider adding tests for malformed/missing endTag cases

Now that the fixer defensively no-ops when tags are missing, add RuleTester cases to assert:

  • It reports but does not crash when endTag is missing.
  • It produces no fixes (empty fix array) in that scenario.

I can draft the test cases if helpful.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 09d170a and 829d136.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/eslint-plugin/src/rules/format/format-html-self-closing.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-17T14:54:18.385Z
Learnt from: ShenQingchuan
PR: vue-vine/vue-vine#283
File: packages/vscode-ext/package.json:105-110
Timestamp: 2025-06-17T14:54:18.385Z
Learning: The Vue Vine VSCode extension uses tsdown as a bundler that statically analyzes and includes all imported dependencies in the final bundle, regardless of whether they are listed in dependencies or devDependencies in packages/vscode-ext/package.json. Runtime dependencies can safely be placed in devDependencies since they will be bundled into the extension output.

Applied to files:

  • pnpm-workspace.yaml
🧬 Code Graph Analysis (1)
packages/eslint-plugin/src/rules/format/format-html-self-closing.ts (1)
packages/eslint-parser/src/ast/nodes.ts (1)
  • Node (22-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: e2e_tests (hmr, macos-latest)
  • GitHub Check: e2e_tests (hmr, windows-latest)
  • GitHub Check: e2e_tests (basic, windows-latest)
  • GitHub Check: e2e_tests (hmr, ubuntu-latest)
  • GitHub Check: unit_tests (lts/*, windows-latest)
🔇 Additional comments (2)
pnpm-workspace.yaml (1)

7-9: Pinning anchors to exact versions improves determinism

Switching from tilde ranges to exact pins for &vue-lang-tools, &volar, and &volar-service tightens reproducibility across the workspace. Good call for patch release stability.

packages/eslint-plugin/src/rules/format/format-html-self-closing.ts (1)

154-159: Good defensive guard to prevent fixer crashes on malformed nodes

Early-returning when startTag or endTag is missing avoids unsafe fixer execution and aligns with the PR goal to prevent runtime panics. LGTM.

@ShenQingchuan
Copy link
Member Author

@coderabbitai summary

Copy link
Contributor

coderabbitai bot commented Aug 15, 2025

✅ Actions performed

Summary regeneration triggered.

@ShenQingchuan ShenQingchuan changed the title releasing: next patch version releasing: next patch version v1.7.4 Aug 15, 2025
@ShenQingchuan ShenQingchuan merged commit 0b05dda into main Aug 15, 2025
17 checks passed
@ShenQingchuan ShenQingchuan deleted the next-patch branch August 15, 2025 14:35
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