Skip to content

feat(component-api-style): add scriptSetupVapor option #2797

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

waynzh
Copy link
Member

@waynzh waynzh commented Jul 17, 2025

resolve #2791

Waiting for the official release of Vue 3.6...

Copy link

changeset-bot bot commented Jul 17, 2025

🦋 Changeset detected

Latest commit: adf9424

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-vue Minor

Not sure what this means? Click here to learn what changesets are.

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

@waynzh waynzh requested a review from Copilot July 17, 2025 11:45
Copy link
Contributor

@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

Introduce a new script-setup-vapor option to the Vue component API style rule, allowing <script setup vapor> blocks and enforcing the proper messages when it’s disallowed.

  • Extend parser and rule logic to recognize and validate script-setup-vapor
  • Add unit tests for both allowing and disallowing <script setup vapor>
  • Update documentation with examples and option descriptions

Reviewed Changes

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

File Description
tests/lib/rules/component-api-style.js Added tests for the new script-setup-vapor option and errors
lib/rules/component-api-style.js Parsed, flagged, and reported on <script setup vapor> usage
docs/rules/component-api-style.md Documented the script-setup-vapor option with examples
Comments suppressed due to low confidence (1)

tests/lib/rules/component-api-style.js:124

  • Add a test case for <script setup> (without vapor attribute) when both script-setup and script-setup-vapor options are enabled to ensure no error is reported.
      options: [['script-setup', 'script-setup-vapor']]

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

Copy link
Member

@FloEdelmann FloEdelmann left a comment

Choose a reason for hiding this comment

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

The code looks good to me 🙂

Unfortunately, this new option will not solve the request in #2791 ("detect components using <script setup> and suggest adding the vapor attribute when possible"). Should this be a new rule instead? Or a new additional rule, while first only allowing script-setup-vapor here?

@waynzh
Copy link
Member Author

waynzh commented Aug 1, 2025

this new option will not solve the request in #2791

Users setting ['script-setup-vapor'] like this should resolve the issue, right?
The error message will suggest: "Use <script setup vapor> instead."

@FloEdelmann
Copy link
Member

True, that might work. But you have to migrate everything at once to <script setup vapor>, or decrease the rule severity to warn (but then, also other unwanted styles might creep back in).

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.

Rule proposal: vue/prefer-vapor-mode
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy