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

♻️ Lint: include externs (round 2) #26446

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ out/**
test/coverage/**

# Code directories
**/*.extern.js
build-system/tasks/visual-diff/snippets/*.js
build-system/babel-plugins/**/fixtures/**/*.js
build-system/server/app-index/test/*.js
Expand Down
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,20 @@
"process": false,
"require": false
}
},
{
"files": ["**/*.extern.js"],
"rules": {
"no-var": 0,
"no-undef": 0,
"no-unused-vars": 0,
"prefer-const": 0,
"require-jsdoc": 0,
"jsdoc/check-tag-names": 0,
"local/closure-type-primitives": 0,
"local/no-duplicate-name-typedef": 0,
"google-camelcase/google-camelcase": 0
}
}
]
}
132 changes: 72 additions & 60 deletions ads/ads.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
// HACK. Define application types used in default AMP externs
// that are not in the 3p code.
/** @constructor */
function BaseElement$$module$src$base_element() {};
function BaseElement$$module$src$base_element() {}
/** @constructor */
function AmpAdXOriginIframeHandler$$module$extensions$amp_ad$0_1$amp_ad_xorigin_iframe_handler() {};
function AmpAdXOriginIframeHandler$$module$extensions$amp_ad$0_1$amp_ad_xorigin_iframe_handler() {}
/** @constructor */
function AmpAd3PImpl$$module$extensions$amp_ad$0_1$amp_ad_3p_impl() {};
function AmpAd3PImpl$$module$extensions$amp_ad$0_1$amp_ad_3p_impl() {}
/** @constructor */
function AmpA4A$$module$extensions$amp_a4a$0_1$amp_a4a() {};
function AmpA4A$$module$extensions$amp_a4a$0_1$amp_a4a() {}
/** @constructor */
function AmpAdUIHandler$$module$extensions$amp_ad$0_1$amp_ad_ui() {};
function AmpAdUIHandler$$module$extensions$amp_ad$0_1$amp_ad_ui() {}

// Long list of, uhm, stuff the ads code needs to compile.
// All unquoted external properties need to be added here.
Expand All @@ -54,93 +54,101 @@ data.embedtype;
data.src;

//twitter.js
data.tweetid
data.tweetid;

//mathml.js
data.formula
var mathjax
mathjax.Hub
mathjax.Hub.Config
mathjax.Hub.Queue
window.MathJax
data.formula;
var mathjax;
mathjax.Hub;
mathjax.Hub.Config;
mathjax.Hub.Queue;
window.MathJax;

//3d-gltf/index.js
var THREE;

THREE.LoaderUtils
THREE.LoaderUtils.extractUrlBase
THREE.LoaderUtils;
THREE.LoaderUtils.extractUrlBase;

THREE.WebGLRenderer = class {
/** @param {!JsonObject} opts */
constructor(opts) {
/** @type {?Element} */ this.domElement = null;}};
THREE.WebGLRenderer.prototype.setSize
THREE.WebGLRenderer.prototype.setPixelRatio
THREE.WebGLRenderer.prototype.setClearColor
THREE.WebGLRenderer.prototype.render
/** @type {?Element} */ this.domElement = null;
}
};
THREE.WebGLRenderer.prototype.setSize;
THREE.WebGLRenderer.prototype.setPixelRatio;
THREE.WebGLRenderer.prototype.setClearColor;
THREE.WebGLRenderer.prototype.render;
/** @type {boolean} */
THREE.WebGLRenderer.prototype.gammaOutput
THREE.WebGLRenderer.prototype.gammaOutput;
/** @type {number} */
THREE.WebGLRenderer.prototype.gammaFactor
THREE.WebGLRenderer.prototype.gammaFactor;

THREE.Light = class extends THREE.Object3D {};
THREE.DirectionalLight = class extends THREE.Light {};
THREE.AmbientLight = class extends THREE.Light {};

THREE.Box3 = class {};
THREE.Box3.prototype.getSize
THREE.Box3.prototype.getCenter
THREE.Box3.prototype.setFromObject
THREE.Box3.prototype.min
THREE.Box3.prototype.max
THREE.Box3.prototype.getSize;
THREE.Box3.prototype.getCenter;
THREE.Box3.prototype.setFromObject;
THREE.Box3.prototype.min;
THREE.Box3.prototype.max;

THREE.Vector3 = class {
/** @param {number=} opt_x
* @param {number=} opt_y
* @param {number=} opt_z */
constructor(opt_x, opt_y, opt_z) {}
};
THREE.Vector3.prototype.lerpVectors
THREE.Vector3.prototype.copy
THREE.Vector3.prototype.clone
THREE.Vector3.prototype.subVectors
THREE.Vector3.prototype.multiplyScalar
THREE.Vector3.prototype.setFromMatrixColumn
THREE.Vector3.prototype.add
THREE.Vector3.prototype.set
THREE.Vector3.prototype.applyQuaternion
THREE.Vector3.prototype.setFromSpherical
THREE.Vector3.prototype.distanceToSquared
THREE.Vector3.prototype.length
THREE.Vector3.prototype.fromArray
THREE.Vector3.prototype.lerpVectors;
THREE.Vector3.prototype.copy;
THREE.Vector3.prototype.clone;
THREE.Vector3.prototype.subVectors;
THREE.Vector3.prototype.multiplyScalar;
THREE.Vector3.prototype.setFromMatrixColumn;
THREE.Vector3.prototype.add;
THREE.Vector3.prototype.set;
THREE.Vector3.prototype.applyQuaternion;
THREE.Vector3.prototype.setFromSpherical;
THREE.Vector3.prototype.distanceToSquared;
THREE.Vector3.prototype.length;
THREE.Vector3.prototype.fromArray;

THREE.Euler = class {
constructor() {
this.x = 0;
this.y = 0;
this.z = 0;}};
this.z = 0;
}
};

THREE.Euler.prototype.set;

THREE.Object3D = class {
constructor() {
this.position = new THREE.Vector3();
this.rotation = new THREE.Euler();
this.children = [];}};
this.children = [];
}
};

THREE.Object3D.prototype.applyMatrix
THREE.Object3D.prototype.add
THREE.Object3D.prototype.updateMatrixWorld
THREE.Object3D.prototype.lookAt
THREE.Object3D.prototype.clone
THREE.Object3D.prototype.applyMatrix;
THREE.Object3D.prototype.add;
THREE.Object3D.prototype.updateMatrixWorld;
THREE.Object3D.prototype.lookAt;
THREE.Object3D.prototype.clone;

THREE.OrbitControls = class {
/** @param {THREE.Camera} camera
* @param {Element} domElement */
constructor(camera, domElement) {
this.target = new THREE.Vector3(); }};
THREE.OrbitControls.prototype.update
THREE.OrbitControls.prototype.addEventListener
this.target = new THREE.Vector3();
}
};
THREE.OrbitControls.prototype.update;
THREE.OrbitControls.prototype.addEventListener;

THREE.Scene = class extends THREE.Object3D {};
THREE.Group = class extends THREE.Object3D {};
Expand All @@ -152,16 +160,20 @@ THREE.Camera = class extends THREE.Object3D {
this.far = 0;
this.near = 0;
this.aspect = 0;
this.zoom = 0;}};
THREE.Camera.prototype.updateProjectionMatrix
THREE.Camera.prototype.setFromUnitVectors
this.zoom = 0;
}
};
THREE.Camera.prototype.updateProjectionMatrix;
THREE.Camera.prototype.setFromUnitVectors;

THREE.PerspectiveCamera = class extends THREE.Camera {};

THREE.GLTFLoader = class {
constructor() {
this.crossOrigin = false;}};
THREE.GLTFLoader.prototype.load
this.crossOrigin = false;
}
};
THREE.GLTFLoader.prototype.load;

// Under ads/google folder

Expand Down Expand Up @@ -198,7 +210,7 @@ data.overrideHeight;
data.height;
data.multiSizeValidation;
data.categoryExclusions;
data.categoryExclusions.length;;
data.categoryExclusions.length;
data.cookieOptions;
data.tagForChildDirectedTreatment;
data.targeting;
Expand All @@ -218,7 +230,7 @@ google.ima.AdsLoader;
google.ima.AdsLoader.getSettings;
google.ima.AdsLoader.requestAds;
google.ima.AdsManagerLoadedEvent;
google.ima.AdsManagerLoadedEvent.Type
google.ima.AdsManagerLoadedEvent.Type;
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED;
google.ima.AdsManagerLoadedEvent.getAdsManager;
google.ima.AdErrorEvent;
Expand Down Expand Up @@ -419,7 +431,7 @@ data.parameters;
data.queue;

// imedia.js
data.positions
data.positions;

// imonomy.js
data.pid;
Expand Down Expand Up @@ -508,7 +520,7 @@ Guoshi.queryAd.amp;
Guoshi.queryAd.amp.setup;

// openadstream.js
data.adhost
data.adhost;
data.sitepage;
data.pos;
data.query;
Expand Down Expand Up @@ -612,8 +624,8 @@ data.z;
data.tf;

// swoop.js
var Swoop
Swoop.announcePlace
var Swoop;
Swoop.announcePlace;

// taboola.js
data.referrer;
Expand Down
2 changes: 2 additions & 0 deletions build-system/externs/amp.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,15 @@ Activity.prototype.getIncrementalEngagedTime = function(name, reset) {};
AccessService.prototype.getAccessReaderId = function() {};
AccessService.prototype.getAuthdataField = function(field) {};
// Same for amp-analytics

/**
* The "get CID" parameters.
* - createCookieIfNotPresent: Whether CID is allowed to create a cookie when.
* Default value is `false`.
* @typedef {{
* scope: string,
* createCookieIfNotPresent: (boolean|undefined),
* cookieName: (string|undefined),
* }}
*/
var GetCidDef;
Expand Down
1 change: 0 additions & 1 deletion build-system/externs/dompurify.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

/** @externs */


/** @constructor */
var DomPurifyConfig = function() {};

Expand Down
8 changes: 4 additions & 4 deletions build-system/externs/preact.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
/** @externs */

/** @const */
var Preact = {}
var Preact = {};

/**
* @typedef {function(!JsonObject):Preact.Renderable}
*/
Preact.FunctionalComponent
Preact.FunctionalComponent;

/**
* @interface
*/
Preact.VNode = function() {}
Preact.VNode = function() {};

/**
* @interface
*/
Preact.Context = function() {}
Preact.Context = function() {};

/**
* @param {!JsonObject} props
Expand Down
6 changes: 3 additions & 3 deletions third_party/moment/moment.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ moment.Locale = function() {};
* @param {string} format
* @return {string}
*/
moment.Locale.longDateFormat = function (format) {};
moment.Locale.longDateFormat = function(format) {};

/** @return {moment.Locale} */
moment.prototype.localeData = function () {};
moment.prototype.localeData = function() {};

/** @return {!moment} */
moment.prototype.duration = function () {};
moment.prototype.duration = function() {};