Skip to content

Rule Proposal: no-unused-variables #631

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

Closed
shadskii opened this issue Nov 3, 2018 · 1 comment · Fixed by #1145
Closed

Rule Proposal: no-unused-variables #631

shadskii opened this issue Nov 3, 2018 · 1 comment · Fixed by #1145

Comments

@shadskii
Copy link
Contributor

shadskii commented Nov 3, 2018

Please describe what the rule should do:
No unused computed properties or data.
What category of rule is this? (place an "X" next to just one item)

[X] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

<template>
    <h1>{{ used }}</h1>
</template>
<script>
export default {
    data(){
        return {
            unused: 0, //error
            used: 'Hello World!'
        }
    }
}
</script>
<template>
    <h1>{{ used }}</h1>
</template>
<script>
export default {
    computed: {
        used() {
            return 'Hello World';
        },
        unUsed() { //error
            return 'Unused';
        }
}
</script>

Why should this rule be included in ESLint (instead of a plugin)?
Unused computed properties and data makes Vue components difficult to read.

@shadskii shadskii changed the title Rule: no-unused-variables Rule Proposal: no-unused-variables Nov 3, 2018
@phaibin
Copy link

phaibin commented Mar 7, 2019

Agree. This rule is very useful to check unused codes. Please add it ASAP!

MisRob pushed a commit to learningequality/eslint-plugin-vue that referenced this issue Apr 9, 2019
ota-meshi added a commit that referenced this issue May 21, 2020
* New: add vue/no-unused-properties rule (#631)

* Update

* Updated to trace function calls.

Co-authored-by: Michaela Robosova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants