-
-
Notifications
You must be signed in to change notification settings - Fork 696
New: add vue/no-unused-properties rule #871
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
New: add vue/no-unused-properties rule #871
Conversation
Hello, recently we also added properties usage detection when a component instance accessed via a parameter in beforeRouteEnter
guard to this rule.
I'm not yet sure if you're interested in this rule and also it's possible that we'll need to add more updates/fixes in the future, so instead of copying it here every time, I'm inserting a link to a location where you can always find up-to-date codes: https://github.com/learningequality/kolibri/tree/develop/packages/eslint-plugin-kolibri.
Also, we have similar rules available for component methods, mapped Vuex state, getters, mutations and actions there.
jtwaleson
commented
May 4, 2019
We're using eslint-plugin-vue
extensively on our code base and would love to have this implemented. Using these rules on our code base of +/- 1 year old, we found about 5% of our props to be unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
LGTM!
aberonni
commented
Jul 17, 2019
Friendly ping - really looking forward to using this, any idea when it will be merged?
vperron
commented
Aug 5, 2019
Friendly ping as well !!! I'm extremely looking forward to this being merged !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! I like your idea.
I have some requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change to support the destructuring assignment?
const {prop} = this
Also could you change to support the track the this
?
I want to support assignment expressions as follows:
const vm = this vm.prop
rholic-openpath
commented
Dec 4, 2019
Can someone please make the changes requested? Would love to have this part of eslint!!
Hi, I had already started working on it and then went on a long sick leave. Right now I need to catch up on other tasks I am responsible for so I think I will get to this rather after Christmas.
Also interested.
By the way, current rule also can't find unused data property if data defined like this:
data: () => ({
neverUsed: 'but'
}),
Can someone please make the changes requested? Would love to have this part of eslint!!
i have wrote a unofficial eslint plugin for no-unused-properties
and pass the all official test, maybe you can try it.eslint-plugin-vueunused
ibarsi
commented
Mar 17, 2020
@MisRob Would you like some support on this PR? My team is looking forward to this rule so I would be happy to help 👍🏼
@ibarsi Hi thanks a lot. I believe I will eventually get to that though this year has been really busy so far. So if you can resolve @ota-meshi requests sooner than I can get back to it, you are more than welcome to do so. I briefly checked what needs to be done but don't have any codes yet.
alb3rtuk
commented
Mar 26, 2020
Guys, our team is also very much in need of this rule. If someone could get this merged I believe a lot of ppl would be very happy :)
Guys, our team is also very much in need of this rule. If someone could get this merged I believe a lot of ppl would be very happy :)
here is a choice, eslint-plugin-vueunused, the same effect as this pull request , pass all this pr unit test and finish the #871 (comment) feature.
* New: add vue/no-unused-properties rule (#631) * Update * Updated to trace function calls. Co-authored-by: Michaela Robosova <robosova.michaela@seznam.cz>
Hello,
we've implemented
vue/no-unused-properties
(disallows any unused properties, data and computed properties) as our custom internal rule recently and noticed that there's an accepted rule proposition for this logic already (#631) so we're sharing what we have.Refs: #631