jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.97k stars 515 forks source link

New rule: disallowUnusedVariables #2199

Closed schempy closed 8 years ago

schempy commented 8 years ago

disallowUnusedVariables: warn/auto-fix unused variables defined with var, let or const.

Fixes: #2076

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.03%) to 96.185% when pulling 2a4a4e9454da5468c26503deb11ac72f390bbb2f on schempy:pr-issue-2076 into 99bdf4f7240110a30ff223fcebcca4868bcdb4e3 on jscs-dev:master.

schempy commented 8 years ago

The Travis CI build shows all tests passing. I noticed the following message from the node v0.10.44 build:

Bad response: 422 {"message":"Couldn't find a repository matching this job.","error":true}

Not sure if that is from coveralls. I did a rebase from the current master branch prior to the pull request.

markelog commented 8 years ago

Wow, if everything works, that would be an impressive one!

/cc @mdevils

Bad response: 422 {"message":"Couldn't find a repository matching this job.","error":true}

You probably force-push at some point, which what happens, i.e. totally okay.

schempy commented 8 years ago

Thanks for catching the invalid example. I updated.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.03%) to 96.185% when pulling fbd4568d60cbadec75a342cc01295f3b5496048e on schempy:pr-issue-2076 into 99bdf4f7240110a30ff223fcebcca4868bcdb4e3 on jscs-dev:master.

markelog commented 8 years ago

@schempy you are the man! Thanks

jdalton commented 8 years ago

This rule is having issues with vars that are just passed to other functions:

disallowUnusedVariables: Variable `object` is not used at lodash.js :
 14622 |     */
 14623 |    var method = rest(function(path, args) {
 14624 |      return function(object) {
---------------------------------^
 14625 |        return baseInvoke(object, path, args);
 14626 |      };

You can see the var is used

markelog commented 8 years ago

That was fast! @schempy could you check it out?

mdevils commented 8 years ago

Thanks, will fix it soon.

mdevils commented 8 years ago

Fixed in 3.0.1. Please check it out.

jdalton commented 8 years ago

It works! Updated dep in Lodash :D