-
Notifications
You must be signed in to change notification settings - Fork 171
Create ScopeLinter #415
Comments
Wonderful news! |
This is awesome news! It is one of the biggest things that was missing in Coffeelint. |
Looking forward to this! Thanks! |
The scope-linter branch just got two new rules Here are some of the types of errors I'll be working on next, as they show up when running coffeelint against itself: False PositivesCoffeeScope isn't finding where these are defined even though they are:
CoffeeScope isn't finding where these are used even though they are:
CrashCoffeeScope simply can't scan some of the files. It wont' crash CoffeeLint but none of the scope rules will run against the file when it can't be scanned.
|
Just a comment here: in our code style we prefer having all function/callback arguments always written fully out, even if not used. But unused variables declared in function scope should be detected. So consider adding a switch which would allow unused function arguments. |
yup, got it. I even works just like http://eslint.org/docs/rules/no-unused-vars I actually have the rules written but I haven't merged it because CoffeeScope still misses variables and references all over the place. It gets a bunch of false positives just trying to lint coffeelint's source right now. Does anyone here have a large coffeescript codebase I could try these rules out on when they're done? I don't know a better way to make sure it works than to just run it against as much code as I can get my hands on. I've been adding samples of false positives to the test suite so I can know when they're all fixed. |
You can try https://github.com/peerlibrary/peerlibrary :-) |
Also Atom's code: https://github.com/atom/atom/tree/master/src |
@mitar, that's a great distinction. We like to be explicit in all of the function parameters as well. |
👍 this is awesome, was just wondering if such a thing exists. great minds think at the same time. |
👍 |
From CoffeeScope:
If anyone wants to pick up the project and continue it you're welcome to, but my plan is to just move to using ES6 /w Babel for all new code. CoffeeScript was good for a while, but now there's no need for it. |
Which project are we talking about here now? CoffeeScope or CoffeeLint? |
Mostly coffeescope. Without a complete list of variable declarations and references per scope you can't actually locate undefined and unused variables. I don't really see any other big things that coffeelint needs. I'll continue to be here to manage it. |
Great! :-) |
sad :( is there really no tool for doing unused variable detection in coffeescript? the only thing I know is webstorm.. |
I've made some efforts towards improving the situation: https://github.com/za-creature/coffeescope While I've started using it successfully for my own code, there are many subtleties to coffeescript that the project in its current form is probably missing. Please try it out and report any bugs or missing features. |
When I created coffeelint-undefined-variables due to poor design, I ended up mixing the "undefined variables" and "unused variables" rules together. A few weeks ago I started over on that idea and tonight I have published the first bits of code.
I created a new project (coffeescope) that scans a file and produces nested scopes listing all variables and references. With that information available I'm now creating a
ScopeLinter
so we can have different scope related rules.Right now the CoffeeLint branch scope-linter is just a stub. There are no rules yet, but i added the linter without breaking tests.
Once I get this all done and have the
undefined_variables
andunused_variables
rules implemented I'll deprecate coffeelint-undefined-variablesThe text was updated successfully, but these errors were encountered: