clutchski / coffeelint

Lint your CoffeeScript.
http://www.coffeelint.org
Other
1.17k stars 172 forks source link

Line contains inconsistent indentation triggered arbitrarily when assignment + function chaining #529

Open samuelhorwitz opened 8 years ago

samuelhorwitz commented 8 years ago

Simplest example you can test on the homepage of Coffeelint:

This lints:

foo = foobar.faz()
            .fing()
            .flang()
            .fade()

This does not lint:

foob = foobar.faz()
             .fing()
             .flang()
             .fade()

The only difference is the assignee variable name changes from foo to foob and I indent each chained call by one more space to account for this.

AsaAyers commented 8 years ago

When looking at chains it seems coffeelint is simply verifying that your indentation is a multiple of the indentation level. it isn't checking to see if the dots line up or anything.

samuelhorwitz commented 8 years ago

That's fair I suppose but I saw a bunch of similar issues that seemed to be related to chaining and indentation but I thought this looked a fairly simple example case that I've encountered. I don't think it's illegitimate to do things like this in which you get your dots to line up and I haven't notice Coffeescript have a problem with it. It is a bit weird to think about how one would lint such a thing.

mzgajner commented 8 years ago

Chiming in with an identical issue - can we know if this is intended behaviour? I'm using a very old version (1.5.2) that didn't have the error, but it appears upon updating.

swang commented 8 years ago

I would say the intended behavior is based off the value you assigned for indent. So lining it up based on where the . is should fail.

I can see why this would be appealing to people, and I would be open to accepting a flag to handle this. Honestly right now though my priorities are probably to fix immediate defined bugs before I go loop back around to this.