Commit ffdd8ad5 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Reformat all of our .mjs files with clang-format --style=file

Tweak space-before-function-paren rules to be comatible with clang-format.

Change-Id: I686766972996f652a8ffe15f724227279117bbb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767284
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690266}
parent d20f64b9
......@@ -272,7 +272,8 @@ module.exports = {
'space-before-function-paren': [
'error',
{
anonymous: 'always',
anonymous: 'never',
asyncArrow: 'always',
named: 'never'
}
],
......
......@@ -37,7 +37,7 @@ function installGetter(proto, propName, getter) {
export function installPropertiesAndFunctions(proto, internals) {
reflection.installBool(proto, 'disabled');
reflection.installString(proto, 'name');
installGetter(proto, 'type', function () {
installGetter(proto, 'type', function() {
if (!(this instanceof proto.constructor)) {
throw new TypeError(
'The context object is not an instance of ' + proto.contructor.name);
......@@ -45,28 +45,28 @@ export function installPropertiesAndFunctions(proto, internals) {
return this.localName;
});
installGetter(proto, 'form', function () {
installGetter(proto, 'form', function() {
return this[internals].form;
});
installGetter(proto, 'willValidate', function () {
installGetter(proto, 'willValidate', function() {
return this[internals].willValidate;
});
installGetter(proto, 'validity', function () {
installGetter(proto, 'validity', function() {
return this[internals].validity;
});
installGetter(proto, 'validationMessage', function () {
installGetter(proto, 'validationMessage', function() {
return this[internals].validationMessage;
});
installGetter(proto, 'labels', function () {
installGetter(proto, 'labels', function() {
return this[internals].labels;
});
proto.checkValidity = function () {
proto.checkValidity = function() {
return this[internals].checkValidity();
};
proto.reportValidity = function () {
proto.reportValidity = function() {
return this[internals].reportValidity();
};
proto.setCustomValidity = function (error) {
proto.setCustomValidity = function(error) {
if (error === undefined) {
throw new TypeError('Too few arguments');
}
......
......@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as face from './face_utils.mjs';
import * as reflection from '../internal/reflection.mjs';
import {SwitchTrack} from './track.mjs';
import * as face from './face_utils.mjs';
import * as style from './style.mjs';
import {SwitchTrack} from './track.mjs';
const generateStyleSheet = style.styleSheetFactory();
......@@ -33,8 +34,9 @@ export class StdSwitchElement extends HTMLElement {
constructor() {
super();
if (new.target !== StdSwitchElement) {
throw new TypeError('Illegal constructor: StdSwitchElement is not ' +
'extensible for now');
throw new TypeError(
'Illegal constructor: StdSwitchElement is not ' +
'extensible for now');
}
this[_internals] = this.attachInternals();
this._initializeDOM();
......
......@@ -114,8 +114,8 @@ export class StdToastElement extends HTMLElement {
get action() {
return this.#actionSlot.assignedNodes().length !== 0 ?
this.#actionSlot.assignedNodes()[0] :
null;
this.#actionSlot.assignedNodes()[0] :
null;
}
set action(val) {
......@@ -173,8 +173,9 @@ export class StdToastElement extends HTMLElement {
show({duration = DEFAULT_DURATION} = {}) {
if (duration <= 0) {
throw new RangeError(`Invalid Argument: duration must be greater ` +
`than 0 [${duration} given]`);
throw new RangeError(
`Invalid Argument: duration must be greater ` +
`than 0 [${duration} given]`);
}
this.setAttribute('open', '');
......@@ -224,12 +225,7 @@ delete StdToastElement.prototype.connectedCallback;
export function showToast(message, options = {}) {
const toast = new StdToastElement(message);
const {
action,
closeButton,
type,
...showOptions
} = options;
const {action, closeButton, type, ...showOptions} = options;
if (isElement(action)) {
toast.action = action;
......@@ -258,8 +254,7 @@ export function showToast(message, options = {}) {
return toast;
}
const idGetter =
Object.getOwnPropertyDescriptor(Element.prototype, 'id').get;
const idGetter = Object.getOwnPropertyDescriptor(Element.prototype, 'id').get;
function isElement(value) {
try {
idGetter.call(value);
......
......@@ -12,7 +12,7 @@
*
* @param {!Set} a A set of elements.
* @param {!Set} b A set of elements.
*/
*/
export function difference(a, b) {
const result = new Set();
for (const element of a) {
......
......@@ -45,10 +45,8 @@ const StorageAreaAsyncIteratorPrototype = {
};
Object.defineProperty(
StorageAreaAsyncIteratorPrototype,
Symbol.toStringTag,
{writable: false, enumerable: false}
);
StorageAreaAsyncIteratorPrototype, Symbol.toStringTag,
{writable: false, enumerable: false});
function getNextIterResult(iter, performDatabaseOperation) {
return performDatabaseOperation(async (transaction, store) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment