From 7797f1f42c963ae1cd6c7539c1eccfa130b3465d Mon Sep 17 00:00:00 2001 From: Cassidy Date: Sat, 11 Apr 2020 14:40:00 +0700 Subject: [PATCH] fixes eslint errors --- app/components/client/devprogram-scripts.js | 1 - app/helpers/fetch-metadata.js | 4 +-- app/helpers/lbrytv-sdk.js | 27 ++++++++------------- app/sockets.js | 14 +++++------ 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/app/components/client/devprogram-scripts.js b/app/components/client/devprogram-scripts.js index 6750875..8c07c34 100644 --- a/app/components/client/devprogram-scripts.js +++ b/app/components/client/devprogram-scripts.js @@ -85,7 +85,6 @@ function syncWithApi(data) { // eslint-disable-line no-unused-vars console.info(data); // eslint-disable-line no-console document.querySelector("developer-program").innerHTML = "

No success or error was received so the LBRY API might be down.
Please try again later.

"; - return; } }) .catch(error => { diff --git a/app/helpers/fetch-metadata.js b/app/helpers/fetch-metadata.js index f4d45e1..d0ed112 100644 --- a/app/helpers/fetch-metadata.js +++ b/app/helpers/fetch-metadata.js @@ -105,7 +105,7 @@ export default async(data, socket) => { // P U B L I S H // E X A M P L E - case "publish": + case "publish": apiRequestMethod = "PUT"; // Required for publishing @@ -200,7 +200,7 @@ export default async(data, socket) => { apiRequestMethod = "GET"; body.uri = claimAddress; try { - let resolveResponse = await lbrytvAPI.resolve([claimAddress]); + const resolveResponse = await lbrytvAPI.resolve([claimAddress]); if (socket) { const renderedCode = prism.highlight( diff --git a/app/helpers/lbrytv-sdk.js b/app/helpers/lbrytv-sdk.js index 8ec66c0..59cd64f 100644 --- a/app/helpers/lbrytv-sdk.js +++ b/app/helpers/lbrytv-sdk.js @@ -1,20 +1,16 @@ "use strict"; +import messageSlack from "./slack"; const request = require("request"); -import messageSlack from "./slack"; -let addSupport = function() { - return; -}; +const addSupport = function() {}; -let publish = function() { - return; -}; +const publish = function() {}; -let resolve = function(urls) { +const resolve = function(urls) { return new Promise(function(resolve, reject) { - let options = { + const options = { method: "POST", url: "https://api.lbry.tv/api/v1/proxy", headers: @@ -34,7 +30,7 @@ let resolve = function(urls) { message: "```" + error + "```", title: "DAEMON ERROR: resolve" }); - return reject("DAEMON ERROR: resolve"); + return reject(new Error("DAEMON ERROR: resolve")); } if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) { @@ -42,17 +38,16 @@ let resolve = function(urls) { message: "```" + daemonResponse.error + "```", title: "DAEMON ERROR: resolve" }); - return reject("DAEMON ERROR: resolve"); + return reject(new Error("DAEMON ERROR: resolve")); } else return resolve(daemonResponse.result); - }); }); }; -let getTrending = function() { +const getTrending = function() { return new Promise(function(resolve, reject) { - let options = { + const options = { method: "POST", url: "https://api.lbry.tv/api/v1/proxy", headers: @@ -95,7 +90,7 @@ let getTrending = function() { message: "```" + error + "```", title: "DAEMON ERROR: trending" }); - return reject("DAEMON ERROR: trending"); + return reject(new Error("DAEMON ERROR: trending")); } if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) { @@ -106,8 +101,6 @@ let getTrending = function() { return reject(JSON.stringify(daemonResponse)); } else return resolve(daemonResponse.result.items); - - }); }); }; diff --git a/app/sockets.js b/app/sockets.js index 847e70c..625471c 100644 --- a/app/sockets.js +++ b/app/sockets.js @@ -123,16 +123,16 @@ function generateContent(exampleNumber, displayTrendingContent) { const renderedContentCollection = []; const urlsToResolve = []; - response.forEach(r =>{ + response.forEach(r => { urlsToResolve.push(r.canonical_url); }); lbrytvAPI.resolve(urlsToResolve) .then(resolveResponse => { if (resolveResponse !== null) { - let responses = Object.values(resolveResponse); + const responses = Object.values(resolveResponse); - for (let r in responses) { - let part = responses[r]; + for (const r in responses) { + const part = responses[r]; if (part.value && part.value.thumbnail.url) { renderedContentCollection.push(` @@ -188,10 +188,10 @@ function generateContent(exampleNumber, displayTrendingContent) { lbrytvAPI.resolve(approvedUrls) .then(resolveResponse => { if (resolveResponse !== null) { - let responses = Object.values(resolveResponse); + const responses = Object.values(resolveResponse); - for (let r in responses) { - let part = responses[r]; + for (const r in responses) { + const part = responses[r]; if (part.value && part.value.thumbnail.url) { renderedContentCollection.push(`