X Tutup
Skip to content

Require return types on public methods#2746

Closed
alexeagle wants to merge 2 commits intoangular:masterfrom
alexeagle:lint
Closed

Require return types on public methods#2746
alexeagle wants to merge 2 commits intoangular:masterfrom
alexeagle:lint

Conversation

@alexeagle
Copy link
Copy Markdown
Contributor

Review on Reviewable

@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Jun 26, 2015

+(pr_state: LGTM) +(pr_action: cleanup)


Reviewed 68 of 68 files at r1.
Review status: all files reviewed at latest revision, 30 unresolved discussions, some commit checks failed.


modules/angular2/src/core/application.ts, line 329 [r1] (raw file):
I think this should be void.


modules/angular2/src/core/application.ts, line 331 [r1] (raw file):
remove return


modules/angular2/src/core/compiler/proto_view_factory.ts, line 289 [r1] (raw file):
I think original was correct. This is a lost of strings string[]


modules/angular2/src/core/compiler/proto_view_factory.ts, line 294 [r1] (raw file):
(mappedName: string, varName:string) => ...


modules/angular2/src/core/compiler/query_list.ts, line 81 [r1] (raw file):
: void


modules/angular2/src/core/compiler/query_list.ts, line 85 [r1] (raw file):
: void


modules/angular2/src/directives/ng_for.ts, line 94 [r1] (raw file):
viewContainer: ViewContainerRef


modules/angular2/src/dom/dom_adapter.ts, line 48 [r1] (raw file):
I think there is some issue where our DOM.Adapter can not have any type, since these do not exist in node.js. Not sure if it is actually an issue.


modules/angular2/src/dom/generic_browser_adapter.ts, line 9 [r1] (raw file):
Do we not know the exact type here? (instead of any)


modules/angular2/src/dom/generic_browser_adapter.ts, line 22 [r1] (raw file):
Do we not know the exact type here?


modules/angular2/src/facade/async.ts, line 12 [r1] (raw file):
can we add full signature to resolve/reject?


modules/angular2/src/facade/collection.ts, line 71 [r1] (raw file):
iterable<T>(m: T):T (not sure exact syntax)


modules/angular2/src/facade/lang.ts, line 42 [r1] (raw file):
<T>(target: T>) => T


modules/angular2/src/facade/lang.ts, line 46 [r1] (raw file):
same here, (generics)


modules/angular2/src/facade/lang.ts, line 53 [r1] (raw file):
same here (generics)


modules/angular2/src/facade/lang.ts, line 216 [r1] (raw file):
: {re: RegExp, input: string}


modules/angular2/src/forms/model.ts, line 125 [r1] (raw file):
Map<string, string>


modules/angular2/src/http/http.ts, line 177 [r1] (raw file):
Can we typedef this. (since dart does not support inline function declarations)


modules/angular2/src/render/dom/compiler/compile_control.ts, line 14 [r1] (raw file):
CompileElement[]


modules/angular2/src/render/dom/compiler/compile_control.ts, line 21 [r1] (raw file):
: CompileElement[]


modules/angular2/src/render/dom/events/event_manager.ts, line 93 [r1] (raw file):
typedef fns?


modules/angular2/src/render/dom/events/event_manager.ts, line 101 [r1] (raw file):
typedef fns?


modules/angular2/src/render/dom/events/key_events.ts, line 95 [r1] (raw file):
typedef fns?


modules/angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy.ts, line 23 [r1] (raw file):
Node? (I think)


modules/angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy.ts, line 13 [r1] (raw file):
Node I think


modules/angular2/src/render/dom/view/view_container.ts, line 9 [r1] (raw file):
List<viewModule.DomView>


modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts, line 85 [r1] (raw file):
Element?


modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts, line 179 [r1] (raw file):
Element?


modules/angular2/test/render/dom/dom_renderer_integration_spec.ts, line 110 [r1] (raw file):
Element?


modules/angular2/test/render/dom/dom_renderer_integration_spec.ts, line 113 [r1] (raw file):
Element?


Comments from the review on Reviewable.io

@mhevery mhevery added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews pr_state: LGTM labels Jun 26, 2015
@mhevery mhevery assigned alexeagle and unassigned mhevery Jun 26, 2015
@mhevery
Copy link
Copy Markdown
Contributor

mhevery commented Jun 26, 2015

VERY NICE!

@alexeagle
Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 29 unresolved discussions, some commit checks failed.


modules/angular2/src/core/application.ts, line 329 [r1] (raw file):
Done.


modules/angular2/src/core/application.ts, line 331 [r1] (raw file):
Done.


modules/angular2/src/core/compiler/proto_view_factory.ts, line 289 [r1] (raw file):
good catch. better fix is to type the [] below, then type inference works


modules/angular2/src/core/compiler/proto_view_factory.ts, line 294 [r1] (raw file):
Done.


modules/angular2/src/core/compiler/query_list.ts, line 81 [r1] (raw file):
void is implied by no return type now. (the .d.ts generator will insert the ":void")
Or do you think this is a spot where we should be extra explicit?
If we want to generally enforce ":void" on methods, it should be a follow up change since there are many spots to fix


modules/angular2/src/directives/ng_for.ts, line 94 [r1] (raw file):
Done.


modules/angular2/src/dom/dom_adapter.ts, line 48 [r1] (raw file):
the child classes declared Node type for some of these methods. and no tests fail. I'm not sure if there is some other issue?


modules/angular2/src/dom/generic_browser_adapter.ts, line 9 [r1] (raw file):
only comes from native API - looks like List should be correct.
http://www.w3.org/TR/shadow-dom/#widl-HTMLContentElement-getDistributedNodes-NodeList


modules/angular2/src/dom/generic_browser_adapter.ts, line 22 [r1] (raw file):
I spent a while on this one - I don't see any API that provides cssRules on the StyleSheet type.


modules/angular2/src/facade/async.ts, line 12 [r1] (raw file):
Done.


modules/angular2/src/facade/collection.ts, line 71 [r1] (raw file):
Done.


modules/angular2/src/facade/lang.ts, line 42 [r1] (raw file):
Done.


modules/angular2/src/facade/lang.ts, line 46 [r1] (raw file):
Done.


modules/angular2/src/facade/lang.ts, line 53 [r1] (raw file):
Done.


modules/angular2/src/facade/lang.ts, line 216 [r1] (raw file):
Done.


modules/angular2/src/forms/model.ts, line 125 [r1] (raw file):
Done.


modules/angular2/src/http/http.ts, line 177 [r1] (raw file):
actually there is already a type for it in ./interfaces


modules/angular2/src/render/dom/compiler/compile_control.ts, line 14 [r1] (raw file):
Done.


modules/angular2/src/render/dom/compiler/compile_control.ts, line 21 [r1] (raw file):
Done.


modules/angular2/src/render/dom/events/event_manager.ts, line 93 [r1] (raw file):
Done.


modules/angular2/src/render/dom/events/event_manager.ts, line 101 [r1] (raw file):
Done.


modules/angular2/src/render/dom/events/key_events.ts, line 95 [r1] (raw file):
Done.


modules/angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy.ts, line 23 [r1] (raw file):
Done.


modules/angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy.ts, line 13 [r1] (raw file):
Done.


modules/angular2/src/render/dom/view/view_container.ts, line 9 [r1] (raw file):
Done.


modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts, line 85 [r1] (raw file):
HTMLElement works


modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts, line 179 [r1] (raw file):
Done.


modules/angular2/test/render/dom/dom_renderer_integration_spec.ts, line 110 [r1] (raw file):
HTMLInputElement works


modules/angular2/test/render/dom/dom_renderer_integration_spec.ts, line 113 [r1] (raw file):
Done.


Comments from the review on Reviewable.io

@alexeagle alexeagle force-pushed the lint branch 4 times, most recently from efd3372 to 0df1eb5 Compare June 29, 2015 20:24
The first enabled rule enforces return types
declared on non-private (underscore-prefix)
methods that return something.
@alexeagle alexeagle force-pushed the lint branch 2 times, most recently from 1ba049f to 5add94d Compare June 29, 2015 21:27
@alexeagle
Copy link
Copy Markdown
Contributor Author

Merged in 4489199

@alexeagle alexeagle closed this Jun 29, 2015
@alexeagle alexeagle deleted the lint branch June 29, 2015 23:07
alexeagle added a commit to alexeagle/angular that referenced this pull request Jul 6, 2015
Previously, when a return type was missing it
could have been any. But following angular#2746 we
require return types so remaining untyped returns
must be void.
alexeagle added a commit that referenced this pull request Jul 7, 2015
Previously, when a return type was missing it
could have been any. But following #2746 we
require return types so remaining untyped returns
must be void.
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup