Skip to content

Commit

Permalink
Remove @Suppress {missingProperties}
Browse files Browse the repository at this point in the history
It may break stuff in closure to use this much, so try to shape classes
for closure directly.

Use polymer pass v2 to remove warnings for properties defined in
`properties` block
  • Loading branch information
dfreedm committed Jun 21, 2017
1 parent 9b7e184 commit 2efccb9
Show file tree
Hide file tree
Showing 15 changed files with 342 additions and 191 deletions.
314 changes: 223 additions & 91 deletions closure.log

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions externs/polymer-externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ Polymer.sanitizeDOMValue;
*/
function JSCompiler_renameProperty(string, obj) {}

/** @record */
function PolymerTelemetry(){}
/** @type {number} */
PolymerTelemetry.prototype.instanceCount;
/** @type {Array<HTMLElement>} */
PolymerTelemetry.prototype.registrations;
/** @type {function(HTMLElement)} */
PolymerTelemetry.prototype._regLog;
/** @type {function(HTMLElement)} */
PolymerTelemetry.prototype.register;
/** @type {function(HTMLElement)} */
PolymerTelemetry.prototype.dumpRegistrations;
/** @type {Object} */
Polymer.telemetry;

/** @type {Object} */
Polymer_PropertyEffects.prototype.__computeEffects;
/** @type {Object} */
Polymer_PropertyEffects.prototype.__reflectEffects;
/** @type {Object} */
Polymer_PropertyEffects.prototype.__notifyEffects;
/** @type {Object} */
Polymer_PropertyEffects.prototype.__propagateEffects;
/** @type {Object} */
Polymer_PropertyEffects.prototype.__observeEffects;
/** @type {Object} */
Polymer_PropertyEffects.prototype.__readOnly;
1 change: 1 addition & 0 deletions externs/webcomponents-externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @fileoverview Externs for webcomponents polyfills
* @externs
*/
/* eslint-disable */

let HTMLImports = {
/**
Expand Down
10 changes: 7 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ gulp.task('closure', ['clean'], () => {
}

config('polymer.html');
// config('lib/mixins/property-effects.html');

const project = new PolymerProject({
shell: `./${entry}`,
Expand Down Expand Up @@ -146,16 +147,19 @@ gulp.task('closure', ['clean'], () => {
rewrite_polyfills: false,
new_type_inf: true,
checks_only: CLOSURE_LINT_ONLY,
polymer_version: 2,
externs: [
'bower_components/shadycss/externs/shadycss-externs.js',
'externs/webcomponents-externs.js',
'externs/closure-types.js',
'externs/polymer-externs.js',
],
extra_annotation_name: [
'polymerMixin',
'polymerMixinClass',
'polymerElement'
'appliesMixin',
'mixinClass',
'mixinFunction',
'polymer',
'customElement'
]
}, closurePluginOptions);

Expand Down
2 changes: 1 addition & 1 deletion lib/elements/array-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
* @mixinFunction
* @polymer
* @appliesMixin Polymer.ElementMixin
* @memberof Polymer
* @summary Element mixin for recording dynamic associations between item paths in a
* master `items` array and a `selected` array
Expand All @@ -48,6 +47,7 @@

/**
* @mixinClass
* @polymer
* @implements {Polymer_ArraySelectorMixin}
* @unrestricted
*/
Expand Down
1 change: 0 additions & 1 deletion lib/elements/dom-bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
/**
* Forces the element to render its content. This is typically only
* necessary to call if HTMLImports with the async attribute are used.
* @suppress {missingProperties}
*/
render() {
let template;
Expand Down
1 change: 0 additions & 1 deletion lib/elements/dom-if.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@
return true;
}

/** @suppress {missingProperties} */
__syncHostProperties() {
let props = this.__invalidProps;
if (props) {
Expand Down
7 changes: 1 addition & 6 deletions lib/elements/dom-repeat.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
* @polymer
* @memberof Polymer
* @extends {domRepeatBase}
* @appliesMixin Polymer.MutableData
* @appliesMixin Polymer.OptionalMutableData
* @summary Custom element for stamping instance of a template bound to
* items in an array.
*/
Expand Down Expand Up @@ -372,10 +372,6 @@
return true;
}

/* eslint-disable valid-jsdoc */
/**
* @suppress {missingProperties}
*/
__getMethodHost() {
// Technically this should be the owner of the outermost template.
// In shadow dom, this is always getRootNode().host, but we can
Expand All @@ -384,7 +380,6 @@
// instance causing it to get a dataHost.
return this.__dataHost._methodHost || this.__dataHost;
}
/* eslint-enable valid-jsdoc */

__sortChanged(sort) {
let methodHost = this.__getMethodHost();
Expand Down
3 changes: 1 addition & 2 deletions lib/legacy/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
* @param {!PolymerInit} info Polymer info object
* @param {!HTMLElement} Base base class to extend with info object
* @return {!HTMLElement} Generated class
* @suppress {missingProperties, checkTypes}
* @suppress {checkTypes}
* @private
*/
function GenerateClassFromInfo(info, Base) {
Expand All @@ -151,7 +151,6 @@
}

/**
* @suppress {missingProperties}
* @return {HTMLTemplateElement} template for this class
*/
static get template() {
Expand Down
1 change: 0 additions & 1 deletion lib/legacy/legacy-element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@
* a user should call `distributeContent` if distribution has been
* invalidated due to an element being added or removed from the shadowRoot
* that contains an insertion point (`<slot>`) inside its subtree.
* @suppress {missingProperties}
*/
distributeContent() {
if (window.ShadyDOM && this.shadowRoot) {
Expand Down
10 changes: 3 additions & 7 deletions lib/mixins/element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
*
* @param {PolymerElementConstructor} klass Element class
* @return {PolymerElementProperties} Flattened properties for this class
* @suppress {missingProperties}
* @private
*/
function propertiesForClass(klass) {
Expand Down Expand Up @@ -626,7 +625,6 @@
* Stamps the element template.
*
* @override
* @suppress {missingProperties}
*/
ready() {
if (this._template) {
Expand Down Expand Up @@ -758,7 +756,6 @@
* created for them.
*
* @override
* @suppress {missingProperties}
*/
static _parseTemplateContent(template, templateInfo, nodeInfo) {
templateInfo.dynamicFns = templateInfo.dynamicFns || propertiesForClass(this);
Expand Down Expand Up @@ -790,9 +787,8 @@
*/
registrations: [],
/**
* @param {HTMLElement} prototype Element prototype to log
* @param {!PolymerElementConstructor} prototype Element prototype to log
* @private
* @suppress {missingProperties}
*/
_regLog: function(prototype) {
console.log('[' + prototype.is + ']: registered')
Expand All @@ -801,7 +797,7 @@
* Registers a class prototype for telemetry purposes.
* @param {HTMLElement} prototype Element prototype to register
* @protected
* @this {PolymerTelemetry}
* @this {this}
*/
register: function(prototype) {
this.registrations.push(prototype);
Expand All @@ -810,7 +806,7 @@
/**
* Logs all elements registered with an `is` to the console.
* @public
* @this {PolymerTelemetry}
* @this {this}
*/
dumpRegistrations: function() {
this.registrations.forEach(this._regLog);
Expand Down
3 changes: 2 additions & 1 deletion lib/mixins/mutable-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}

}
/** @type boolean */
/** @type {boolean} */
MutableData.prototype.mutableData = false;

return MutableData;
Expand Down Expand Up @@ -150,6 +150,7 @@

/**
* @mixinClass
* @polymer
* @implements {Polymer_OptionalMutableData}
*/
class OptionalMutableData extends superClass {
Expand Down
28 changes: 25 additions & 3 deletions lib/mixins/property-accessors.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,28 @@

constructor() {
super();
/** @type {boolean} */
this.__serializing;
/** @type {number} */
this.__dataCounter;
/** @type {boolean} */
this.__dataEnabled;
/** @type {boolean} */
this.__dataReady;
/** @type {boolean} */
this.__dataInvalid;
/** @type {!Object} */
this.__data;
/** @type {Object} */
this.__dataPending;
/** @type {Object} */
this.__dataOld;
/** @type {Object} */
this.__dataProto;
/** @type {Object} */
this.__dataHasAccessor;
/** @type {Object} */
this.__dataInstanceProps;
this._initializeProperties();
}

Expand Down Expand Up @@ -452,7 +474,7 @@
this.__dataOld = {};
}
// Ensure old is captured from the last turn
if (!(property in this.__dataOld)) {
if (this.__dataOld && !(property in this.__dataOld)) {
this.__dataOld[property] = old;
}
this.__data[property] = value;
Expand All @@ -469,7 +491,7 @@
* @protected
*/
_isPropertyPending(prop) {
return this.__dataPending && (prop in this.__dataPending);
return Boolean(this.__dataPending && (prop in this.__dataPending));
}

/**
Expand Down Expand Up @@ -519,7 +541,7 @@
* @protected
*/
_flushProperties() {
if (this.__dataPending) {
if (this.__dataPending && this.__dataOld) {
let changedProps = this.__dataPending;
this.__dataPending = null;
this.__dataCounter++;
Expand Down
Loading

0 comments on commit 2efccb9

Please sign in to comment.