Skip to content

Commit 04a8929

Browse files
committed
Fix all JS files with Prettier v2
1 parent ed9c8c6 commit 04a8929

File tree

1,367 files changed

+10472
-11381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,367 files changed

+10472
-11381
lines changed

3p/3d-gltf/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {user} from '../../src/log';
2222

2323
import GltfViewer from './viewer';
2424

25-
const seq = (taskA, taskB) => cb => taskA(() => taskB(cb));
26-
const parallel = (taskA, taskB) => cb => {
25+
const seq = (taskA, taskB) => (cb) => taskA(() => taskB(cb));
26+
const parallel = (taskA, taskB) => (cb) => {
2727
let n = 0;
2828
const finish = () => {
2929
n++;
@@ -36,8 +36,8 @@ const parallel = (taskA, taskB) => cb => {
3636
};
3737

3838
const loadThree = (global, cb) => {
39-
const loadScriptCb = url => cb => loadScript(global, url, cb);
40-
const loadThreeExample = examplePath =>
39+
const loadScriptCb = (url) => (cb) => loadScript(global, url, cb);
40+
const loadThreeExample = (examplePath) =>
4141
loadScriptCb(
4242
'https://cdn.jsdelivr.net/npm/[email protected]/examples/js/' + examplePath
4343
);
@@ -62,7 +62,7 @@ export function gltfViewer(global) {
6262
onload: () => {
6363
nonSensitiveDataPostMessage('loaded');
6464
},
65-
onprogress: e => {
65+
onprogress: (e) => {
6666
if (!e.lengthComputable) {
6767
return;
6868
}
@@ -74,7 +74,7 @@ export function gltfViewer(global) {
7474
})
7575
);
7676
},
77-
onerror: err => {
77+
onerror: (err) => {
7878
user().error('3DGLTF', err);
7979
nonSensitiveDataPostMessage(
8080
'error',
@@ -84,7 +84,7 @@ export function gltfViewer(global) {
8484
);
8585
},
8686
});
87-
listenParent(global, 'action', msg => {
87+
listenParent(global, 'action', (msg) => {
8888
viewer.actions[msg['action']](msg['args']);
8989
});
9090
nonSensitiveDataPostMessage('ready');

3p/3d-gltf/viewer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default class GltfViewer {
128128
let oldW = null;
129129
let oldH = null;
130130
/** @param {JsonObject} box */
131-
const setSize = box => {
131+
const setSize = (box) => {
132132
const w = box['width'];
133133
const h = box['height'];
134134
if (oldW === w && oldH === h) {
@@ -250,9 +250,9 @@ export default class GltfViewer {
250250
loader.load(
251251
this.options_['src'],
252252
/** @param {{scene: !THREE.Scene}} gltfData */
253-
gltfData => {
253+
(gltfData) => {
254254
this.setupCameraForObject_(gltfData.scene);
255-
gltfData.scene.children.slice().forEach(child => {
255+
gltfData.scene.children.slice().forEach((child) => {
256256
this.model_.add(child);
257257
});
258258

3p/3p.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export function computeInMasterFrame(global, taskId, work, cb) {
197197
if (!global.context.isMaster) {
198198
return; // Only do work in master.
199199
}
200-
work(result => {
200+
work((result) => {
201201
for (let i = 0; i < cbs.length; i++) {
202202
cbs[i].call(null, result);
203203
}
@@ -254,7 +254,7 @@ export function validateData(data, mandatoryFields, opt_optionalFields) {
254254
*/
255255
function validateExactlyOne(data, alternativeFields) {
256256
userAssert(
257-
alternativeFields.filter(field => data[field]).length === 1,
257+
alternativeFields.filter((field) => data[field]).length === 1,
258258
'%s must contain exactly one of attributes: %s.',
259259
data.type,
260260
alternativeFields.join(', ')

3p/ampcontext.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class AbstractAmpContext {
129129
this.client_.makeRequest(
130130
MessageType.SEND_EMBED_STATE,
131131
MessageType.EMBED_STATE,
132-
data => {
132+
(data) => {
133133
this.hidden = data['pageHidden'];
134134
this.dispatchVisibilityChangeEvent_();
135135
}
@@ -155,7 +155,7 @@ export class AbstractAmpContext {
155155
* every time we receive a page visibility message.
156156
*/
157157
onPageVisibilityChange(callback) {
158-
return this.client_.registerCallback(MessageType.EMBED_STATE, data => {
158+
return this.client_.registerCallback(MessageType.EMBED_STATE, (data) => {
159159
callback({hidden: data['pageHidden']});
160160
});
161161
}
@@ -171,7 +171,7 @@ export class AbstractAmpContext {
171171
return this.client_.makeRequest(
172172
MessageType.SEND_INTERSECTIONS,
173173
MessageType.INTERSECTION,
174-
intersection => {
174+
(intersection) => {
175175
callback(intersection['changes']);
176176
}
177177
);
@@ -230,7 +230,7 @@ export class AbstractAmpContext {
230230
* request succeeds.
231231
*/
232232
onResizeSuccess(callback) {
233-
this.client_.registerCallback(MessageType.EMBED_SIZE_CHANGED, obj => {
233+
this.client_.registerCallback(MessageType.EMBED_SIZE_CHANGED, (obj) => {
234234
callback(obj['requestedHeight'], obj['requestedWidth']);
235235
});
236236
}
@@ -243,7 +243,7 @@ export class AbstractAmpContext {
243243
* request is denied.
244244
*/
245245
onResizeDenied(callback) {
246-
this.client_.registerCallback(MessageType.EMBED_SIZE_DENIED, obj => {
246+
this.client_.registerCallback(MessageType.EMBED_SIZE_DENIED, (obj) => {
247247
callback(obj['requestedHeight'], obj['requestedWidth']);
248248
});
249249
}

3p/beopinion.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {setStyles} from '../src/style';
2525
* @param {!Window} global
2626
*/
2727
function getBeOpinion(global) {
28-
loadScript(global, 'https://widget.beopinion.com/sdk.js', function() {});
28+
loadScript(global, 'https://widget.beopinion.com/sdk.js', function () {});
2929
}
3030

3131
/**
@@ -87,20 +87,20 @@ function createContainer(global, data) {
8787
*/
8888
function getBeOpinionAsyncInit(global, accountId) {
8989
const {context} = global;
90-
return function() {
91-
context.onResizeDenied(function(requestedHeight, requestedWidth) {
90+
return function () {
91+
context.onResizeDenied(function (requestedHeight, requestedWidth) {
9292
context.requestResize(requestedWidth, requestedHeight);
9393
});
9494
global.BeOpinionSDK.init({
9595
account: accountId,
96-
onContentReceive: function(hasContent) {
96+
onContentReceive: function (hasContent) {
9797
if (hasContent) {
9898
context.renderStart();
9999
} else {
100100
context.noContentAvailable();
101101
}
102102
},
103-
onHeightChange: function(newHeight) {
103+
onHeightChange: function (newHeight) {
104104
const c = global.document.getElementById('c');
105105
const boundingClientRect = c./*REVIEW*/ getBoundingClientRect();
106106
context.requestResize(boundingClientRect.width, newHeight);

3p/bodymovinanimation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getBodymovinAnimationSdk(global, renderer, cb) {
3838
renderer === 'svg'
3939
? 'https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.13.0/bodymovin_light.min.js'
4040
: 'https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.13.0/bodymovin.min.js';
41-
loadScript(global, scriptToLoad, function() {
41+
loadScript(global, scriptToLoad, function () {
4242
cb(global.bodymovin);
4343
});
4444
}
@@ -83,7 +83,7 @@ export function bodymovinanimation(global) {
8383
const shouldLoop = dataLoop != 'false';
8484
const loop = !isNaN(dataLoop) ? dataLoop : shouldLoop;
8585
const renderer = dataReceived['renderer'];
86-
getBodymovinAnimationSdk(global, renderer, function(bodymovin) {
86+
getBodymovinAnimationSdk(global, renderer, function (bodymovin) {
8787
animationHandler = bodymovin.loadAnimation({
8888
container: animatingContainer,
8989
renderer,

3p/embedly.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const CardOptions = {
6464
* @visibleForTesting
6565
*/
6666
function getEmbedly(global, callback) {
67-
loadScript(global, EMBEDLY_SDK_URL, function() {
67+
loadScript(global, EMBEDLY_SDK_URL, function () {
6868
callback();
6969
});
7070
}
@@ -98,15 +98,15 @@ export function embedly(global, data) {
9898

9999
container.appendChild(card);
100100

101-
getEmbedly(global, function() {
101+
getEmbedly(global, function () {
102102
// Given by the parent frame.
103103
delete data.width;
104104
delete data.height;
105105

106106
global.window['embedly']('card', card);
107107

108108
// Use embedly SDK to listen to resize event from loaded card
109-
global.window['embedly']('on', RESIZE_EVENT_NAME, function(iframe) {
109+
global.window['embedly']('on', RESIZE_EVENT_NAME, function (iframe) {
110110
context.requestResize(
111111
iframe./*OK*/ width,
112112
parseInt(iframe./*OK*/ height, 10) + /* margin */ 5

3p/environment.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ function manageWin_(win) {
7373
function instrumentDocWrite(parent, win) {
7474
const doc = win.document;
7575
const {close} = doc;
76-
doc.close = function() {
77-
parent.ampManageWin = function(win) {
76+
doc.close = function () {
77+
parent.ampManageWin = function (win) {
7878
manageWin(win);
7979
};
8080
if (!parent.ampSeen) {
@@ -93,7 +93,7 @@ function instrumentDocWrite(parent, win) {
9393
*/
9494
function instrumentSrcdoc(parent, iframe) {
9595
let srcdoc = iframe.getAttribute('srcdoc');
96-
parent.ampManageWin = function(win) {
96+
parent.ampManageWin = function (win) {
9797
manageWin(win);
9898
};
9999
srcdoc += '<script>window.parent.ampManageWin(window)</script>';
@@ -159,7 +159,7 @@ function installObserver(win) {
159159
if (!window.MutationObserver) {
160160
return;
161161
}
162-
const observer = new MutationObserver(function(mutations) {
162+
const observer = new MutationObserver(function (mutations) {
163163
for (let i = 0; i < mutations.length; i++) {
164164
maybeInstrumentsNodes(win, mutations[i].addedNodes);
165165
}
@@ -177,14 +177,14 @@ function installObserver(win) {
177177
function instrumentEntryPoints(win) {
178178
// Change setTimeout to respect a minimum timeout.
179179
const {setTimeout} = win;
180-
win.setTimeout = function(fn, time) {
180+
win.setTimeout = function (fn, time) {
181181
time = minTime(time);
182182
arguments[1] = time;
183183
return setTimeout.apply(this, arguments);
184184
};
185185
// Implement setInterval in terms of setTimeout to make
186186
// it respect the same rules
187-
win.setInterval = function(fn) {
187+
win.setInterval = function (fn) {
188188
const id = intervalId++;
189189
const args = Array.prototype.slice.call(arguments);
190190
/**
@@ -195,7 +195,8 @@ function instrumentEntryPoints(win) {
195195
next();
196196
if (typeof fn == 'string') {
197197
// Handle rare and dangerous string arg case.
198-
return (0, win.eval /*NOT OK but whatcha gonna do.*/).call(win, fn); // lgtm [js/useless-expression]
198+
return (0, win.eval) /*NOT OK but whatcha gonna do.*/
199+
.call(win, fn); // lgtm [js/useless-expression]
199200
} else {
200201
return fn.apply(this, arguments);
201202
}
@@ -211,7 +212,7 @@ function instrumentEntryPoints(win) {
211212
return id;
212213
};
213214
const {clearInterval} = win;
214-
win.clearInterval = function(id) {
215+
win.clearInterval = function (id) {
215216
clearInterval(id);
216217
win.clearTimeout(intervals[id]);
217218
delete intervals[id];
@@ -235,11 +236,11 @@ function blockSyncPopups(win) {
235236
}
236237
try {
237238
win.alert = maybeThrow;
238-
win.prompt = function() {
239+
win.prompt = function () {
239240
maybeThrow();
240241
return '';
241242
};
242-
win.confirm = function() {
243+
win.confirm = function () {
243244
maybeThrow();
244245
return false;
245246
};
@@ -269,7 +270,7 @@ function minTime(time) {
269270
* Installs embed state listener.
270271
*/
271272
export function installEmbedStateListener() {
272-
listenParent(window, 'embed-state', function(data) {
273+
listenParent(window, 'embed-state', function (data) {
273274
inViewport = data['inViewport'];
274275
});
275276
}

3p/facebook.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ export function facebook(global, data) {
228228

229229
getFacebookSdk(
230230
global,
231-
FB => {
231+
(FB) => {
232232
// Dimensions are given by the parent frame.
233233
delete data.width;
234234
delete data.height;
235235

236-
FB.Event.subscribe('xfbml.resize', event => {
236+
FB.Event.subscribe('xfbml.resize', (event) => {
237237
context.updateDimensions(
238238
parseInt(event.width, 10),
239239
parseInt(event.height, 10) + /* margins */ 20

3p/github.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {writeScript} from './3p';
2929
* @param {function()} cb
3030
*/
3131
function getGistJs(global, scriptSource, cb) {
32-
writeScript(global, scriptSource, function() {
32+
writeScript(global, scriptSource, function () {
3333
cb();
3434
});
3535
}
@@ -52,7 +52,7 @@ export function github(global, data) {
5252
gistUrl += '?file=' + encodeURIComponent(data.file);
5353
}
5454

55-
getGistJs(global, gistUrl, function() {
55+
getGistJs(global, gistUrl, function () {
5656
// Dimensions are given by the parent frame.
5757
delete data.width;
5858
delete data.height;

3p/iframe-messaging-client.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class IframeMessagingClient {
6262
getData(requestType, payload, callback) {
6363
const responseType = requestType + CONSTANTS.responseTypeSuffix;
6464
const messageId = this.nextMessageId_++;
65-
const unlisten = this.registerCallback(responseType, result => {
65+
const unlisten = this.registerCallback(responseType, (result) => {
6666
if (result[CONSTANTS.messageIdFieldName] === messageId) {
6767
unlisten();
6868
callback(result[CONSTANTS.contentFieldName]);
@@ -100,7 +100,7 @@ export class IframeMessagingClient {
100100
* @return {*} TODO(#23582): Specify return type
101101
*/
102102
requestOnce(requestType, responseType, callback) {
103-
const unlisten = this.registerCallback(responseType, event => {
103+
const unlisten = this.registerCallback(responseType, (event) => {
104104
unlisten();
105105
callback(event);
106106
});
@@ -191,7 +191,7 @@ export class IframeMessagingClient {
191191
* @private
192192
*/
193193
setupEventListener_() {
194-
listen(this.win_, 'message', event => {
194+
listen(this.win_, 'message', (event) => {
195195
// If we have set a host window, strictly check that it's from it.
196196
if (this.hostWindow_ && event.source != this.hostWindow_) {
197197
return;

3p/iframe-transport-client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class IframeTransportClient {
6262
this.iframeMessagingClient_.makeRequest(
6363
MessageType.SEND_IFRAME_TRANSPORT_EVENTS,
6464
MessageType.IFRAME_TRANSPORT_EVENTS,
65-
eventData => {
65+
(eventData) => {
6666
const events =
6767
/**
6868
* @type
@@ -77,7 +77,7 @@ export class IframeTransportClient {
7777
events.length,
7878
'Received empty events list in ' + this.win_.location.href
7979
);
80-
events.forEach(event => {
80+
events.forEach((event) => {
8181
try {
8282
devAssert(
8383
event.creativeId,

3p/integration.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ export function draw3p(win, data, configCallback) {
638638
win.context.tagName
639639
);
640640
if (configCallback) {
641-
configCallback(data, data => {
641+
configCallback(data, (data) => {
642642
userAssert(data, 'Expected configuration to be passed as first argument');
643643
run(type, win, data);
644644
});
@@ -659,7 +659,7 @@ export function draw3p(win, data, configCallback) {
659659
* @param {!Array<string>=} opt_allowedEmbeddingOrigins List of domain suffixes
660660
* that are allowed to embed this frame.
661661
*/
662-
window.draw3p = function(
662+
window.draw3p = function (
663663
opt_configCallback,
664664
opt_allowed3pTypes,
665665
opt_allowedEmbeddingOrigins

0 commit comments

Comments
 (0)