client/js: format code to ESLint

This commit is contained in:
Shyam Sunder
2020-06-04 14:09:35 -04:00
parent 48c9001194
commit 4329b1620f
67 changed files with 1150 additions and 533 deletions

View File

@ -12,8 +12,8 @@ function decamelize(str, sep) {
.toLowerCase();
}
function* range(start=0, end=null, step=1) {
if (end == null) {
function *range(start = 0, end = null, step = 1) {
if (end === null) {
end = start;
start = 0;
}
@ -63,17 +63,17 @@ function formatRelativeTime(timeString) {
const future = now < then;
const descriptions = [
[60, 'a few seconds', null],
[60 * 2, 'a minute', null],
[60 * 60, '% minutes', 60],
[60 * 60 * 2, 'an hour', null],
[60 * 60 * 24, '% hours', 60 * 60],
[60 * 60 * 24 * 2, 'a day', null],
[60 * 60 * 24 * 30.42, '% days', 60 * 60 * 24],
[60 * 60 * 24 * 30.42 * 2, 'a month', null],
[60 * 60 * 24 * 30.42 * 12, '% months', 60 * 60 * 24 * 30.42],
[60 * 60 * 24 * 30.42 * 12 * 2, 'a year', null],
[8640000000000000 /*max*/, '% years', 60 * 60 * 24 * 30.42 * 12],
[60, 'a few seconds', null],
[60 * 2, 'a minute', null],
[60 * 60, '% minutes', 60],
[60 * 60 * 2, 'an hour', null],
[60 * 60 * 24, '% hours', 60 * 60],
[60 * 60 * 24 * 2, 'a day', null],
[60 * 60 * 24 * 30.42, '% days', 60 * 60 * 24],
[60 * 60 * 24 * 30.42 * 2, 'a month', null],
[60 * 60 * 24 * 30.42 * 12, '% months', 60 * 60 * 24 * 30.42],
[60 * 60 * 24 * 30.42 * 12 * 2, 'a year', null],
[8640000000000000 /* max*/, '% years', 60 * 60 * 24 * 30.42 * 12],
];
let text = null;
@ -192,7 +192,7 @@ function dataURItoBlob(dataURI) {
unescape(chunks[1]);
const mimeString = chunks[0].split(':')[1].split(';')[0];
const data = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
for (let i = 0; i < byteString.length; i++) {
data[i] = byteString.charCodeAt(i);
}
return new Blob([data], {type: mimeString});
@ -206,21 +206,21 @@ function getPrettyTagName(tag) {
}
module.exports = {
range: range,
formatRelativeTime: formatRelativeTime,
formatFileSize: formatFileSize,
formatMarkdown: formatMarkdown,
formatInlineMarkdown: formatInlineMarkdown,
unindent: unindent,
enableExitConfirmation: enableExitConfirmation,
range: range,
formatRelativeTime: formatRelativeTime,
formatFileSize: formatFileSize,
formatMarkdown: formatMarkdown,
formatInlineMarkdown: formatInlineMarkdown,
unindent: unindent,
enableExitConfirmation: enableExitConfirmation,
disableExitConfirmation: disableExitConfirmation,
confirmPageExit: confirmPageExit,
escapeHtml: escapeHtml,
makeCssName: makeCssName,
splitByWhitespace: splitByWhitespace,
arraysDiffer: arraysDiffer,
decamelize: decamelize,
escapeSearchTerm: escapeSearchTerm,
dataURItoBlob: dataURItoBlob,
getPrettyTagName: getPrettyTagName,
confirmPageExit: confirmPageExit,
escapeHtml: escapeHtml,
makeCssName: makeCssName,
splitByWhitespace: splitByWhitespace,
arraysDiffer: arraysDiffer,
decamelize: decamelize,
escapeSearchTerm: escapeSearchTerm,
dataURItoBlob: dataURItoBlob,
getPrettyTagName: getPrettyTagName,
};