Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

False positive for unused vars inside decorator arguments #445

Closed
yyx990803 opened this issue Feb 7, 2018 · 4 comments
Closed

False positive for unused vars inside decorator arguments #445

yyx990803 opened this issue Feb 7, 2018 · 4 comments

Comments

@yyx990803
Copy link

What version of TypeScript are you using?
2.6.1

What version of typescript-eslint-parser are you using?
12.0.0

What code were you trying to parse?

import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from './components/HelloWorld.vue';

@Component({
  components: {
    HelloWorld
  }
})
export default class App extends Vue {}

What did you expect to happen?
With eslint-plugin-typescript's typescript/no-unused-vars rule enabled, should lint without errors.

What happened?

error: 'HelloWorld' is defined but never used (no-unused-vars)

It looks like the expression in a decorator's argument position is not taken into context when determining unused vars. Also, when using eslint --fix, code inside decorator arguments are sometimes not formatted correctly.

@corbinu
Copy link

corbinu commented Feb 8, 2018

@yyx990803 I believe this is an issue with https://github.com/nzakas/eslint-plugin-typescript

@alexcouret
Copy link

Any update on this? I still have this issue, using the most up to date versions of the plugin / parser.

@JamesHenry
Copy link
Member

Thanks for reporting, @yyx990803! This needs to be addressed in the plugin. It would be fantastic if one of the people affected by this issue could contribute to it.

@JamesHenry
Copy link
Member

Closing as this is really a bug report for the custom rule in the plugin and an issue has already been opened there. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants