Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unexpected newline after super #595

Closed
wants to merge 1 commit into from
Closed

Fix unexpected newline after super #595

wants to merge 1 commit into from

Conversation

sionleroux
Copy link
Contributor

Summary

So I know that the project has specifically pinned coffeescript 1.x in its package.json but I'm trying to use coffeescript 2.x in my project because it has other things I need (namely async/await) and the bot crashes on start, referencing this line from bot.coffee:

[stdin]:20:10: error: unexpected newline
    super
         ^.

I supposed that this keyword has now become ambiguous without brackets/parentheses but to make sure, I dug up the breaking changes list for the coffeescript 2.0.0 release and found this:

Due to a syntax clash with super with accessors, "bare" super (the keyword super without parentheses) no longer compiles to a super call forwarding all arguments.
[...] if you know that the parent function doesn't require arguments, just call super().

Source: https://coffeescript.org/#breaking-changes-super-extends

After adding the brackets the coffeelint tool no longer spits out that error and when running it it "works on my machine". Tests are still passing and also I can't it imagine it having any adverse effects on users of older versions of coffeescript because the parentheses were optional so far.

Requirements

So I know that the project has specifically pinned coffeescript 1.x in
its package.json but I'm trying to use coffeescript 2.x in my project
because it has other things I need (namely async/await) and the bot
crashes on start referencing this line from bot.coffee:

  [stdin]:20:10: error: unexpected newline
      super
           ^.

I supposed that this keyword has now become ambiguous without brackets
but to make sure, I dug up the breaking changes list for the
coffeescript 2.0.0 release and found this:

> Due to a syntax clash with super with accessors, "bare" super (the
> keyword super without parentheses) no longer compiles to a super call
> forwarding all arguments.
> [...] if you know that the parent function doesn't require arguments,
> just call `super()`.

Source: https://coffeescript.org/#breaking-changes-super-extends

After adding the brackets the coffeelint tool no longer spits out that
error and when running it it "works on my machine".  Tests are still
passing and also I can't it imagine it having any adverse effects on
users of older versions of coffeescript because the parentheses were
optional so far.
@sionleroux
Copy link
Contributor Author

Right, so according to the test results from Travis CI my previous statement about "it works on my machine" isn't good enough because it breaks for Hubot versions < 3.x yay! 😒 🎉

TypeError: Cannot read property 'logger' of undefined

I am honestly surprised. I suppose the logger it's complaining about is this one.

@sionleroux
Copy link
Contributor Author

Right, I've just found #565 and it's reverted, so it seems progress to coffeescript 2 is much more complex than I'd hoped.

@sionleroux sionleroux closed this May 5, 2020
@sionleroux sionleroux deleted the super-noargs branch May 5, 2020 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant