Run format after updating to prettier 2.0

This commit is contained in:
Pavel Djundik 2020-03-21 22:55:36 +02:00
parent a46c9e8403
commit 881b3eda19
138 changed files with 584 additions and 631 deletions

View File

@ -29,9 +29,7 @@
<p>Unable to retrieve changelog for current release from GitHub.</p>
<p>
<a
:href="
`https://github.com/thelounge/thelounge/releases/tag/v${$store.state.serverConfiguration.version}`
"
:href="`https://github.com/thelounge/thelounge/releases/tag/v${$store.state.serverConfiguration.version}`"
target="_blank"
rel="noopener"
>View release notes for this version on GitHub</a

View File

@ -23,9 +23,7 @@
<template v-if="$store.state.serverConfiguration.gitCommit">
<p>
The Lounge is running from source (<a
:href="
`https://github.com/thelounge/thelounge/tree/${$store.state.serverConfiguration.gitCommit}`
"
:href="`https://github.com/thelounge/thelounge/tree/${$store.state.serverConfiguration.gitCommit}`"
target="_blank"
rel="noopener"
>commit <code>{{ $store.state.serverConfiguration.gitCommit }}</code></a
@ -36,9 +34,7 @@
<li>
Compare
<a
:href="
`https://github.com/thelounge/thelounge/compare/${$store.state.serverConfiguration.gitCommit}...master`
"
:href="`https://github.com/thelounge/thelounge/compare/${$store.state.serverConfiguration.gitCommit}...master`"
target="_blank"
rel="noopener"
>between
@ -50,9 +46,7 @@
<li>
Compare
<a
:href="
`https://github.com/thelounge/thelounge/compare/${$store.state.serverConfiguration.version}...${$store.state.serverConfiguration.gitCommit}`
"
:href="`https://github.com/thelounge/thelounge/compare/${$store.state.serverConfiguration.version}...${$store.state.serverConfiguration.gitCommit}`"
target="_blank"
rel="noopener"
>between

View File

@ -177,10 +177,7 @@ function enableAutocomplete(input) {
const text = input.value;
if (tabCount === 0) {
lastMatch = text
.substring(0, input.selectionStart)
.split(/\s/)
.pop();
lastMatch = text.substring(0, input.selectionStart).split(/\s/).pop();
if (lastMatch.length === 0) {
return;

View File

@ -18,9 +18,7 @@ LinkifyIt.prototype.normalize = function normalize(match) {
}
};
const linkify = LinkifyIt()
.tlds(require("tlds"))
.tlds("onion", true);
const linkify = LinkifyIt().tlds(require("tlds")).tlds("onion", true);
// Known schemes to detect in text
const commonSchemes = [

View File

@ -85,10 +85,7 @@ function parse(createElement, text, message = undefined, network = undefined) {
const emojiParts = findEmoji(cleanText);
const nameParts = findNames(cleanText, message ? message.users || [] : []);
const parts = channelParts
.concat(linkParts)
.concat(emojiParts)
.concat(nameParts);
const parts = channelParts.concat(linkParts).concat(emojiParts).concat(nameParts);
// Merge the styling information with the channels / URLs / nicks / text objects and
// generate HTML strings with the resulting fragments

View File

@ -66,10 +66,7 @@ const changelogPath = path.resolve(__dirname, "..", "CHANGELOG.md");
if (token === undefined) {
try {
token = fs
.readFileSync(path.resolve(__dirname, "./github_token.txt"))
.toString()
.trim();
token = fs.readFileSync(path.resolve(__dirname, "./github_token.txt")).toString().trim();
} catch (e) {
log.error(`Environment variable ${colors.bold("CHANGELOG_TOKEN")} must be set.`);
log.error(`Alternative create ${colors.bold("scripts/github_token.txt")} file.`);

View File

@ -63,8 +63,5 @@ log.info(
);
function getPrettyDate() {
return new Date()
.toISOString()
.split(".")[0]
.replace("T", " ");
return new Date().toISOString().split(".")[0].replace("T", " ");
}

View File

@ -290,10 +290,7 @@ Client.prototype.generateToken = function(callback) {
};
Client.prototype.calculateTokenHash = function (token) {
return crypto
.createHash("sha512")
.update(token)
.digest("hex");
return crypto.createHash("sha512").update(token).digest("hex");
};
Client.prototype.updateSession = function (token, ip, request) {

View File

@ -181,10 +181,7 @@ ClientManager.prototype.getDataToSave = function(client) {
networks: client.networks.map((n) => n.export()),
});
const newUser = JSON.stringify(json, null, "\t");
const newHash = crypto
.createHash("sha256")
.update(newUser)
.digest("hex");
const newHash = crypto.createHash("sha256").update(newUser).digest("hex");
return {newUser, newHash};
};

View File

@ -87,10 +87,7 @@ function getGitCommit() {
}
function getVersionCacheBust() {
const hash = crypto
.createHash("sha256")
.update(Helper.getVersion())
.digest("hex");
const hash = crypto.createHash("sha256").update(Helper.getVersion()).digest("hex");
return hash.substring(0, 10);
}

View File

@ -4,10 +4,7 @@ const colors = require("chalk");
const read = require("read");
function timestamp() {
const datetime = new Date()
.toISOString()
.split(".")[0]
.replace("T", " ");
const datetime = new Date().toISOString().split(".")[0].replace("T", " ");
return colors.dim(datetime);
}

View File

@ -78,9 +78,7 @@ function parseHtml(preview, res, client) {
preview.type = "link";
preview.head =
$('meta[property="og:title"]').attr("content") ||
$("head > title, title")
.first()
.text() ||
$("head > title, title").first().text() ||
"";
preview.body =
$('meta[property="og:description"]').attr("content") ||

View File

@ -43,10 +43,7 @@ class Storage {
}
store(data, extension, callback) {
const hash = crypto
.createHash("sha256")
.update(data)
.digest("hex");
const hash = crypto.createHash("sha256").update(data).digest("hex");
const a = hash.substring(0, 2);
const b = hash.substring(2, 4);
const folder = path.join(helper.getStoragePath(), a, b);

View File

@ -6,9 +6,7 @@ const constants = require("../../../client/js/constants");
describe("client-side constants", function () {
describe(".colorCodeMap", function () {
it("should be a non-empty array", function () {
expect(constants.colorCodeMap)
.to.be.an("array")
.of.length(16);
expect(constants.colorCodeMap).to.be.an("array").of.length(16);
});
it("should be made of pairs of strings", function () {
@ -28,9 +26,7 @@ describe("client-side constants", function() {
it("should only contain ASCII strings", function () {
constants.condensedTypes.forEach((type) => {
expect(type)
.to.be.a("string")
.that.does.match(/^\w+$/);
expect(type).to.be.a("string").that.does.match(/^\w+$/);
});
});
});

View File

@ -229,9 +229,7 @@ describe("Network", function() {
.to.be.an("object")
.that.has.all.keys("channels", "status", "nick", "name", "serverOptions", "uuid");
expect(clone.status)
.to.be.an("object")
.that.has.all.keys("connected", "secure");
expect(clone.status).to.be.an("object").that.has.all.keys("connected", "secure");
});
});

View File

@ -11,9 +11,7 @@ describe("inputs", function() {
it("should only return strings with no whitespaces and starting with /", function () {
inputs.getCommands().forEach((command) => {
expect(command)
.to.be.a("string")
.that.does.not.match(/\s/);
expect(command).to.be.a("string").that.does.not.match(/\s/);
expect(command[0]).to.equal("/");
});
});