vuejs / vuejs/docs

[Tutorial-12] ESLint error "'props' is assigned a value but never used"

Open
#1,845 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Implementing the tutorial code for chapter 12 of the child component ChildComp.vue

<script setup>
// "props' is assigned a value but never used"
const props = defineProps({
  msg: String,
});
</script>

<template>
  <h2>{{ msg }}</h2>
  <!-- This would work -->
  <!-- <h2>{{ props.msg  }}</h2> -->
</template>

forces linting error 'props' is assigned a value but never used. I think this should be fixed, especially in a tutorial. If it should be fixed I can open a PR.

Example-Repository with workaround:
https://github.com/Theiaz/bug-eslint-error-props-not-used

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 chapter 12 tutorial and its ChildComp.vue example, then reproduce the reported ESLint error using the shown defineProps code. Compare it with the linked workaround and verify that the tutorial code no longer produces the unused-props error when linted.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.