Add ESLint and Prettier

This commit is contained in:
Rajarshee Chatterjee
2021-09-30 08:06:43 +05:30
parent e40af59230
commit 49160b7d98
218 changed files with 45076 additions and 42796 deletions
+34 -34
View File
@@ -1,46 +1,46 @@
import { useState, useEffect } from "react";
import {useState, useEffect} from 'react';
export const githubUpdateChecker = () => {
const latestReleaseUrl =
"https://api.github.com/repos/rajarsheechatterjee/lnreader/releases/latest";
const latestReleaseUrl =
'https://api.github.com/repos/rajarsheechatterjee/lnreader/releases/latest';
const [checking, setChecking] = useState(true);
const [latestRelease, setLatestRelease] = useState();
const [checking, setChecking] = useState(true);
const [latestRelease, setLatestRelease] = useState();
const checkForRelease = async () => {
let res = await fetch(latestReleaseUrl);
res = await res.json();
const checkForRelease = async () => {
let res = await fetch(latestReleaseUrl);
res = await res.json();
const release = {
tag_name: res.tag_name,
body: res.body,
downloadUrl: res.assets[0].browser_download_url,
};
setLatestRelease(release);
setChecking(false);
const release = {
tag_name: res.tag_name,
body: res.body,
downloadUrl: res.assets[0].browser_download_url,
};
const isNewVersion = (versionTag) => {
let currentVersion = "v1.1.5";
const regex = /[^\\d.]/;
setLatestRelease(release);
setChecking(false);
};
let newVersion = versionTag.replace(regex, "");
currentVersion = currentVersion.replace(regex, "");
const isNewVersion = versionTag => {
let currentVersion = 'v1.1.5';
const regex = /[^\\d.]/;
return newVersion !== currentVersion;
let newVersion = versionTag.replace(regex, '');
currentVersion = currentVersion.replace(regex, '');
return newVersion !== currentVersion;
};
useEffect(() => {
checkForRelease();
}, []);
if (!checking) {
const data = {
latestRelease,
isNewVersion: isNewVersion(latestRelease.tag_name),
};
useEffect(() => {
checkForRelease();
}, []);
if (!checking) {
const data = {
latestRelease,
isNewVersion: isNewVersion(latestRelease.tag_name),
};
return data;
}
return data;
}
};