Open esamattis opened 12 years ago
No, it means I've abandoned the CoffeeScope project and without that we're never going to correctly resolve undefined/unused variables.
I recommend moving on from CoffeeScript and use Babel/ES6 if you have a choice. There are no meaningful advantages to CoffeeScript any more and I won't start new projects with it.
@AsaAyers On that we disagree. I believe code readability is one of the most valuable features of a language, and find whitespace sensitivity and other CoffeeScript syntax features (english comparators, the '?', object notation shorthand, etc.) to add significant value. (admittedly I'm also a fan of python)
The fact is the internals of CoffeeScript are garbage and have prevented me from completing this issue. I see no reason to continue using it and no one has stepped up to take over maintenance of CoffeeLint. I still stick around to manage PRs, but I generally don't work on this project any more.
This is my favorite test to show people. Which of these are valid?
if foo and
bar # 1 space
undefined # 2 spaces
if foo and
bar # 1 space
undefined # 4 spaces
if foo and
bar # 3 space
undefined # 2 spaces
if foo and
bar # 4 space
undefined # 2 spaces
It's a trick question because they all compile. with CoffeeScript, although none compile with Redux. Whitespace for indentation is only good if there is such a thing as being strictly "correct" as I'm sure it is in python. Jeremy Ashkenas seems very proud of his hacks to get CoffeeScript to compile, but the fact is those shortcuts are what prevents us from ever becoming as good as eslint. I'd rather use a language that has all the tools I need instead of a hacked together language whose internals are such garbage we can't build sufficient tools.
When I compare ES5 and CoffeeScript, CoffeeScript is a clear winner on number of useful features. When I compare ES6 I think I'm losing 2-3 features I use and gaining far superior tooling.
I should clarify. CoffeeScript's internals are good at churning out ES5 code, but the intermediate representations we need to use are too full of hacks to provide proper tooling around the language. On Jul 25, 2015 4:26 PM, "Zoli Kahan" notifications@github.com wrote:
@AsaAyers https://github.com/AsaAyers On that we disagree. I believe code readability is one of the most valuable features of a language, and find whitespace sensitivity and other CoffeeScript syntax features (english comparators, the '?', object notation shorthand, etc.) to add significant value. (admittedly I'm also a fan of python)
— Reply to this email directly or view it on GitHub https://github.com/clutchski/coffeelint/issues/20#issuecomment-124886426 .
For those of you using Atom you can try this package: atom-linter-coffee-variables. It uses ESLint in the background so it's kind of a hack but could be better then nothing.
@AsaAyers so the recommended way is to switch to ES6/2015 or use the workflow with coffee-jshint that @jonahkagan described, right?
I really can't recommend coffee-jshint. At that point you're not actually linting your code, your'e linting the code generated by CoffeeScript that you have very little control over. It will spot undefined or unused variables, but I can't see how it would be useful for anything else.
CoffeeScript just doesn't have a future, so IMO it's better to plan your exit sooner rather than later. A year ago my company decided to switch from Backbone to React. Because JSX support in CoffeeScript is terrible we've also migrated to ES6. Our last non-React release was 15,980 lines of CoffeeScript over 175 files, now we have 1,826 lines left in 11 files. (side note: Switching to React has brought the same codebase down to 3104 lines over 49 files)
I found the best way to convert is to just copy your code into a .js
file and begin fixing syntax errors found with eslint. CoffeeScript is so close to ES6 that it's sometimes hard to tell the difference between the two in small sections of code.
big thanks @AsaAyers for your quick reply and the stats. I really like the way you organise your components with React too. Currently we have a large Angular/CoffeeScript Codebase, but for the future we will have to migrate this.
If anyone's still interested, my plugin handles undefined vars and more
Ref @wwwdata
amazing. Thank you @za-creature
Is this still considered, by any chance? When using coffeelint in a text editor package (such as https://atom.io/packages/linter-coffeelint), adding plugins is not trivial.
You just have to make your plugin a local devDependency
of the project. linter-coffeelint
doesn't run in Node, so it doesn't have access to globally installed node modules. CoffeeLint should be a devDependency
too. If it is, then linter-coffeelint
and the coffeelint
command line with use your local version
FYI @za-creature's coffeescope2 plugin has been working well for me…
@clutchski @swang @za-creature Would there be any interest in merging it into this project?
@danielbayley https://github.com/clutchski/coffeelint/pull/579
It should warn about the undefined bar variable. This something I miss the most from jshint/jslint.