vuejs / vuejs/docs

Add note about having to call `defineProps` at the top-level

Open
#1,990 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Vue
Stars
3.2k
Forks
5k
Avg merge
14d 17h
Merged PRs (30d)
1

Description

When using defineProps, you have to call it in the form ... = defineProps().
Using it like ... = toRefs(defineProps()) generates a misleading mess of runtime errors, with the only relevant one being that "defineProps is not defined".
Currently, the docs for defineProps do not mention this at all.
Could a note be added, along with a ESLint rule?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the current defineProps documentation and inspect how related compiler macros are described. Confirm the misleading error case, then determine the scope of the requested ESLint rule. Done means the top-level-call requirement is documented and the linting request has an explicitly tested outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.