clutchski / coffeelint

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

Support computed object keys #633

Closed jhessin closed 6 years ago

jhessin commented 6 years ago

The following line compiles without issue in coffeescript 2.2.1

path = new Path {
      fromPath: @
      toPath: if @isCollection
        ref.id
      else
        # because coffeelint shows an error here!
        # coffeelint: disable=coffeescript_error
        [Path.DEFAULT_COLLECTION]: ref.id
        # coffeelint: enable=coffeescript_error
    }

However as noted in the comments this type of structure is not recognized as valid by coffeelint 2.0.7 as noted here

 ✗ cs/controllers/Path.coffee
     ✗ #57: [stdin]:57:9: error: unexpected [
        [Path.DEFAULT_COLLECTION]: ref.id
        ^.

✗ Lint! » 1 error and 0 warnings in 1 file
swang commented 6 years ago

The issue was coffeescript had a bug in 2.0.3. I published 2.1.0 that should fix this.