Skip to content

feat(define-props-declaration): add autofix to type-based declaration - #3235

Open
ValentinYoushkevich wants to merge 2 commits into
vuejs:masterfrom
ValentinYoushkevich:feat/define-props-declaration-autofix
Open

ValentinYoushkevich wants to merge 2 commits into
vuejs:masterfrom
ValentinYoushkevich:feat/define-props-declaration-autofix

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

This picks up #2466 by @mpiniarski, who agreed to hand it over. It adds an autofix to vue/define-props-declaration that turns a runtime defineProps({...}) into a single-line type-based declaration and moves defaults into withDefaults(). I went through the review there: nothing throws, there is no try/catch, and whatever can't be converted exactly just gets no fix, including array declarations like defineProps(['kind']), validator, a non-literal required, unknown constructors, spreads and comments. Props without required: true become optional, Function maps to (...args: any[]) => any, and the separate interface option is gone. I also checked that @vue/compiler-sfc generates the same runtime props for the fixed code.

Closes #2465

Convert a runtime defineProps() declaration to a type-based one when the
conversion keeps the props' runtime behavior, and skip the fix otherwise.
@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7683b1d

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

This branch has not been deployed

No deployments
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.

Add autofix to define-props-declaration: transform runtime syntax to type-based syntax

1 participant