clutchski / coffeelint

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

"unexpected indentation" when omitting braces for the default export of an ES6 module #610

Open wintermutt opened 7 years ago

wintermutt commented 7 years ago

The following code gives me "unexpected indentation" as an error:

export default
  foo: 'bar'

CoffeeScript compiles it just fine:

export default {
  foo: 'bar'
};

CoffeeLint has no problems with the one-liner version though:

export default foo: 'bar'

Not sure if I'm missing something, but I believe the first block should raise no linting errors.

I'm on v1.16.0.

swang commented 7 years ago

coffeelint doesn't generate an unexpected indentation error... i don't get any errors with the example..

wintermutt commented 7 years ago

Hmm... I was using it from within sublime so it looked like a standard coffeelint error. Running it directly in the cli still gives me the same error, but now it's clearer coffeelint is forwarding it to me from elsewhere.

$ coffeelint -v
1.16.0
$ cat foo.coffee 
export default
  foo: 'bar'
$ coffeelint foo.coffee 
  ✗ foo.coffee
     ✗ #2: [stdin]:2:1: error: unexpected indentation
  foo: 'bar'
^^.

✗ Lint! » 1 error and 0 warnings in 1 file

I would expect this to be coming from coffeescript, but compiling the file directly works fine:

$ coffee -c foo.coffee 
$ cat foo.js 
// Generated by CoffeeScript 1.12.6
export default {
  foo: 'bar'
};

Do you have any idea where this error might be coming from? Does coffeelint do any kind of concatenation of the input files?

swang commented 7 years ago

looks like this is an issue with CS 1.11.x which coffeelint is still using.

wintermutt commented 7 years ago

Gotcha. I'll wait until the update then. Thanks!