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(artifacts): method-syntax functions cant be used as $controller constructors #5269

Merged
1 commit merged into from May 4, 2018
Merged

Conversation

ghost
Copy link

@ghost ghost commented May 4, 2018

Slightly oblique side effect of today's transpiler change. Functions defined using "method syntax" previously were changed into function() { } declarations but are now not transformed, instead relying on the browser's native support for methods. Functions defined using method syntax are not allowed to be used as constructors [1] but previously this was not being enforced by the transpiled method declarations.

Angular's $controller service attempts to use the functions passed in from artifact modules' controller prop as constructors. Because they were defined using method syntax, they threw errors after the transpiler change.

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions#Method_definitions_are_not_constructable

@ghost ghost requested review from ezimanyi, lwander and danielpeach May 4, 2018 18:08
@ghost
Copy link
Author

ghost commented May 4, 2018

ping @anotherchrisberry just for interest's sake

Copy link
Contributor

@ezimanyi ezimanyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw this in the console log and was trying to figure out the source. LGTM

Copy link
Contributor

@danielpeach danielpeach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could turn off that linter rule entirely?

@ghost
Copy link
Author

ghost commented May 4, 2018

moved lint change to tslint.json

@ghost ghost merged commit 5aee5c0 into spinnaker:master May 4, 2018
@ghost ghost deleted the artifact-controller-constructor-babel-change branch May 4, 2018 18:24
@anotherchrisberry
Copy link
Contributor

Good catch, thanks @sbwsg

This pull request was closed.
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.

3 participants