From 5c3306b9c6b1f29d704d017c855b286e7376dde4 Mon Sep 17 00:00:00 2001 From: Alex Kern Date: Sun, 20 Sep 2020 17:08:03 -0700 Subject: [PATCH] Lint --- .eslintrc.js | 3 + package.json | 2 + src/actions/DownloadActions.js | 13 ++-- src/actions/SupportActions.js | 14 ++-- src/actions/UploadActions.js | 13 ++-- src/alt.js | 3 +- src/client.js | 23 +++--- src/components/App.js | 24 +++--- src/components/Bootstrap.js | 15 ++-- src/components/DownloadButton.js | 15 ++-- src/components/DownloadPage.js | 113 +++++++++++++++------------ src/components/DropZone.js | 47 +++++++----- src/components/ErrorPage.js | 36 ++++----- src/components/ProgressBar.js | 53 +++++++------ src/components/Spinner.js | 49 ++++++------ src/components/Tempalink.js | 36 +++++---- src/components/UploadPage.js | 126 +++++++++++++++++-------------- src/components/Uploader.js | 39 +++++----- src/db.js | 36 +++++---- src/ice.js | 35 +++++---- src/index.js | 13 ++-- src/middleware/bootstrap.js | 31 ++++---- src/middleware/error.js | 21 +++--- src/middleware/javascript.js | 17 ++--- src/middleware/react.js | 37 +++++---- src/middleware/static.js | 10 +-- src/routes.js | 14 ++-- src/server.js | 93 ++++++++++++----------- src/stores/DownloadStore.js | 123 ++++++++++++++++-------------- src/stores/ErrorStore.js | 35 ++++----- src/stores/SupportStore.js | 35 ++++----- src/stores/UploadStore.js | 22 +++--- src/toppings.js | 2 +- src/util.js | 8 +- src/wt.js | 6 +- tsconfig.json | 1 + webpack.config.js | 35 ++++----- yarn.lock | 22 ++++++ 38 files changed, 650 insertions(+), 570 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 92d3b44..08bfe7e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,9 @@ 'use strict'; module.exports = { + parserOptions: { + project: './tsconfig.json' + }, extends: [ '@strv/typescript', '@strv/typescript/optional', diff --git a/package.json b/package.json index 0b7e3b2..7136411 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,9 @@ "@types/node": "^14.11.1", "@types/react": "^16.9.49", "@typescript-eslint/eslint-plugin": "^4.1.1", + "@typescript-eslint/parser": "^4.1.1", "eslint": "^7.9.0", + "eslint-config-prettier": "^6.11.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-prettier": "^3.1.4", "prettier": "^2.1.2", diff --git a/src/actions/DownloadActions.js b/src/actions/DownloadActions.js index de2dcdf..724ee0e 100644 --- a/src/actions/DownloadActions.js +++ b/src/actions/DownloadActions.js @@ -1,9 +1,8 @@ -import alt from '../alt' +import alt from '../alt'; export default alt.createActions(class DownloadActions { - constructor() { - this.generateActions( - 'requestDownload' - ) - } -}) + constructor() { + this.generateActions('requestDownload'); + } + }, +) diff --git a/src/actions/SupportActions.js b/src/actions/SupportActions.js index f4cfaf5..9f7be30 100644 --- a/src/actions/SupportActions.js +++ b/src/actions/SupportActions.js @@ -1,10 +1,8 @@ -import alt from '../alt' +import alt from '../alt'; export default alt.createActions(class SupportActions { - constructor() { - this.generateActions( - 'isChrome', - 'noSupport' - ) - } -}) + constructor() { + this.generateActions('isChrome', 'noSupport'); + } + }, +) diff --git a/src/actions/UploadActions.js b/src/actions/UploadActions.js index ae03df5..3440170 100644 --- a/src/actions/UploadActions.js +++ b/src/actions/UploadActions.js @@ -1,9 +1,8 @@ -import alt from '../alt' +import alt from '../alt'; export default alt.createActions(class UploadActions { - constructor() { - this.generateActions( - 'uploadFile' - ) - } -}) + constructor() { + this.generateActions('uploadFile'); + } + }, +) diff --git a/src/alt.js b/src/alt.js index e54dc88..67ce981 100644 --- a/src/alt.js +++ b/src/alt.js @@ -1,2 +1,3 @@ -import Alt from 'alt' +import Alt from 'alt'; + export default new Alt() diff --git a/src/client.js b/src/client.js index 6bff7ff..9115de6 100644 --- a/src/client.js +++ b/src/client.js @@ -2,21 +2,24 @@ import "babel-polyfill"; import "./index.styl"; import React from "react"; import ReactRouter from "react-router"; -import routes from "./routes"; -import alt from "./alt"; -import webrtcSupport from "webrtcsupport"; +import webrtcSupport from 'webrtcsupport'; +import routes from './routes'; +import alt from './alt'; import SupportActions from "./actions/SupportActions"; -let bootstrap = document.getElementById("bootstrap").innerHTML; +const bootstrap = document.getElementById("bootstrap").innerHTML; alt.bootstrap(bootstrap); window.FilePizza = () => { - ReactRouter.run(routes, ReactRouter.HistoryLocation, function(Handler) { + ReactRouter.run(routes, ReactRouter.HistoryLocation, Handler => { React.render(, document); - }); + }) + if (!webrtcSupport.support) { + SupportActions.noSupport(); + } - if (!webrtcSupport.support) SupportActions.noSupport(); - - let isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1; - if (isChrome) SupportActions.isChrome(); + const isChrome = navigator.userAgent.toLowerCase().includes('chrome') +;if (isChrome) { + SupportActions.isChrome() + } }; diff --git a/src/components/App.js b/src/components/App.js index 4ca3f07..d3ffc5d 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -1,14 +1,14 @@ -import Bootstrap from "./Bootstrap"; -import ErrorPage from "./ErrorPage"; import FrozenHead from "react-frozenhead"; import React from "react"; -import SupportStore from "../stores/SupportStore"; -import { RouteHandler } from "react-router"; -import ga from "react-google-analytics"; +import { RouteHandler } from 'react-router'; +import ga from 'react-google-analytics'; +import SupportStore from '../stores/SupportStore'; +import ErrorPage from "./ErrorPage"; +import Bootstrap from './Bootstrap'; if (process.env.GA_ACCESS_TOKEN) { ga("create", process.env.GA_ACCESS_TOKEN, "auto"); - ga("send", "pageview"); + ;;ga('send', 'pageview') } export default class App extends React.Component { @@ -18,7 +18,7 @@ export default class App extends React.Component { this._onChange = () => { this.setState(SupportStore.getState()); - }; + } } componentDidMount() { @@ -62,7 +62,13 @@ export default class App extends React.Component {

- Like FilePizza? Support its development! donate + Like FilePizza? Support its development!{' '} + + donate +

@@ -85,7 +91,7 @@ export default class App extends React.Component {

- { process.env.GA_ACCESS_TOKEN ? :
} + {process.env.GA_ACCESS_TOKEN ? :
} ); diff --git a/src/components/Bootstrap.js b/src/components/Bootstrap.js index a164586..769f0e9 100644 --- a/src/components/Bootstrap.js +++ b/src/components/Bootstrap.js @@ -1,12 +1,13 @@ -import React from 'react' +import React from 'react'; export default class Bootstrap extends React.Component { - render() { - return