-
Notifications
You must be signed in to change notification settings - Fork 527
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
Unused variable option #721
Comments
How do you mean an unused variable? What context? What kind of cases? Can you provide examples please. |
This probably means that a variable is declared, but it's never used anywhere. So for example, this errors:
Because nothing uses It would be nice if we could have the same for placeholder selectors and mixins. Often you're refactoring something, and turns out some variables of mixins aren't used anymore :) |
Yeah, I was just trying to get a little more information on the requested scope of this as it'd be fine to handle unused vars in the same file as we lint on a file by file basis, if this is to become a project wide lint for unused variables it may become a little overreaching. Many people myself included just use files full of defaults etc and then use them again in multiple partials so it differs from how this rule would work in javascript for example. It would probably need to wait until we've got #677 merged in to be honest so that you could disable this check in a file. |
Unused variables per file, as in the example by @megapctr , would be great for now! Personally, I would prefer the option to be project-wide. In the case of a set of default variables, as you mention @DanPurdy, ignoring them in-place would be fine for a while, but then surely you would want to review why they hadn't been used, them either use or remove them? |
The problem is with project wide is we have no sense of your project, we don't try to compile it or care how it would compile so it would be a very dumb attempt at tracking variables across your project and would add a bit of extra overhead. As i said above per file would be easy to add but may be very annoying for people if they can't disable linters via comments. Probably have to wait for that in my opinion. |
Makes sense, and happy to wait for #677, too, thanks! |
Is this still something in the works? If so, any ETA or is it low on the priority list? |
The linked PR is merged meanwhile, any info about this rule status? |
Can an unused variable option please be added? This simply helps reduce noise in source files. Thanks
The text was updated successfully, but these errors were encountered: