aiannacc / Goko-Salvager

Enhance your Dominion Online experience!
13 stars 9 forks source link

JSLint with Grunt #208

Closed michaeljb closed 10 years ago

michaeljb commented 10 years ago

The Development page on the Wiki asks developers to follow JSLint, and now a runnable task to do just that can be part of the project!

michaeljb commented 10 years ago

src/ext/kingdom_generator.js and src/ext/templates.js are configured to be excluded from JSLint because they feature machine-generated code which neither responds well to linting, nor does it need to.

aiannacc commented 10 years ago

I was under the impression that the silly-looking

typeof x !== 'undefined'

was necessary for cross-browser compatibility. Is this not the case?

This is an excellent change, btw. Many thanks!

michaeljb commented 10 years ago

I was not aware of it being a cross-browser issue before. From the first article I opened after Googling, it seems it's a problem with "older browsers", which I don't think we need to worry about.

Unrelated to that question -- JSLint hates declaring variables that don't get used, and in some places (especially automatch.js) it seemed like the vars might be used for debugging stuff or something (as opposed to just being old cruft), so I commented them out instead of killing them completely.

aiannacc commented 10 years ago

Okay. I learned it from a JS book that's undoubtedly less up to date than random Googling. I won't worry about it.

I'd rather just delete unused variables and any other unused or outdated code than commenting it out. Is there any reason to keep old code in comments when we've got git versioning?

michaeljb commented 10 years ago

Is there any reason to keep old code in comments when we've got git versioning?

No, not really. I'll get it deleted.