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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -290,10 +290,7 @@ Client.prototype.generateToken = function(callback) {
}; };
Client.prototype.calculateTokenHash = function (token) { Client.prototype.calculateTokenHash = function (token) {
return crypto return crypto.createHash("sha512").update(token).digest("hex");
.createHash("sha512")
.update(token)
.digest("hex");
}; };
Client.prototype.updateSession = function (token, ip, request) { 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()), networks: client.networks.map((n) => n.export()),
}); });
const newUser = JSON.stringify(json, null, "\t"); const newUser = JSON.stringify(json, null, "\t");
const newHash = crypto const newHash = crypto.createHash("sha256").update(newUser).digest("hex");
.createHash("sha256")
.update(newUser)
.digest("hex");
return {newUser, newHash}; return {newUser, newHash};
}; };

View file

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

View file

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

View file

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

View file

@ -43,10 +43,7 @@ class Storage {
} }
store(data, extension, callback) { store(data, extension, callback) {
const hash = crypto const hash = crypto.createHash("sha256").update(data).digest("hex");
.createHash("sha256")
.update(data)
.digest("hex");
const a = hash.substring(0, 2); const a = hash.substring(0, 2);
const b = hash.substring(2, 4); const b = hash.substring(2, 4);
const folder = path.join(helper.getStoragePath(), a, b); 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("client-side constants", function () {
describe(".colorCodeMap", function () { describe(".colorCodeMap", function () {
it("should be a non-empty array", function () { it("should be a non-empty array", function () {
expect(constants.colorCodeMap) expect(constants.colorCodeMap).to.be.an("array").of.length(16);
.to.be.an("array")
.of.length(16);
}); });
it("should be made of pairs of strings", function () { 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 () { it("should only contain ASCII strings", function () {
constants.condensedTypes.forEach((type) => { constants.condensedTypes.forEach((type) => {
expect(type) expect(type).to.be.a("string").that.does.match(/^\w+$/);
.to.be.a("string")
.that.does.match(/^\w+$/);
}); });
}); });
}); });

View file

@ -229,9 +229,7 @@ describe("Network", function() {
.to.be.an("object") .to.be.an("object")
.that.has.all.keys("channels", "status", "nick", "name", "serverOptions", "uuid"); .that.has.all.keys("channels", "status", "nick", "name", "serverOptions", "uuid");
expect(clone.status) expect(clone.status).to.be.an("object").that.has.all.keys("connected", "secure");
.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 () { it("should only return strings with no whitespaces and starting with /", function () {
inputs.getCommands().forEach((command) => { inputs.getCommands().forEach((command) => {
expect(command) expect(command).to.be.a("string").that.does.not.match(/\s/);
.to.be.a("string")
.that.does.not.match(/\s/);
expect(command[0]).to.equal("/"); expect(command[0]).to.equal("/");
}); });
}); });