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 a grab bag of closure compiler warnings #5329

Merged
merged 2 commits into from
Aug 17, 2018
Merged

Conversation

rictic
Copy link
Contributor

@rictic rictic commented Aug 16, 2018

no-op at runtime, just helping jscompiler (and humans!) understand the code

rictic added 2 commits August 16, 2018 14:23
This fixes all warnings in about half of the remaining files with warnings.
In this file currently you can refer to the function as: caseMap.dashToCamelCase, CaseMap.dashToCamelCase, or dashToCamelCase. Let's just do a standard import style here.
Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

Nice! Should we also bump the Closure compiler version to the latest version? And do we have any more warnings left now or are all resolved? We might want to enforce zero warnings in the latter.

@rictic
Copy link
Contributor Author

rictic commented Aug 16, 2018

Still about ten files left. I'm waiting on a couple other internal-specific cleanup changes to land so I can tackle them, but I hope to have another PR in the next week or so taking care of the rest, then we should totally enforce no warnings in travis!

I don't think we need an updated closure compiler version, but it never hurts. These changes were tested against this week's release

Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

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

One question, otherwise LGTM

return null;
}
return PolymerDomModule.import(moduleId);
return /** @type {?DomModule} */(DomModule.import(moduleId));
Copy link
Member

Choose a reason for hiding this comment

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

Any recollection why the original code used customElements.get to get the DomModule class? It was changed in this PR that doesn't have any detail: https://github.com/Polymer/polymer/pull/4748/files

Copy link
Contributor Author

@rictic rictic Aug 16, 2018

Choose a reason for hiding this comment

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

Yeah, Steve mentioned that ideally utils wouldn't depend on elements, and the customElements.get was there to avoid having that dependency after modularization, I guess in case someone wanted to use targeted imports to not load in dom-module.js. =

I tried to preserve that by declaring some interfaces, but I'm worried it would be fragile, both to changes in DomModule, and in the face of aggressive compiler optimizations. And in practice essentially everyone who loads style-gather is going to load dom-module anyways...

Copy link
Member

@kevinpschaaf kevinpschaaf Aug 17, 2018

Choose a reason for hiding this comment

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

Seems ok for now. We've recently discussed one way to make Polymer double-import safe would be to have <dom-module> only register if not already registered (first in wins), and then have all DomModule.import call sites get DomModule from the CE registry like the old code here did. But if we wanted to do that it would be a more sweeping change, and can do it separately. Steve agreed this change should be fine for now.

Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

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

LGTM. Can't really verify the correctness of the JSDoc annotations, so relying on your verification of closure warnings going down for that.

@rictic rictic merged commit d234fff into master Aug 17, 2018
@rictic rictic deleted the fix-some-compiler-warnings branch August 17, 2018 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants