From d2740b219a1ecd31f773c134adcb438b562f897c Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Sat, 19 Mar 2022 17:01:37 +0000 Subject: [PATCH] fix lint. --- .eslintrc.json | 15 +- _test/performance-tracker/app.ts | 2 +- _test/script-monitor/scriptSandbox.test.ts | 4 +- _test/script-monitor/scriptSandbox.ts | 34 +- _test/status-bubble/index.html | 2 +- accounts/index.ts | 14 +- accounts/lighthouseWorker.ts | 4 +- accounts/src/config.tsx | 5 +- accounts/src/serviceWorker.ts | 4 +- accounts/src/sw-build.ts | 2 +- accounts/src/sw-template.ts | 2 +- admin-dashboard/index.ts | 28 +- .../src/components/basic/UploadFile.tsx | 2 - .../src/components/settings/smtp.tsx | 8 +- .../src/components/settings/sso/SsoModal.tsx | 4 +- .../src/components/settings/twilio.tsx | 4 +- admin-dashboard/src/pages/Settings.tsx | 6 +- api-docs/index.ts | 46 +- application-scanner/index.ts | 10 +- .../utils/applicationService.ts | 4 +- backend/backend/api/accountStore.ts | 6 +- backend/backend/api/alert.ts | 6 +- backend/backend/api/apiStatus.ts | 6 +- backend/backend/api/applicationLog.ts | 6 +- backend/backend/api/applicationScanner.ts | 6 +- backend/backend/api/applicationSecurity.ts | 6 +- backend/backend/api/applicationSecurityLog.ts | 6 +- backend/backend/api/auditLogs.ts | 6 +- backend/backend/api/automatedScript.ts | 6 +- backend/backend/api/base.ts | 2 +- backend/backend/api/callLogs.ts | 6 +- backend/backend/api/callRouting.ts | 6 +- backend/backend/api/certificateStore.ts | 6 +- backend/backend/api/component.ts | 6 +- backend/backend/api/containerScanner.ts | 6 +- backend/backend/api/containerSecurity.ts | 6 +- backend/backend/api/containerSecurityLog.ts | 6 +- backend/backend/api/customField.ts | 6 +- backend/backend/api/defaultManager.ts | 6 +- backend/backend/api/dockerCredential.ts | 6 +- .../backend/api/domainVerificationToken.ts | 6 +- backend/backend/api/emailLogs.ts | 6 +- backend/backend/api/emailSmtp.ts | 6 +- backend/backend/api/emailTemplate.ts | 6 +- backend/backend/api/errorTracker.ts | 6 +- backend/backend/api/feedback.ts | 6 +- backend/backend/api/file.ts | 6 +- backend/backend/api/gitCredential.ts | 6 +- backend/backend/api/globalConfig.ts | 6 +- backend/backend/api/groups.ts | 6 +- backend/backend/api/incident.ts | 6 +- .../backend/api/incidentCommunicationSla.ts | 6 +- backend/backend/api/incidentNoteTemplate.ts | 6 +- backend/backend/api/incidentPriorities.ts | 6 +- backend/backend/api/incidentSettings.ts | 6 +- backend/backend/api/incomingHttpRequest.ts | 6 +- backend/backend/api/incomingRequest.ts | 6 +- backend/backend/api/invoice.ts | 6 +- backend/backend/api/lead.ts | 6 +- backend/backend/api/lighthouse.ts | 6 +- backend/backend/api/loginHistory.ts | 6 +- backend/backend/api/monitor.ts | 6 +- backend/backend/api/monitorCriteria.ts | 6 +- backend/backend/api/monitorCustomField.ts | 6 +- backend/backend/api/monitorSla.ts | 6 +- backend/backend/api/notification.ts | 6 +- backend/backend/api/performanceTracker.ts | 6 +- .../backend/api/performanceTrackerMetric.ts | 6 +- backend/backend/api/probe.ts | 6 +- backend/backend/api/project.ts | 6 +- backend/backend/api/report.ts | 6 +- backend/backend/api/resourceCategory.ts | 6 +- backend/backend/api/schedule.ts | 6 +- backend/backend/api/scheduledEvent.ts | 10 +- backend/backend/api/scriptRunner.ts | 6 +- backend/backend/api/search.ts | 6 +- backend/backend/api/server.ts | 6 +- backend/backend/api/siteManager.ts | 6 +- backend/backend/api/slack.ts | 6 +- backend/backend/api/smsLogs.ts | 6 +- backend/backend/api/smsSmtp.ts | 6 +- backend/backend/api/smsTemplate.ts | 6 +- backend/backend/api/ssl.ts | 6 +- backend/backend/api/sso.ts | 6 +- backend/backend/api/ssoDefaultRoles.ts | 6 +- backend/backend/api/statusPage.ts | 10 +- backend/backend/api/statusPageCategory.ts | 6 +- backend/backend/api/stripe.ts | 6 +- backend/backend/api/subscriber.ts | 6 +- backend/backend/api/subscriberAlert.ts | 6 +- backend/backend/api/team.ts | 6 +- backend/backend/api/token.ts | 6 +- backend/backend/api/tutorial.ts | 6 +- backend/backend/api/twilio.ts | 6 +- backend/backend/api/user.ts | 6 +- backend/backend/api/version.ts | 6 +- backend/backend/api/webHook.ts | 6 +- backend/backend/api/zapier.ts | 6 +- backend/backend/middlewares/api.ts | 2 +- backend/backend/middlewares/applicationLog.ts | 2 +- .../applicationScannerAuthorization.ts | 2 +- backend/backend/middlewares/auditLogs.ts | 4 +- backend/backend/middlewares/authorization.ts | 3 +- .../middlewares/clusterAuthorization.ts | 1 + .../containerScannerAuthorization.ts | 2 +- backend/backend/middlewares/errorTracker.ts | 2 +- backend/backend/middlewares/ipHandler.ts | 8 +- .../middlewares/lighthouseAuthorization.ts | 2 +- .../backend/middlewares/performanceTracker.ts | 2 +- .../backend/middlewares/probeAuthorization.ts | 2 +- backend/backend/middlewares/project.ts | 20 +- .../middlewares/serviceAuthorization.ts | 2 +- backend/backend/middlewares/subProject.ts | 2 +- backend/backend/middlewares/user.ts | 6 +- backend/backend/services/componentService.ts | 2 +- backend/backend/services/paymentService.ts | 11 +- backend/backend/services/ssoService.ts | 4 +- backend/backend/services/stripeService.ts | 3 +- backend/index.ts | 13 +- backend/test/component.test.ts | 1 - backend/test/data/log.ts | 2 +- backend/test/enterprise.ts | 22 +- backend/test/incident.test.ts | 1 - backend/test/index.ts | 116 +++-- backend/test/monitor.test.ts | 1 - backend/test/schedule.test.ts | 1 - backend/test/statusPage.test.ts | 1 - backend/test/team.test.ts | 1 - common-server/utils/process.ts | 11 +- container-scanner/index.ts | 10 +- dashboard/index.ts | 52 +-- .../components/automationScript/NewScript.tsx | 238 +++++----- .../automationScript/UpdateScript.tsx | 254 +++++----- dashboard/src/components/basic/UploadFile.tsx | 2 - .../src/components/basic/WeekSelector.tsx | 2 +- .../src/components/domains/CreateDomain.tsx | 2 +- .../src/components/domains/EditDomain.tsx | 2 +- .../src/components/monitor/NewMonitor.tsx | 321 +++++++------ .../src/components/project/DeleteCaution.tsx | 2 +- .../src/components/settings/SsoModal.tsx | 4 +- .../status-page/AddMoreDomainModal.tsx | 2 +- .../src/components/status-page/Basic.tsx | 34 +- .../status-page/EditMoreDomainModal.tsx | 2 +- .../components/status-page/EmbeddedBubble.tsx | 2 +- .../src/components/status-page/Setting.tsx | 30 +- dashboard/src/config.tsx | 159 +++---- dashboard/src/serviceWorker.ts | 6 +- dashboard/src/sw-build.ts | 2 +- dashboard/src/sw-template.ts | 2 +- data-ingestor/api/probe.ts | 6 +- data-ingestor/index.ts | 17 +- .../middlewares/probeAuthorization.ts | 2 +- helm-chart/index.ts | 29 +- helm-chart/test/index.ts | 8 +- home/index.ts | 49 +- home/lighthouseWorker.ts | 4 +- home/public/js/amplitude.ts | 30 +- home/public/js/crm.ts | 20 +- home/public/js/default.ts | 439 +++++++++--------- home/public/js/switch.ts | 7 +- home/public/js/switchUrl.ts | 12 +- home/views/head.ejs | 4 +- http-test-server/backend/api/settings.ts | 6 +- http-test-server/index.ts | 27 +- init-script/index.ts | 8 +- init-script/scripts/3.0.9327.ts | 5 +- .../out/scripts/prettify/prettify.ts | 110 +++-- js-sdk/src/listener.ts | 4 +- js-sdk/src/tracker.ts | 10 +- licensing/index.ts | 6 +- licensing/src/api/license.ts | 6 +- licensing/test/index.ts | 8 +- lighthouse-runner/index.ts | 10 +- oneuptime-acme-http-01/test.ts | 6 +- oneuptime-gl-manager/manager.ts | 3 +- package-lock.json | 46 ++ package.json | 21 +- probe-api/api/probe.ts | 6 +- probe-api/middlewares/probeAuthorization.ts | 2 +- probe/index.ts | 7 +- probe/utils/errorService.ts | 5 +- realtime/api/realtime.ts | 6 +- realtime/index.ts | 6 +- realtime/middlewares/serviceAuthorization.ts | 2 +- script-runner/api/script.ts | 6 +- script-runner/index.ts | 7 +- script-runner/utils/scriptSandbox.ts | 6 +- status-page/index.ts | 31 +- status-page/src/actions/status.ts | 1 - status-page/src/components/MonitorInfo.tsx | 70 +-- .../saas-tests/dashboard/StatusPage3.test.ts | 2 +- types/tsfixme.d.ts | 6 +- zapier/triggers/resolved.ts | 2 +- 193 files changed, 1349 insertions(+), 1771 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d357e31ef1..9bed5da602 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,7 +19,8 @@ "react", "jsx-a11y", - "progress" + "progress", + "unused-imports" ], "extends": [ "eslint:recommended", @@ -53,7 +54,17 @@ "error", "unix" ], - "no-unused-vars": "error", + "no-unused-vars": "off", + "unused-imports/no-unused-imports": "error", + "unused-imports/no-unused-vars": [ + "error", + { + "vars": "all", + "varsIgnorePattern": "^_", + "args": "after-used", + "argsIgnorePattern": "^_" + } + ], "no-console": "error", "no-undef": "error", "no-empty": "error", diff --git a/_test/performance-tracker/app.ts b/_test/performance-tracker/app.ts index 646ea931c3..1ab1696d14 100644 --- a/_test/performance-tracker/app.ts +++ b/_test/performance-tracker/app.ts @@ -41,5 +41,5 @@ app.post('/post', async function (req: Request, res: Response) { }) app.listen(4050, function () { - console.log("Server running on PORT: " + 4050) + logger.info("Server running on PORT: " + 4050) }); \ No newline at end of file diff --git a/_test/script-monitor/scriptSandbox.test.ts b/_test/script-monitor/scriptSandbox.test.ts index add6bcaed7..903dccf4c1 100644 --- a/_test/script-monitor/scriptSandbox.test.ts +++ b/_test/script-monitor/scriptSandbox.test.ts @@ -15,7 +15,7 @@ describe('ScriptMonitor V2', function () { before(function () { import express from "express" - const app = express(); + const app = express.getExpressApp(); app.get("/test", (req: Request, res: Response) => res.send("yipee!")); server = app.listen(5050); }); @@ -54,7 +54,7 @@ describe('ScriptMonitor V2', function () { it("should return false for error thrown in script", async function () { const someFunction = async (done: $TSFixMe) => { console.log('Error log'); - console.error('Bad Error'); + logger.error('Bad Error'); throw new Error("Bad error"); } const result = await runScript(someFunction.toString(), true); diff --git a/_test/script-monitor/scriptSandbox.ts b/_test/script-monitor/scriptSandbox.ts index 7f1fb8117e..e56349fa24 100644 --- a/_test/script-monitor/scriptSandbox.ts +++ b/_test/script-monitor/scriptSandbox.ts @@ -1,5 +1,5 @@ import { join } from "path" -import {performance} from 'perf_hooks' +import { performance } from 'perf_hooks' import { isMainThread, @@ -22,11 +22,11 @@ class ScriptMonitorError extends Error { super(); this.message = message; this.errors = Array.isArray(errors) - ? errors.reduce( - (allErr, err) => [...allErr, err.message].join(','), - [] - ) - : (errors.message ?? errors); + ? errors.reduce( + (allErr, err) => [...allErr, err.message].join(','), + [] + ) + : (errors.message ?? errors); } } @@ -37,7 +37,7 @@ const { } = runConfig; const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { maxScriptRunTime, maxSyncStatementDuration }) => { - + if (isMainThread) { // modifiable option in development mode only @@ -65,7 +65,7 @@ const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { lastMessage = Date.now(); break; } - case 'log':{ + case 'log': { consoleLogs.push(payload); break; } @@ -100,8 +100,8 @@ const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { const message = statementTimeExceeded ? `Max. synchronous statement execution time exceeded (${maxSyncStatementDuration}ms)` : scriptTimeExceeded - ? `Max. script execution time exceeded (${maxScriptRunTime}ms)` - : 'Script was terminated'; + ? `Max. script execution time exceeded (${maxScriptRunTime}ms)` + : 'Script was terminated'; resolve({ success: false, message, @@ -176,7 +176,7 @@ const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { }); } else { // worker_threads code - + import { NodeVM } from 'vm2' const vm = new NodeVM({ eval: false, @@ -189,16 +189,16 @@ const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { console: 'redirect', }); - vm.on('console.log', (log: $TSFixMe) => { - parentPort.postMessage({type: 'log', payload: `[log]: ${log}`}); + vm.on('logger.info', (log: $TSFixMe) => { + parentPort.postMessage({ type: 'log', payload: `[log]: ${log}` }); }); - vm.on('console.error', (error: $TSFixMe) => { - parentPort.postMessage({type: 'log', payload: `[error]: ${error}`}); + vm.on('logger.error', (error: $TSFixMe) => { + parentPort.postMessage({ type: 'log', payload: `[error]: ${error}` }); }); vm.on('console.warn', (error: $TSFixMe) => { - parentPort.postMessage({type: 'log', payload: `[warn]: ${error}`}); + parentPort.postMessage({ type: 'log', payload: `[warn]: ${error}` }); }); const scriptCompletedCallback = (err: $TSFixMe) => { @@ -208,7 +208,7 @@ const runScript = async (functionCode: $TSFixMe, isCalled: $TSFixMe, options = { }; const code = workerData.functionCode; - setInterval(() => parentPort.postMessage({type: 'ping'}), 500); + setInterval(() => parentPort.postMessage({ type: 'ping' }), 500); const sandboxFunction = await vm.run( `export default ${code}`, join(process.cwd(), 'node_modules') diff --git a/_test/status-bubble/index.html b/_test/status-bubble/index.html index b6b7c3d08e..d8eab38d7b 100644 --- a/_test/status-bubble/index.html +++ b/_test/status-bubble/index.html @@ -76,7 +76,7 @@ placeholderTitleDiv.className = 'text'; placeholderTitleDiv.innerHTML = statusMessage; }) - .catch(err => console.error(err)); + .catch(err => logger.error(err)); } window.onload = function() { initializeBubble(); diff --git a/accounts/index.ts b/accounts/index.ts index d3d96a3186..065f1b5caf 100755 --- a/accounts/index.ts +++ b/accounts/index.ts @@ -1,13 +1,9 @@ import 'common-server/utils/env'; import 'common-server/utils/process'; - -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import logger from 'common-server/utils/logger'; +import express, { Request, Response } from 'common-server/utils/express'; import path from 'path'; -const app = express(); +const app = express.getExpressApp(); import compression from 'compression'; @@ -79,6 +75,6 @@ app.get('/*', function (req: Request, res: Response) { }); const PORT = process.env.PORT || 3003; -// eslint-disable-next-line no-console -console.log(`This project is running on port ${PORT}`); + +logger.info(`This project is running on port ${PORT}`); app.listen(PORT); diff --git a/accounts/lighthouseWorker.ts b/accounts/lighthouseWorker.ts index fb0c38a469..f00b0fedb3 100644 --- a/accounts/lighthouseWorker.ts +++ b/accounts/lighthouseWorker.ts @@ -1,4 +1,5 @@ import lighthouse from 'lighthouse'; +import logger from 'common-server/utils/logger'; import chromeLauncher from 'chrome-launcher'; import ora from 'ora'; @@ -104,8 +105,7 @@ process.on('message', function (data) { return scores; }) .catch(err => { - // eslint-disable-next-line no-console - console.log(err); + logger.info(err); process.exit(1); }); }); diff --git a/accounts/src/config.tsx b/accounts/src/config.tsx index bbfcd7da05..13cc2b2899 100755 --- a/accounts/src/config.tsx +++ b/accounts/src/config.tsx @@ -24,8 +24,8 @@ if ( const address = window.location.host.includes('localhost:') ? 'localhost' : window.location.host.includes('0.0.0.0:') - ? '0.0.0.0' - : '127.0.0.1'; + ? '0.0.0.0' + : '127.0.0.1'; apiUrl = window.location.protocol + `//${address}:3002/api`; dashboardUrl = window.location.protocol + `//${address}:3000/dashboard`; adminDashboardUrl = window.location.protocol + `//${address}:3100/admin`; @@ -178,7 +178,6 @@ export const Validate = { return false; }, - //eslint-disable-next-line isValidBusinessEmail(email: $TSFixMe) { //return emaildomains.test(email); return true; diff --git a/accounts/src/serviceWorker.ts b/accounts/src/serviceWorker.ts index 00374f5a6a..690aacc1cd 100644 --- a/accounts/src/serviceWorker.ts +++ b/accounts/src/serviceWorker.ts @@ -96,7 +96,7 @@ function registerValidSW(swUrl: $TSFixMe, config: $TSFixMe) { }; }) .catch(error => { - // eslint-disable-next-line no-console + //eslint-disable-next-line no-console console.error('Error during service worker registration: ', error); }); } @@ -124,7 +124,7 @@ function checkValidServiceWorker(swUrl: $TSFixMe, config: $TSFixMe) { } }) .catch(() => { - // eslint-disable-next-line no-console + //eslint-disable-next-line no-console console.log( 'No internet connection found. App is running in offline mode.' ); diff --git a/accounts/src/sw-build.ts b/accounts/src/sw-build.ts index c380e72cd7..306e26c702 100644 --- a/accounts/src/sw-build.ts +++ b/accounts/src/sw-build.ts @@ -15,7 +15,7 @@ const buildSW = () => { return `${count} files will be precached, totaling ${size} bytes.`; }) .catch(e => { - // eslint-disable-next-line no-console + //eslint-disable-next-line no-console console.error(e); }); }; diff --git a/accounts/src/sw-template.ts b/accounts/src/sw-template.ts index da21b9c0ac..c20edc0153 100644 --- a/accounts/src/sw-template.ts +++ b/accounts/src/sw-template.ts @@ -19,7 +19,7 @@ if ('function' === typeof importScripts) { precacheAndRoute(self.__WB_MANIFEST, { cleanUrls: false }); } else { - // eslint-disable-next-line no-console + //eslint-disable-next-line no-console console.log('Workbox could not be loaded. No Offline support'); } } diff --git a/admin-dashboard/index.ts b/admin-dashboard/index.ts index 2ab859e232..809dbb1c0a 100644 --- a/admin-dashboard/index.ts +++ b/admin-dashboard/index.ts @@ -1,29 +1,9 @@ -process.on('exit', () => { - // eslint-disable-next-line no-console - console.log('Shutting Shutdown'); -}); +import 'common-server/utils/env'; +import 'common-server/utils/process'; -process.on('unhandledRejection', err => { - // eslint-disable-next-line no-console - console.error('Unhandled rejection in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); - -process.on('uncaughtException', err => { - // eslint-disable-next-line no-console - console.error('Uncaught exception in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); - -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import path from 'path'; -const app = express(); +const app = express.getExpressApp(); app.get(['/env.js', '/admin/env.js'], function (req: Request, res: Response) { const env = { diff --git a/admin-dashboard/src/components/basic/UploadFile.tsx b/admin-dashboard/src/components/basic/UploadFile.tsx index 2258670406..a3bb1ace1e 100644 --- a/admin-dashboard/src/components/basic/UploadFile.tsx +++ b/admin-dashboard/src/components/basic/UploadFile.tsx @@ -3,10 +3,8 @@ import PropTypes from 'prop-types'; const UploadFile = ({ fileInputKey, - //eslint-disable-next-line input: { value: omitValue, ...inputProps }, - //eslint-disable-next-line meta: omitMeta, ...props diff --git a/admin-dashboard/src/components/settings/smtp.tsx b/admin-dashboard/src/components/settings/smtp.tsx index 4f2f03b03c..e6555648cd 100644 --- a/admin-dashboard/src/components/settings/smtp.tsx +++ b/admin-dashboard/src/components/settings/smtp.tsx @@ -99,7 +99,7 @@ const fields = [ { key: 'smtp-secure', label: 'SMTP Secure', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( @@ -123,7 +123,7 @@ const emailEnableField = [ { key: 'email-enabled', label: 'Enable Emails', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( @@ -145,7 +145,7 @@ const smtpOptions = [ { key: 'internalSmtp', label: 'Enable internal SMTP server', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( @@ -167,7 +167,7 @@ const smtpOptions = [ { key: 'customSmtp', label: 'Enable custom SMTP server', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( diff --git a/admin-dashboard/src/components/settings/sso/SsoModal.tsx b/admin-dashboard/src/components/settings/sso/SsoModal.tsx index 0c2b1b7918..cffb5d2edc 100644 --- a/admin-dashboard/src/components/settings/sso/SsoModal.tsx +++ b/admin-dashboard/src/components/settings/sso/SsoModal.tsx @@ -43,7 +43,7 @@ const fields = [ label: 'Enable SAML', description: 'SAML is an industry standard SSO framework typically used by large enterprises for communicating identities across the internet.', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( @@ -328,7 +328,7 @@ class Component extends React.Component { }} autoFocus={ field.key === - 'domain' + 'domain' ? true : false } diff --git a/admin-dashboard/src/components/settings/twilio.tsx b/admin-dashboard/src/components/settings/twilio.tsx index dc90599ccd..44fe644f9a 100644 --- a/admin-dashboard/src/components/settings/twilio.tsx +++ b/admin-dashboard/src/components/settings/twilio.tsx @@ -42,7 +42,7 @@ const fields = [ { key: 'call-enabled', label: 'Enable Call Alerts', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( @@ -62,7 +62,7 @@ const fields = [ { key: 'sms-enabled', label: 'Enable SMS Alerts', - // eslint-disable-next-line react/display-name, react/prop-types + component: ({ input: { value, onChange } }: $TSFixMe) => ( diff --git a/admin-dashboard/src/pages/Settings.tsx b/admin-dashboard/src/pages/Settings.tsx index ee4cc49dd0..eed6e9641b 100644 --- a/admin-dashboard/src/pages/Settings.tsx +++ b/admin-dashboard/src/pages/Settings.tsx @@ -1,7 +1,7 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; -import SMTP from '../components/settings/smtp'; +import Smtp from '../components/settings/smtp'; import Twilio from '../components/settings/twilio'; import Sso from '../components/settings/sso'; import SsoDefaultRoles from '../components/settings/ssoDefaultRoles'; @@ -10,11 +10,11 @@ import EmailLog from '../components/settings/emailLog'; import CallLog from '../components/settings/callLog'; import SmsLog from '../components/settings/smsLog'; -// eslint-disable-next-line react/display-name + const getChild = (key: $TSFixMe) => { switch (key) { case '/admin/settings/smtp': - return ; // eslint-disable-line react/jsx-pascal-case + return ; case '/admin/settings/twilio': return ; case '/admin/settings/sso': diff --git a/api-docs/index.ts b/api-docs/index.ts index b7a958ad55..7a56662712 100755 --- a/api-docs/index.ts +++ b/api-docs/index.ts @@ -1,28 +1,12 @@ -process.on('exit', () => { - // eslint-disable-next-line no-console - console.log('Shutting Shutdown'); -}); - -process.on('unhandledRejection', err => { - // eslint-disable-next-line no-console - console.error('Unhandled rejection in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); - -process.on('uncaughtException', err => { - // eslint-disable-next-line no-console - console.error('Uncaught exception in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); - +import 'common-server/utils/env'; +import 'common-server/utils/process'; +import logger from 'common-server/utils/logger'; import express, { Request, Response, NextFunction, } from 'common-server/utils/express'; -const app = express(); +const app = express.getExpressApp(); import path from 'path'; import version from './api/version'; @@ -31,25 +15,22 @@ import cors from 'cors'; app.use(cors()); process.on('exit', () => { - // eslint-disable-next-line no-console - console.log('Server Shutting Shutdown'); + logger.info('Server Shutting Shutdown'); }); process.on('unhandledRejection', err => { - // eslint-disable-next-line no-console - console.error('Unhandled rejection in server process occurred'); - // eslint-disable-next-line no-console - console.error(err); + logger.error('Unhandled rejection in server process occurred'); + + logger.error(err); }); process.on('uncaughtException', err => { - // eslint-disable-next-line no-console - console.error('Uncaught exception in server process occurred'); - // eslint-disable-next-line no-console - console.error(err); + logger.error('Uncaught exception in server process occurred'); + + logger.error(err); }); -app.use(function (req: Request, res: Response, next: $TSFixMe) { +app.use((req: Request, res: Response, next: NextFunction) => { if (typeof req.body === 'string') { req.body = JSON.parse(req.body); } @@ -90,8 +71,7 @@ app.get(['/', '/docs'], function (req: Request, res: Response) { }); app.listen(app.get('port'), function () { - // eslint-disable-next-line no-console - console.log('API Reference started on PORT:' + app.get('port')); + logger.info('API Reference started on PORT:' + app.get('port')); }); export default app; diff --git a/application-scanner/index.ts b/application-scanner/index.ts index e98658cc6a..84b5e081d9 100644 --- a/application-scanner/index.ts +++ b/application-scanner/index.ts @@ -1,12 +1,8 @@ import 'common-server/utils/env'; import 'common-server/utils/process'; -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; -const app = express(); +import express, { Request, Response } from 'common-server/utils/express'; +const app = express.getExpressApp(); import http from 'http'; http.createServer(app); @@ -57,7 +53,7 @@ cron.schedule('*/5 * * * *', () => { http.listen(app.get('port'), function () { // eslint-disable-next-line - console.log( + logger.info( `Application Scanner Started on port ${app.get( 'port' )}. OneUptime API URL: ${config.serverUrl}` diff --git a/application-scanner/utils/applicationService.ts b/application-scanner/utils/applicationService.ts index ceab5c2cd6..53ff2f312e 100644 --- a/application-scanner/utils/applicationService.ts +++ b/application-scanner/utils/applicationService.ts @@ -1,4 +1,5 @@ import crypto from 'crypto'; +import logger from 'common-server/utils/logger'; import EncryptionKeys from './encryptionKeys'; const algorithm = EncryptionKeys.algorithm; const key = EncryptionKeys.key; @@ -87,8 +88,7 @@ export default { )[1]; conn.on('ready', () => { - // eslint-disable-next-line no-console - console.log('SSH Client :: ready'); + logger.info('SSH Client :: ready'); return new Promise((resolve, reject) => { git(securityDir) .silent(true) diff --git a/backend/backend/api/accountStore.ts b/backend/backend/api/accountStore.ts index 63870ea227..a8ad9cf07b 100644 --- a/backend/backend/api/accountStore.ts +++ b/backend/backend/api/accountStore.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/alert.ts b/backend/backend/api/alert.ts index d2a67eb905..01e28a4b99 100755 --- a/backend/backend/api/alert.ts +++ b/backend/backend/api/alert.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import alertService from '../services/alertService'; import IncidentService from '../services/incidentService'; import alertChargeService from '../services/alertChargeService'; diff --git a/backend/backend/api/apiStatus.ts b/backend/backend/api/apiStatus.ts index 17ba275d39..3734e24862 100644 --- a/backend/backend/api/apiStatus.ts +++ b/backend/backend/api/apiStatus.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/applicationLog.ts b/backend/backend/api/applicationLog.ts index 22aa3b5105..146151c2c0 100644 --- a/backend/backend/api/applicationLog.ts +++ b/backend/backend/api/applicationLog.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ApplicationLogService from '../services/applicationLogService'; import UserService from '../services/userService'; import ComponentService from '../services/componentService'; diff --git a/backend/backend/api/applicationScanner.ts b/backend/backend/api/applicationScanner.ts index a23aa1ad53..c4711ad937 100644 --- a/backend/backend/api/applicationScanner.ts +++ b/backend/backend/api/applicationScanner.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ApplicationSecurityService from '../services/applicationSecurityService'; import ApplicationSecurityLogService from '../services//applicationSecurityLogService'; const router = express.getRouter(); diff --git a/backend/backend/api/applicationSecurity.ts b/backend/backend/api/applicationSecurity.ts index 14b3f6298a..5423790d9d 100644 --- a/backend/backend/api/applicationSecurity.ts +++ b/backend/backend/api/applicationSecurity.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/applicationSecurityLog.ts b/backend/backend/api/applicationSecurityLog.ts index e7685293fd..82558577bf 100644 --- a/backend/backend/api/applicationSecurityLog.ts +++ b/backend/backend/api/applicationSecurityLog.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/auditLogs.ts b/backend/backend/api/auditLogs.ts index bf1df3f6ed..3855562f5b 100755 --- a/backend/backend/api/auditLogs.ts +++ b/backend/backend/api/auditLogs.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import AuditLogsService from '../services/auditLogsService'; diff --git a/backend/backend/api/automatedScript.ts b/backend/backend/api/automatedScript.ts index 273a5c5308..25a31eb7cc 100644 --- a/backend/backend/api/automatedScript.ts +++ b/backend/backend/api/automatedScript.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import AutomatedScriptService from '../services/automatedScriptService'; diff --git a/backend/backend/api/base.ts b/backend/backend/api/base.ts index 4192fd02a7..221ebbc57a 100644 --- a/backend/backend/api/base.ts +++ b/backend/backend/api/base.ts @@ -1,4 +1,4 @@ -import { Request, Response } from 'common-server/utils/express'; +import { Request, Response, NextFunction } from 'common-server/utils/express'; import { sendErrorResponse, diff --git a/backend/backend/api/callLogs.ts b/backend/backend/api/callLogs.ts index 908e01c684..28e7f736b3 100644 --- a/backend/backend/api/callLogs.ts +++ b/backend/backend/api/callLogs.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import CallLogsService from '../services/callLogsService'; diff --git a/backend/backend/api/callRouting.ts b/backend/backend/api/callRouting.ts index 6d142a85f9..0b43eb549a 100644 --- a/backend/backend/api/callRouting.ts +++ b/backend/backend/api/callRouting.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { fetchPhoneNumbers } from '../services/twilioService'; import CallRoutingService from '../services/callRoutingService'; diff --git a/backend/backend/api/certificateStore.ts b/backend/backend/api/certificateStore.ts index 87cf159a50..66c280669f 100644 --- a/backend/backend/api/certificateStore.ts +++ b/backend/backend/api/certificateStore.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/component.ts b/backend/backend/api/component.ts index d3d28f3022..7830bdf59a 100755 --- a/backend/backend/api/component.ts +++ b/backend/backend/api/component.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import UserService from '../services/userService'; import ComponentService from '../services/componentService'; import NotificationService from '../services/notificationService'; diff --git a/backend/backend/api/containerScanner.ts b/backend/backend/api/containerScanner.ts index 801e415758..041310cce1 100644 --- a/backend/backend/api/containerScanner.ts +++ b/backend/backend/api/containerScanner.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import ContainerSecurityService from '../services/containerSecurityService'; import ContainerSecurityLogService from '../services//containerSecurityLogService'; diff --git a/backend/backend/api/containerSecurity.ts b/backend/backend/api/containerSecurity.ts index b444a62ed4..9e0b9d320b 100644 --- a/backend/backend/api/containerSecurity.ts +++ b/backend/backend/api/containerSecurity.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/containerSecurityLog.ts b/backend/backend/api/containerSecurityLog.ts index a5d5715b42..054e7525bd 100644 --- a/backend/backend/api/containerSecurityLog.ts +++ b/backend/backend/api/containerSecurityLog.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/customField.ts b/backend/backend/api/customField.ts index 451e772bc5..1f11c69da2 100644 --- a/backend/backend/api/customField.ts +++ b/backend/backend/api/customField.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/defaultManager.ts b/backend/backend/api/defaultManager.ts index 072108f992..31c08a9124 100644 --- a/backend/backend/api/defaultManager.ts +++ b/backend/backend/api/defaultManager.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/dockerCredential.ts b/backend/backend/api/dockerCredential.ts index 94ea403c78..7e2c232c3e 100644 --- a/backend/backend/api/dockerCredential.ts +++ b/backend/backend/api/dockerCredential.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/domainVerificationToken.ts b/backend/backend/api/domainVerificationToken.ts index b603b2ea1c..20aaf8959a 100644 --- a/backend/backend/api/domainVerificationToken.ts +++ b/backend/backend/api/domainVerificationToken.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import psl from 'psl'; diff --git a/backend/backend/api/emailLogs.ts b/backend/backend/api/emailLogs.ts index aadfc90e4e..87eed6f471 100644 --- a/backend/backend/api/emailLogs.ts +++ b/backend/backend/api/emailLogs.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import EmailLogsService from '../services/emailStatusService'; diff --git a/backend/backend/api/emailSmtp.ts b/backend/backend/api/emailSmtp.ts index 518f340036..bcdec8d7cb 100755 --- a/backend/backend/api/emailSmtp.ts +++ b/backend/backend/api/emailSmtp.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import EmailSmtpService from '../services/emailSmtpService'; import MailService from '../services/mailService'; const router = express.getRouter(); diff --git a/backend/backend/api/emailTemplate.ts b/backend/backend/api/emailTemplate.ts index 80b9c1541a..c27ff0c377 100755 --- a/backend/backend/api/emailTemplate.ts +++ b/backend/backend/api/emailTemplate.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import EmailTemplateService from '../services/emailTemplateService'; const router = express.getRouter(); diff --git a/backend/backend/api/errorTracker.ts b/backend/backend/api/errorTracker.ts index a387018cba..9476fedc2e 100644 --- a/backend/backend/api/errorTracker.ts +++ b/backend/backend/api/errorTracker.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/feedback.ts b/backend/backend/api/feedback.ts index 84842a6c8f..7ae7b8d09b 100755 --- a/backend/backend/api/feedback.ts +++ b/backend/backend/api/feedback.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import FeedbackService from '../services/feedbackService'; diff --git a/backend/backend/api/file.ts b/backend/backend/api/file.ts index 7c07432372..6e9f8d0070 100755 --- a/backend/backend/api/file.ts +++ b/backend/backend/api/file.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import FileService from '../services/fileService'; diff --git a/backend/backend/api/gitCredential.ts b/backend/backend/api/gitCredential.ts index a16d3a834c..58f8306af0 100644 --- a/backend/backend/api/gitCredential.ts +++ b/backend/backend/api/gitCredential.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/globalConfig.ts b/backend/backend/api/globalConfig.ts index a284c87d5e..55db48b724 100644 --- a/backend/backend/api/globalConfig.ts +++ b/backend/backend/api/globalConfig.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import GlobalConfigService from '../services/globalConfigService'; diff --git a/backend/backend/api/groups.ts b/backend/backend/api/groups.ts index 6ed8287120..e5b9f55f0d 100644 --- a/backend/backend/api/groups.ts +++ b/backend/backend/api/groups.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/incident.ts b/backend/backend/api/incident.ts index f02e1bf997..e974961912 100755 --- a/backend/backend/api/incident.ts +++ b/backend/backend/api/incident.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import moment from 'moment'; import Handlebars from 'handlebars'; import IncidentService from '../services/incidentService'; diff --git a/backend/backend/api/incidentCommunicationSla.ts b/backend/backend/api/incidentCommunicationSla.ts index fdbedfe532..e590eb781f 100644 --- a/backend/backend/api/incidentCommunicationSla.ts +++ b/backend/backend/api/incidentCommunicationSla.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/incidentNoteTemplate.ts b/backend/backend/api/incidentNoteTemplate.ts index f3eaea4bb6..95a9f212bb 100644 --- a/backend/backend/api/incidentNoteTemplate.ts +++ b/backend/backend/api/incidentNoteTemplate.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/incidentPriorities.ts b/backend/backend/api/incidentPriorities.ts index 4de70471e5..428c048842 100644 --- a/backend/backend/api/incidentPriorities.ts +++ b/backend/backend/api/incidentPriorities.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/incidentSettings.ts b/backend/backend/api/incidentSettings.ts index 2cf6719e18..5ff4276e3b 100644 --- a/backend/backend/api/incidentSettings.ts +++ b/backend/backend/api/incidentSettings.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/incomingHttpRequest.ts b/backend/backend/api/incomingHttpRequest.ts index 10f07bfe7c..d6e591e929 100644 --- a/backend/backend/api/incomingHttpRequest.ts +++ b/backend/backend/api/incomingHttpRequest.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import ProbeService from '../services/probeService'; import { diff --git a/backend/backend/api/incomingRequest.ts b/backend/backend/api/incomingRequest.ts index e2664c3a16..0c8f91e92d 100644 --- a/backend/backend/api/incomingRequest.ts +++ b/backend/backend/api/incomingRequest.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/invoice.ts b/backend/backend/api/invoice.ts index bdcbe2b82f..4e5655b65e 100755 --- a/backend/backend/api/invoice.ts +++ b/backend/backend/api/invoice.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import InvoiceService from '../services/invoiceService'; import { sendErrorResponse } from 'common-server/utils/response'; diff --git a/backend/backend/api/lead.ts b/backend/backend/api/lead.ts index 5458903416..101b711705 100755 --- a/backend/backend/api/lead.ts +++ b/backend/backend/api/lead.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import LeadService from '../services/leadService'; import { diff --git a/backend/backend/api/lighthouse.ts b/backend/backend/api/lighthouse.ts index 79d8186dbe..3aa2be4b8e 100644 --- a/backend/backend/api/lighthouse.ts +++ b/backend/backend/api/lighthouse.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ProbeService from '../services/probeService'; import MonitorService from '../services/monitorService'; import LighthouseLogService from '../services/lighthouseLogService'; diff --git a/backend/backend/api/loginHistory.ts b/backend/backend/api/loginHistory.ts index caf55be0e6..0502e33a6a 100644 --- a/backend/backend/api/loginHistory.ts +++ b/backend/backend/api/loginHistory.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import loginHistoryService from '../services/loginHistoryService'; const router = express.getRouter(); diff --git a/backend/backend/api/monitor.ts b/backend/backend/api/monitor.ts index cb7eacd3a0..b8042ac1ca 100755 --- a/backend/backend/api/monitor.ts +++ b/backend/backend/api/monitor.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import axios from 'axios'; import UserService from '../services/userService'; import MonitorService from '../services/monitorService'; diff --git a/backend/backend/api/monitorCriteria.ts b/backend/backend/api/monitorCriteria.ts index 61912586cb..f7d0a70fe0 100644 --- a/backend/backend/api/monitorCriteria.ts +++ b/backend/backend/api/monitorCriteria.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/monitorCustomField.ts b/backend/backend/api/monitorCustomField.ts index 82ce3392cc..2cf6afba57 100644 --- a/backend/backend/api/monitorCustomField.ts +++ b/backend/backend/api/monitorCustomField.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/monitorSla.ts b/backend/backend/api/monitorSla.ts index 20b0cc89dd..e12e1649dd 100644 --- a/backend/backend/api/monitorSla.ts +++ b/backend/backend/api/monitorSla.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const getUser = require('../middlewares/user').getUser; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/notification.ts b/backend/backend/api/notification.ts index a4755fffd4..56fca5ea4d 100755 --- a/backend/backend/api/notification.ts +++ b/backend/backend/api/notification.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import NotificationService from '../services/notificationService'; diff --git a/backend/backend/api/performanceTracker.ts b/backend/backend/api/performanceTracker.ts index b2b36ae906..a3f3c66cda 100644 --- a/backend/backend/api/performanceTracker.ts +++ b/backend/backend/api/performanceTracker.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import NotificationService from '../services/notificationService'; import ErrorService from 'common-server/utils/error'; diff --git a/backend/backend/api/performanceTrackerMetric.ts b/backend/backend/api/performanceTrackerMetric.ts index 1699f9b3ce..b1ded3a0ba 100644 --- a/backend/backend/api/performanceTrackerMetric.ts +++ b/backend/backend/api/performanceTrackerMetric.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import PerformanceTrackerMetricService from '../services/performanceTrackerMetricService'; import moment from 'moment'; diff --git a/backend/backend/api/probe.ts b/backend/backend/api/probe.ts index 6ee19ba9e3..0539bf0d5d 100755 --- a/backend/backend/api/probe.ts +++ b/backend/backend/api/probe.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ProbeService from '../services/probeService'; import MonitorService from '../services/monitorService'; import LighthouseLogService from '../services/lighthouseLogService'; diff --git a/backend/backend/api/project.ts b/backend/backend/api/project.ts index 4c91d4f9f1..f13de0d246 100755 --- a/backend/backend/api/project.ts +++ b/backend/backend/api/project.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ProjectService from '../services/projectService'; const router = express.getRouter(); diff --git a/backend/backend/api/report.ts b/backend/backend/api/report.ts index bbc99c3c55..7da4be48ab 100755 --- a/backend/backend/api/report.ts +++ b/backend/backend/api/report.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ReportService from '../services/reportService'; import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/resourceCategory.ts b/backend/backend/api/resourceCategory.ts index 6db187ecfa..baa796cd85 100755 --- a/backend/backend/api/resourceCategory.ts +++ b/backend/backend/api/resourceCategory.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); diff --git a/backend/backend/api/schedule.ts b/backend/backend/api/schedule.ts index 112ef0af9b..6294c75d84 100755 --- a/backend/backend/api/schedule.ts +++ b/backend/backend/api/schedule.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ScheduleService from '../services/scheduleService'; const router = express.getRouter(); const isUserAdmin = require('../middlewares/project').isUserAdmin; diff --git a/backend/backend/api/scheduledEvent.ts b/backend/backend/api/scheduledEvent.ts index f767bbecc0..533cf7b525 100755 --- a/backend/backend/api/scheduledEvent.ts +++ b/backend/backend/api/scheduledEvent.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import { isAuthorized } from '../middlewares/authorization'; @@ -785,8 +781,8 @@ router.get( async function (req, res) { try { const { eventId } = req.params; - // eslint-disable-next-line no-unused-vars - const { limit, skip, type } = req.query; + + const { limit, skip } = req.query; const populate = [ { path: 'createdById', select: 'name' }, diff --git a/backend/backend/api/scriptRunner.ts b/backend/backend/api/scriptRunner.ts index 20304675cd..92116868b5 100644 --- a/backend/backend/api/scriptRunner.ts +++ b/backend/backend/api/scriptRunner.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/search.ts b/backend/backend/api/search.ts index c731f77c75..ee3917d933 100644 --- a/backend/backend/api/search.ts +++ b/backend/backend/api/search.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import UserService from '../services/userService'; import ComponentService from '../services/componentService'; const getUser = require('../middlewares/user').getUser; diff --git a/backend/backend/api/server.ts b/backend/backend/api/server.ts index 273084d1c6..d6413ee86a 100755 --- a/backend/backend/api/server.ts +++ b/backend/backend/api/server.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import { IS_SAAS_SERVICE } from '../config/server'; diff --git a/backend/backend/api/siteManager.ts b/backend/backend/api/siteManager.ts index 2f26bafdb6..d4e53454a0 100644 --- a/backend/backend/api/siteManager.ts +++ b/backend/backend/api/siteManager.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/slack.ts b/backend/backend/api/slack.ts index b648cb08d9..46e61ec27e 100755 --- a/backend/backend/api/slack.ts +++ b/backend/backend/api/slack.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import request from 'request'; import IntegrationService from '../services/integrationService'; diff --git a/backend/backend/api/smsLogs.ts b/backend/backend/api/smsLogs.ts index 0554c086ad..ee2189eefa 100644 --- a/backend/backend/api/smsLogs.ts +++ b/backend/backend/api/smsLogs.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import SmsLogsService from '../services/smsCountService'; diff --git a/backend/backend/api/smsSmtp.ts b/backend/backend/api/smsSmtp.ts index 4cfd0f81c5..3554eaf0b8 100755 --- a/backend/backend/api/smsSmtp.ts +++ b/backend/backend/api/smsSmtp.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import SmsSmtpService from '../services/smsSmtpService'; import TwilioService from '../services/twilioService'; const router = express.getRouter(); diff --git a/backend/backend/api/smsTemplate.ts b/backend/backend/api/smsTemplate.ts index 0eed195171..8b7ff4c423 100755 --- a/backend/backend/api/smsTemplate.ts +++ b/backend/backend/api/smsTemplate.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import SmsTemplateService from '../services/smsTemplateService'; const router = express.getRouter(); diff --git a/backend/backend/api/ssl.ts b/backend/backend/api/ssl.ts index 16ff840370..431d5c997a 100644 --- a/backend/backend/api/ssl.ts +++ b/backend/backend/api/ssl.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import { sendErrorResponse, sendItemResponse, diff --git a/backend/backend/api/sso.ts b/backend/backend/api/sso.ts index 74a27be531..7a58587826 100644 --- a/backend/backend/api/sso.ts +++ b/backend/backend/api/sso.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; const isUserMasterAdmin = require('../middlewares/user').isUserMasterAdmin; diff --git a/backend/backend/api/ssoDefaultRoles.ts b/backend/backend/api/ssoDefaultRoles.ts index 1480823bd1..2265d5365a 100644 --- a/backend/backend/api/ssoDefaultRoles.ts +++ b/backend/backend/api/ssoDefaultRoles.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); const getUser = require('../middlewares/user').getUser; const isUserMasterAdmin = require('../middlewares/user').isUserMasterAdmin; diff --git a/backend/backend/api/statusPage.ts b/backend/backend/api/statusPage.ts index 0f9ac9a129..94851212fb 100755 --- a/backend/backend/api/statusPage.ts +++ b/backend/backend/api/statusPage.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import StatusPageService from '../services/statusPageService'; import MonitorService from '../services/monitorService'; import ProbeService from '../services/probeService'; @@ -1409,8 +1405,8 @@ router.get( checkUser, async function (req, res) { const { scheduledEventSlug } = req.params; - // eslint-disable-next-line no-unused-vars - const { skip, limit, type } = req.query; + + const { skip, limit } = req.query; const scheduledEventId = await ScheduledEventService.findOneBy({ query: { slug: scheduledEventSlug }, diff --git a/backend/backend/api/statusPageCategory.ts b/backend/backend/api/statusPageCategory.ts index 8458f0869b..1bcddd4386 100644 --- a/backend/backend/api/statusPageCategory.ts +++ b/backend/backend/api/statusPageCategory.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import { isAuthorized } from '../middlewares/authorization'; diff --git a/backend/backend/api/stripe.ts b/backend/backend/api/stripe.ts index a8d1628d85..ec0eeff062 100755 --- a/backend/backend/api/stripe.ts +++ b/backend/backend/api/stripe.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import StripeService from '../services/stripeService'; import { sendErrorResponse, diff --git a/backend/backend/api/subscriber.ts b/backend/backend/api/subscriber.ts index 48526969eb..864f03de71 100755 --- a/backend/backend/api/subscriber.ts +++ b/backend/backend/api/subscriber.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import SubscriberService from '../services/subscriberService'; diff --git a/backend/backend/api/subscriberAlert.ts b/backend/backend/api/subscriberAlert.ts index 73d4c08654..d0f7e22e1d 100755 --- a/backend/backend/api/subscriberAlert.ts +++ b/backend/backend/api/subscriberAlert.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import SubscriberAlertService from '../services/subscriberAlertService'; import path from 'path'; import fs from 'fs'; diff --git a/backend/backend/api/team.ts b/backend/backend/api/team.ts index ef4042856d..3ec5e310ab 100755 --- a/backend/backend/api/team.ts +++ b/backend/backend/api/team.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import TeamService from '../services/teamService'; diff --git a/backend/backend/api/token.ts b/backend/backend/api/token.ts index 9a1109edcd..605066f6ea 100755 --- a/backend/backend/api/token.ts +++ b/backend/backend/api/token.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import UserService from '../services/userService'; diff --git a/backend/backend/api/tutorial.ts b/backend/backend/api/tutorial.ts index 47d527441e..6c72d26c56 100644 --- a/backend/backend/api/tutorial.ts +++ b/backend/backend/api/tutorial.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import UserService from '../services/userService'; diff --git a/backend/backend/api/twilio.ts b/backend/backend/api/twilio.ts index 9ca8fcb4b1..f654c4815d 100755 --- a/backend/backend/api/twilio.ts +++ b/backend/backend/api/twilio.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import IncidentService from '../services/incidentService'; import UserService from '../services/userService'; const { diff --git a/backend/backend/api/user.ts b/backend/backend/api/user.ts index 8b4152c998..b035e0a636 100755 --- a/backend/backend/api/user.ts +++ b/backend/backend/api/user.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import UserService from '../services/userService'; import ProjectService from '../services/projectService'; const jwtSecretKey = process.env['JWT_SECRET']; diff --git a/backend/backend/api/version.ts b/backend/backend/api/version.ts index 2d61863ad3..fbd4f0d5d0 100644 --- a/backend/backend/api/version.ts +++ b/backend/backend/api/version.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; const router = express.getRouter(); import { diff --git a/backend/backend/api/webHook.ts b/backend/backend/api/webHook.ts index 290145058e..5dbcad0ffb 100755 --- a/backend/backend/api/webHook.ts +++ b/backend/backend/api/webHook.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import IntegrationService from '../services/integrationService'; const getUser = require('../middlewares/user').getUser; const isUserAdmin = require('../middlewares/project').isUserAdmin; diff --git a/backend/backend/api/zapier.ts b/backend/backend/api/zapier.ts index ae4c64af06..a1f8ef5f22 100755 --- a/backend/backend/api/zapier.ts +++ b/backend/backend/api/zapier.ts @@ -1,8 +1,4 @@ -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; +import express, { Request, Response } from 'common-server/utils/express'; import ZapierService from '../services/zapierService'; import MonitorService from '../services/monitorService'; import ProjectService from '../services/projectService'; diff --git a/backend/backend/middlewares/api.ts b/backend/backend/middlewares/api.ts index a3eccbc20d..f30690f53f 100755 --- a/backend/backend/middlewares/api.ts +++ b/backend/backend/middlewares/api.ts @@ -1,7 +1,7 @@ import mongoose from '../config/db'; import ProjectService from '../services/projectService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; const ObjectID = mongoose.Types.ObjectId; import MonitorService from '../services/monitorService'; diff --git a/backend/backend/middlewares/applicationLog.ts b/backend/backend/middlewares/applicationLog.ts index 9e821cd724..f3033e11cb 100644 --- a/backend/backend/middlewares/applicationLog.ts +++ b/backend/backend/middlewares/applicationLog.ts @@ -1,4 +1,4 @@ -import { Request, Response } from 'common-server/utils/express'; +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; import ApplicationLogService from '../services/applicationLogService'; diff --git a/backend/backend/middlewares/applicationScannerAuthorization.ts b/backend/backend/middlewares/applicationScannerAuthorization.ts index feef78b44a..03fada4012 100644 --- a/backend/backend/middlewares/applicationScannerAuthorization.ts +++ b/backend/backend/middlewares/applicationScannerAuthorization.ts @@ -1,6 +1,6 @@ import ApplicationScannerService from '../services/applicationScannerService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; const CLUSTER_KEY = process.env.CLUSTER_KEY; export default { diff --git a/backend/backend/middlewares/auditLogs.ts b/backend/backend/middlewares/auditLogs.ts index 97f7f64a85..9b1332c03d 100644 --- a/backend/backend/middlewares/auditLogs.ts +++ b/backend/backend/middlewares/auditLogs.ts @@ -1,5 +1,5 @@ import url from 'url'; -import { Request, Response } from 'common-server/utils/express'; +import { Request, Response, NextFunction } from 'common-server/utils/express'; import _ from 'lodash'; const isValidMongoObjectId = require('../config/db').Types.ObjectId.isValid; @@ -14,7 +14,7 @@ import GlobalConfigService from '../services/globalConfigService'; let shouldStoreLogs: $TSFixMe = null; export default { - log: async function (req: Request, res: Response, next: $TSFixMe) { + log: async function (req: Request, res: Response, next: NextFunction) { try { const blackListedRoutes = ['/audit-logs/']; const blackListedReqObjectPaths = ['body.password']; diff --git a/backend/backend/middlewares/authorization.ts b/backend/backend/middlewares/authorization.ts index 769e5817a3..f39331275a 100755 --- a/backend/backend/middlewares/authorization.ts +++ b/backend/backend/middlewares/authorization.ts @@ -1,4 +1,5 @@ import apiMiddleware from './api'; +import { Request, Response, NextFunction } from 'common-server/utils/express'; import { sendErrorResponse } from 'common-server/utils/response'; const doesUserBelongToProject = require('./project').doesUserBelongToProject; @@ -8,7 +9,7 @@ export default { // Params: // Param 1: req.headers -> {token} // Returns: 400: User is unauthorized since unauthorized token was present. - isAuthorized: function (req: Request, res: Response, next: $TSFixMe) { + isAuthorized: function (req: Request, res: Response, next: NextFunction) { const projectId = apiMiddleware.getProjectId(req); if (projectId) { diff --git a/backend/backend/middlewares/clusterAuthorization.ts b/backend/backend/middlewares/clusterAuthorization.ts index aae9010975..5865ae9709 100755 --- a/backend/backend/middlewares/clusterAuthorization.ts +++ b/backend/backend/middlewares/clusterAuthorization.ts @@ -1,4 +1,5 @@ import { sendErrorResponse } from 'common-server/utils/response'; +import { Request, Response, NextFunction } from 'common-server/utils/express'; export default { isAuthorizedAdmin: async function ( diff --git a/backend/backend/middlewares/containerScannerAuthorization.ts b/backend/backend/middlewares/containerScannerAuthorization.ts index 4b89e7ab7d..fc6c1ea904 100644 --- a/backend/backend/middlewares/containerScannerAuthorization.ts +++ b/backend/backend/middlewares/containerScannerAuthorization.ts @@ -1,6 +1,6 @@ import ContainerScannerService from '../services/containerScannerService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; const CLUSTER_KEY = process.env.CLUSTER_KEY; export default { diff --git a/backend/backend/middlewares/errorTracker.ts b/backend/backend/middlewares/errorTracker.ts index 491326d893..586de83a75 100644 --- a/backend/backend/middlewares/errorTracker.ts +++ b/backend/backend/middlewares/errorTracker.ts @@ -1,5 +1,5 @@ import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; import ErrorTrackerService from '../services/errorTrackerService'; diff --git a/backend/backend/middlewares/ipHandler.ts b/backend/backend/middlewares/ipHandler.ts index 6fef6b69c3..a2ea191709 100644 --- a/backend/backend/middlewares/ipHandler.ts +++ b/backend/backend/middlewares/ipHandler.ts @@ -1,11 +1,15 @@ import StatusPageService from '../services/statusPageService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import apiMiddleware from './api'; import ipaddr from 'ipaddr.js'; const _this = { - ipWhitelist: async function (req: Request, res: Response, next: $TSFixMe) { + ipWhitelist: async function ( + req: Request, + res: Response, + next: NextFunction + ) { const statusPageSlug = apiMiddleware.getStatusPageSlug(req); const statusPageUrl = apiMiddleware.getStatusPageUrl(req); let statusPage; diff --git a/backend/backend/middlewares/lighthouseAuthorization.ts b/backend/backend/middlewares/lighthouseAuthorization.ts index 425ff4f9c7..46499f52a8 100644 --- a/backend/backend/middlewares/lighthouseAuthorization.ts +++ b/backend/backend/middlewares/lighthouseAuthorization.ts @@ -1,5 +1,5 @@ import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; export default { isAuthorizedLighthouse: async function ( diff --git a/backend/backend/middlewares/performanceTracker.ts b/backend/backend/middlewares/performanceTracker.ts index e099bc0ca2..68a7e58fde 100644 --- a/backend/backend/middlewares/performanceTracker.ts +++ b/backend/backend/middlewares/performanceTracker.ts @@ -1,7 +1,7 @@ import ErrorService from 'common-server/utils/error'; import PerformanceTrackerService from '../services/performanceTrackerService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; const _this = { isValidAPIKey: async function ( req: Request, diff --git a/backend/backend/middlewares/probeAuthorization.ts b/backend/backend/middlewares/probeAuthorization.ts index e54ab5ba8e..aaace6051e 100755 --- a/backend/backend/middlewares/probeAuthorization.ts +++ b/backend/backend/middlewares/probeAuthorization.ts @@ -1,6 +1,6 @@ import ProbeService from '../services/probeService'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; const CLUSTER_KEY = process.env.CLUSTER_KEY; diff --git a/backend/backend/middlewares/project.ts b/backend/backend/middlewares/project.ts index 860556e109..6b2b579313 100755 --- a/backend/backend/middlewares/project.ts +++ b/backend/backend/middlewares/project.ts @@ -2,7 +2,7 @@ import ProjectService from '../services/projectService'; import ErrorService from 'common-server/utils/error'; import url from 'url'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import apiMiddleware from '../middlewares/api'; export default { @@ -104,7 +104,11 @@ export default { // Params: // Param 1: req.params-> {projectId}; req.user-> {id} // Returns: 400: You are not authorized to add member to project. Only admin can add.; 500: Server Error - isUserAdmin: async function (req: Request, res: Response, next: $TSFixMe) { + isUserAdmin: async function ( + req: Request, + res: Response, + next: NextFunction + ) { try { const projectId = apiMiddleware.getProjectId(req); @@ -172,7 +176,11 @@ export default { } }, - isUserOwner: async function (req: Request, res: Response, next: $TSFixMe) { + isUserOwner: async function ( + req: Request, + res: Response, + next: NextFunction + ) { try { // authorize if user is master-admin if (req.authorizationType === 'MASTER-ADMIN') { @@ -220,7 +228,11 @@ export default { } }, - getUserRole: async function (req: Request, res: Response, next: $TSFixMe) { + getUserRole: async function ( + req: Request, + res: Response, + next: NextFunction + ) { try { const UserId = req.user ? req.user.id : null; diff --git a/backend/backend/middlewares/serviceAuthorization.ts b/backend/backend/middlewares/serviceAuthorization.ts index c0913035bd..5dc424ff66 100644 --- a/backend/backend/middlewares/serviceAuthorization.ts +++ b/backend/backend/middlewares/serviceAuthorization.ts @@ -1,5 +1,5 @@ import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import ErrorService from 'common-server/utils/error'; const CLUSTER_KEY = process.env.CLUSTER_KEY; diff --git a/backend/backend/middlewares/subProject.ts b/backend/backend/middlewares/subProject.ts index 4c18ecb51c..eeeca4abda 100755 --- a/backend/backend/middlewares/subProject.ts +++ b/backend/backend/middlewares/subProject.ts @@ -1,7 +1,7 @@ import ProjectService from '../services/projectService'; import ErrorService from 'common-server/utils/error'; import { sendErrorResponse } from 'common-server/utils/response'; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import url from 'url'; export default { diff --git a/backend/backend/middlewares/user.ts b/backend/backend/middlewares/user.ts index ccd1f54728..254b6a9914 100755 --- a/backend/backend/middlewares/user.ts +++ b/backend/backend/middlewares/user.ts @@ -1,5 +1,5 @@ const jwtSecretKey = process.env['JWT_SECRET']; - +import { Request, Response, NextFunction } from 'common-server/utils/express'; import jwt from 'jsonwebtoken'; import url from 'url'; import UserService from '../services/userService'; @@ -17,7 +17,7 @@ const _this = { // Param 1: req.headers-> {token} // Returns: 400: User is unauthorized since unauthorized token was present. - getUser: async function (req: Request, res: Response, next: $TSFixMe) { + getUser: async function (req: Request, res: Response, next: NextFunction) { try { const projectId = apiMiddleware.getProjectId(req); @@ -119,7 +119,7 @@ const _this = { } }, - checkUser: function (req: Request, res: Response, next: $TSFixMe) { + checkUser: function (req: Request, res: Response, next: NextFunction) { try { const accessToken = req.headers['authorization'] || diff --git a/backend/backend/services/componentService.ts b/backend/backend/services/componentService.ts index f5c8d4e18b..a78d33ce89 100755 --- a/backend/backend/services/componentService.ts +++ b/backend/backend/services/componentService.ts @@ -311,7 +311,7 @@ export default { } const projectUsers = await TeamService.getTeamMembersBy({ parentProjectId: project._id, - }); // eslint-disable-next-line no-console + }); const seats = await TeamService.getSeats(projectUsers); // check if project seats are more based on users in project or by count of components if ( diff --git a/backend/backend/services/paymentService.ts b/backend/backend/services/paymentService.ts index 206d2a728f..7b59ed10bf 100755 --- a/backend/backend/services/paymentService.ts +++ b/backend/backend/services/paymentService.ts @@ -211,7 +211,7 @@ export default { //Param 2: user: User details //Returns: promise - createCustomer: async function (email, companyName) { + createCustomer: async function (email: string, companyName: string) { const customer = await stripe.customers.create({ email: email, description: companyName, @@ -219,8 +219,7 @@ export default { return customer.id; }, - // eslint-disable-next-line no-unused-vars - addPayment: async function (customerId, stripeToken) { + addPayment: async function (customerId: string) { const card = await stripe.customers.createSource(customerId); return card; }, @@ -231,7 +230,11 @@ export default { //Param 2: stripeCustomerId: Stripe customer id. //Returns : promise - subscribePlan: async function (stripePlanId, stripeCustomerId, coupon) { + subscribePlan: async function ( + stripePlanId: string, + stripeCustomerId: string, + coupon: string + ) { const items = []; items.push({ plan: stripePlanId, diff --git a/backend/backend/services/ssoService.ts b/backend/backend/services/ssoService.ts index 534f5552c9..e669a18441 100644 --- a/backend/backend/services/ssoService.ts +++ b/backend/backend/services/ssoService.ts @@ -197,8 +197,8 @@ export default { // or the same email x times in the response getEmail: function (xml: $TSFixMe) { const stringifiedXml = String(xml); - // eslint-disable-next-line no-control-regex - const regex = + + const regex = // eslint-disable-next-line no-control-regex /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi; return stringifiedXml.match(regex)[0]; diff --git a/backend/backend/services/stripeService.ts b/backend/backend/services/stripeService.ts index c59b78b53b..6f50e8b545 100755 --- a/backend/backend/services/stripeService.ts +++ b/backend/backend/services/stripeService.ts @@ -3,8 +3,7 @@ const Services = { customerId: $TSFixMe, subscriptionId: $TSFixMe ) { - // eslint-disable-next-line no-unused-vars - const [user, project] = await Promise.all([ + const [, project] = await Promise.all([ UserService.findOneBy({ query: { stripeCustomerId: customerId }, select: 'email name _id', diff --git a/backend/index.ts b/backend/index.ts index eac26dd33f..346064369f 100755 --- a/backend/index.ts +++ b/backend/index.ts @@ -10,7 +10,7 @@ import logger from 'common-server/utils/logger'; import expressRequestId from 'express-request-id'; -const app = express(); +const app = express.getExpressApp(); app.use(expressRequestId); @@ -59,8 +59,8 @@ import { getProjectId } from './backend/middlewares/api'; // }); // global.redisClient = redisClient; // } catch (err) { -// // eslint-disable-next-line no-console -// console.log('redis error: ', err); +// +// logger.info('redis error: ', err); // } global.io = io; @@ -102,7 +102,7 @@ app.use(async function (req: Request, res: Response, next: NextFunction) { next(); }); -app.use(function (req: Request, res: Response, next: NextFunction) { +app.use((req: Request, res: Response, next: NextFunction) => { if (typeof req.body === 'string') { req.body = JSON.parse(req.body); } @@ -494,8 +494,8 @@ mongoose.connection.on('connected', async () => { notify: function (event, details) { if ('error' === event) { // `details` is an error object in this case - // eslint-disable-next-line no-console - console.error('Greenlock Notify: ', details); + + logger.error('Greenlock Notify: ', details); } }, challenges: { @@ -515,7 +515,6 @@ mongoose.connection.on('connected', async () => { global.greenlock = greenlock; } } catch (error) { - // eslint-disable-next-line no-console ErrorService.log('GREENLOCK INIT ERROR: ', error); } }); diff --git a/backend/test/component.test.ts b/backend/test/component.test.ts index c69fc006c6..9500a2a73e 100644 --- a/backend/test/component.test.ts +++ b/backend/test/component.test.ts @@ -381,7 +381,6 @@ describe('Component API', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId: $TSFixMe, newUserToken: $TSFixMe, newUserId, diff --git a/backend/test/data/log.ts b/backend/test/data/log.ts index 4ba4e5eb59..35edc59726 100755 --- a/backend/test/data/log.ts +++ b/backend/test/data/log.ts @@ -1,4 +1,4 @@ export default function (obj: $TSFixMe) { // eslint-disable-next-line - console.log(obj); + logger.info(obj); } diff --git a/backend/test/enterprise.ts b/backend/test/enterprise.ts index 6d4db4b9a3..146977dfb3 100644 --- a/backend/test/enterprise.ts +++ b/backend/test/enterprise.ts @@ -1,14 +1,8 @@ -try { - require('./enterpriseUser.test'); - require('./enterpriseProject.test'); - require('./enterpriseComponent.test'); - require('./enterpriseMonitor.test'); - require('./enterpriseAlert.test'); - require('./enterpriseTeam.test'); - require('./enterpriseDisableSignup.test'); - require('./enterpriseIncidentAlerts.test'); -} catch (error) { - // eslint-disable-next-line no-console - console.error(error); - throw error; -} +import './enterpriseUser.test'; +import './enterpriseProject.test'; +import './enterpriseComponent.test'; +import './enterpriseMonitor.test'; +import './enterpriseAlert.test'; +import './enterpriseTeam.test'; +import './enterpriseDisableSignup.test'; +import './enterpriseIncidentAlerts.test'; diff --git a/backend/test/incident.test.ts b/backend/test/incident.test.ts index fe36f97aef..9b7be239d9 100644 --- a/backend/test/incident.test.ts +++ b/backend/test/incident.test.ts @@ -690,7 +690,6 @@ describe('Incident API', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId: $TSFixMe, newUserToken: $TSFixMe, subProjectIncidentId: $TSFixMe; diff --git a/backend/test/index.ts b/backend/test/index.ts index f4a9b90234..68ff68ffcb 100644 --- a/backend/test/index.ts +++ b/backend/test/index.ts @@ -1,61 +1,55 @@ -try { - require('./adminCredentials.test'); - require('./alert.test'); - require('./applicationLog.test'); - // require('./applicationSecurity.test'); 1 - require('./auditLogs.test'); - require('./component.test'); - // require('./containerSecurity.test'); 2 - require('./customField.test'); - require('./disableSignup.test'); - // require('./dockerCredential.test'); 3 - require('./emailAuthorization.test'); - require('./emailLogs.test'); - require('./emailSmtp.test'); - require('./emailTemplate.test'); - // require('./errorTracker.test'); 4 - require('./feedback.test'); - require('./gitCredential.test'); - require('./globalConfig.test'); - // require('./incident.test'); 5 - // require('./incidentAlerts.test'); 6 - require('./incidentCommunicationSla.test'); - // require('./incidentPriority.test'); hmm - require('./incidentSettings.test'); - require('./incomingHttpRequest.test'); - require('./invoice.test'); - require('./jwttoken.test'); - // require('./lead.test'); 7 - // require('./monitor.test'); 8 - require('./monitorCriteria.test'); - require('./monitorCustomField.test'); - require('./monitorSla.test'); - require('./notification.test'); - // require('./probe.test'); 9 - // require('./project.test'); --- - // require('./rateLimit.test'); 10 - require('./reports.test'); - // require('./resourceCategory.test'); 11 - require('./schedule.test'); - require('./scheduledEvent.test'); - require('./scheduledEventNote.test'); - require('./slack.test'); - require('./smsTemplate.test'); - // require('./sso.test'); - // require('./ssoDefaultRoles.test'); - // require('./statusPage.test'); - // require('./stripe.test'); - require('./subscriber.test'); - // require('./subscriberAlert.test'); - // require('./team.test'); - // require('./tutorial.test'); - // require('./twilio.test'); - // require('./user.test'); - // require('./version.test'); - // require('./webhook.test'); - // require('./zapier.test'); -} catch (error) { - // eslint-disable-next-line no-console - console.error(error); - throw error; -} +import './adminCredentials.test'; +import './alert.test'; +import './applicationLog.test'; +// import './applicationSecurity.test' 1 +import './auditLogs.test'; +import './component.test'; +// import './containerSecurity.test' 2 +import './customField.test'; +import './disableSignup.test'; +// import './dockerCredential.test' 3 +import './emailAuthorization.test'; +import './emailLogs.test'; +import './emailSmtp.test'; +import './emailTemplate.test'; +// import './errorTracker.test' 4 +import './feedback.test'; +import './gitCredential.test'; +import './globalConfig.test'; +// import './incident.test' 5 +// import './incidentAlerts.test' 6 +import './incidentCommunicationSla.test'; +// import './incidentPriority.test' hmm +import './incidentSettings.test'; +import './incomingHttpRequest.test'; +import './invoice.test'; +import './jwttoken.test'; +// import './lead.test' 7 +// import './monitor.test' 8 +import './monitorCriteria.test'; +import './monitorCustomField.test'; +import './monitorSla.test'; +import './notification.test'; +// import './probe.test' 9 +// import './project.test' --- +// import './rateLimit.test' 10 +import './reports.test'; +// import './resourceCategory.test' 11 +import './schedule.test'; +import './scheduledEvent.test'; +import './scheduledEventNote.test'; +import './slack.test'; +import './smsTemplate.test'; +// import './sso.test' +// import './ssoDefaultRoles.test' +// import './statusPage.test' +// import './stripe.test' +import './subscriber.test'; +// import './subscriberAlert.test' +// import './team.test' +// import './tutorial.test' +// import './twilio.test' +// import './user.test' +// import './version.test' +// import './webhook.test' +// import './zapier.test' diff --git a/backend/test/monitor.test.ts b/backend/test/monitor.test.ts index 5f69477261..c4cb0de742 100755 --- a/backend/test/monitor.test.ts +++ b/backend/test/monitor.test.ts @@ -975,7 +975,6 @@ describe('Monitor API with resource Category', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId: $TSFixMe, newUserToken: $TSFixMe, subProjectMonitorId: $TSFixMe; diff --git a/backend/test/schedule.test.ts b/backend/test/schedule.test.ts index d58f3a12a8..49443fc28f 100644 --- a/backend/test/schedule.test.ts +++ b/backend/test/schedule.test.ts @@ -166,7 +166,6 @@ describe('Schedule API', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId: $TSFixMe, newUserToken: $TSFixMe, subProjectScheduleId: $TSFixMe; diff --git a/backend/test/statusPage.test.ts b/backend/test/statusPage.test.ts index ef1131182d..b195e08d70 100644 --- a/backend/test/statusPage.test.ts +++ b/backend/test/statusPage.test.ts @@ -920,7 +920,6 @@ describe('Status API', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId: $TSFixMe, newUserToken: $TSFixMe, anotherUserToken: $TSFixMe, diff --git a/backend/test/team.test.ts b/backend/test/team.test.ts index 9245dda9e5..d382eda6c6 100644 --- a/backend/test/team.test.ts +++ b/backend/test/team.test.ts @@ -200,7 +200,6 @@ describe('Team API', function () { }); }); -// eslint-disable-next-line no-unused-vars let subProjectId, newUserToken, subProjectTeamMemberId, diff --git a/common-server/utils/process.ts b/common-server/utils/process.ts index ff8a5c2e19..09b7cb15e9 100644 --- a/common-server/utils/process.ts +++ b/common-server/utils/process.ts @@ -1,14 +1,15 @@ /* eslint-disable no-console */ +import logger from './logger'; process.on('exit', () => { - console.log('Server Shutting Shutdown'); + logger.info('Server Shutting Shutdown'); }); process.on('unhandledRejection', err => { - console.error('Unhandled rejection in server process occurred'); - console.error(err); + logger.error('Unhandled rejection in server process occurred'); + logger.error(err); }); process.on('uncaughtException', err => { - console.error('Uncaught exception in server process occurred'); - console.error(err); + logger.error('Uncaught exception in server process occurred'); + logger.error(err); }); diff --git a/container-scanner/index.ts b/container-scanner/index.ts index a1d2c5a4f1..fbd7ede451 100644 --- a/container-scanner/index.ts +++ b/container-scanner/index.ts @@ -1,12 +1,8 @@ import 'common-server/utils/env'; import 'common-server/utils/process'; -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; -const app = express(); +import express, { Request, Response } from 'common-server/utils/express'; +const app = express.getExpressApp(); import http from 'http'; http.createServer(app); @@ -55,7 +51,7 @@ cron.schedule('*/5 * * * *', () => { http.listen(app.get('port'), function () { // eslint-disable-next-line - console.log( + logger.info( `Container Scanner Started on port ${app.get( 'port' )}. OneUptime API URL: ${config.serverUrl}` diff --git a/dashboard/index.ts b/dashboard/index.ts index bf9802343f..e618406267 100755 --- a/dashboard/index.ts +++ b/dashboard/index.ts @@ -1,50 +1,11 @@ -process.on('exit', () => { - // eslint-disable-next-line no-console - console.log('Shutting Shutdown'); -}); +import 'common-server/utils/env'; +import 'common-server/utils/process'; -process.on('unhandledRejection', err => { - // eslint-disable-next-line no-console - console.error('Unhandled rejection in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); +import express, { Request, Response } from 'common-server/utils/express'; -process.on('uncaughtException', err => { - // eslint-disable-next-line no-console - console.error('Uncaught exception in process occurred'); - // eslint-disable-next-line no-console - console.error(err); -}); - -import express, { - Request, - Response, - NextFunction, -} from 'common-server/utils/express'; import path from 'path'; -const app = express(); -import cors from 'cors'; - -app.use(cors()); - -app.use(function (req: Request, res: Response, next: $TSFixMe) { - if (typeof req.body === 'string') { - req.body = JSON.parse(req.body); - } - res.header('Access-Control-Allow-Credentials', 'true'); - res.header('Access-Control-Allow-Origin', req.headers.origin); - res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); - res.header( - 'Access-Control-Allow-Headers', - 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept,Authorization' - ); - if (req.get('host').includes('cluster.local')) { - return next(); - } - return next(); -}); +const app = express.getExpressApp(); app.get( ['/env.js', '/dashboard/env.js'], @@ -175,8 +136,3 @@ app.use('/dashboard', express.static(path.join(__dirname, 'build'))); app.get('/*', function (req: Request, res: Response) { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); - -const PORT = 3000; -// eslint-disable-next-line no-console -console.log(`This project is running on port ${PORT}`); -app.listen(PORT); diff --git a/dashboard/src/components/automationScript/NewScript.tsx b/dashboard/src/components/automationScript/NewScript.tsx index ea63789295..9ce7e00045 100644 --- a/dashboard/src/components/automationScript/NewScript.tsx +++ b/dashboard/src/components/automationScript/NewScript.tsx @@ -20,7 +20,7 @@ import 'ace-builds/src-noconflict/theme-github'; import DropDownMenu from '../basic/DropDownMenu'; const defaultScript = - '// To inspect your script or add comments, use console.log\n\n' + + '// To inspect your script or add comments, use logger.info\n\n' + 'async function (done) {\n' + ' // write any javascript here \n' + ' done();\n' + @@ -119,16 +119,16 @@ class NewScript extends Component { const scheduleOption = schedules && schedules.length > 0 ? schedules.map((schedule: $TSFixMe) => ({ - value: schedule._id, - label: schedule.name - })) + value: schedule._id, + label: schedule.name + })) : []; const scriptOption = script && script.length > 0 ? script.map((s: $TSFixMe) => ({ - value: s._id, - label: s.name - })) + value: s._id, + label: s.name + })) : []; if (fields.length === 0) { fields.push(); @@ -137,13 +137,13 @@ class NewScript extends Component { {fields.map((field: $TSFixMe, index: $TSFixMe) => { const optionObj = successEventValues[index] && - successEventValues[index].type === 'callSchedule' + successEventValues[index].type === 'callSchedule' ? scheduleOption : successEventValues[index] && - successEventValues[index].type === - 'automatedScript' - ? scriptOption - : []; + successEventValues[index].type === + 'automatedScript' + ? scriptOption + : []; return (
@@ -267,16 +267,16 @@ class NewScript extends Component { const scheduleOption = schedules && schedules.length > 0 ? schedules.map((schedule: $TSFixMe) => ({ - value: schedule._id, - label: schedule.name - })) + value: schedule._id, + label: schedule.name + })) : []; const scriptOption = script && script.length > 0 ? script.map((s: $TSFixMe) => ({ - value: s._id, - label: s.name - })) + value: s._id, + label: s.name + })) : []; if (fields.length === 0) { fields.push(); @@ -285,13 +285,13 @@ class NewScript extends Component { {fields.map((field: $TSFixMe, index: $TSFixMe) => { const optionObj = failureEventValues[index] && - failureEventValues[index].type === 'callSchedule' + failureEventValues[index].type === 'callSchedule' ? scheduleOption : failureEventValues[index] && - failureEventValues[index].type === - 'automatedScript' - ? scriptOption - : []; + failureEventValues[index].type === + 'automatedScript' + ? scriptOption + : []; return (
@@ -502,104 +502,104 @@ class NewScript extends Component { Script
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message - {this.state.type === + // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{...Remove this comment to see the full error message + {this.state.type === 'JavaScript' && ( - - )} - // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message - {this.state.type === + + )} + // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message + {this.state.type === 'Bash' && ( - - )} + + )}
diff --git a/dashboard/src/components/automationScript/UpdateScript.tsx b/dashboard/src/components/automationScript/UpdateScript.tsx index 9e6d59f08d..3d3fff2391 100644 --- a/dashboard/src/components/automationScript/UpdateScript.tsx +++ b/dashboard/src/components/automationScript/UpdateScript.tsx @@ -21,7 +21,7 @@ import 'ace-builds/src-noconflict/theme-github'; import DropDownMenu from '../basic/DropDownMenu'; const defaultScript = - '// To inspect your script or add comments, use console.log\n\n' + + '// To inspect your script or add comments, use logger.info\n\n' + 'async function (done) {\n' + ' // write any javascript here \n' + ' done();\n' + @@ -125,18 +125,18 @@ class UpdateScript extends Component { const scheduleOption = schedules && schedules.length > 0 ? schedules.map((schedule: $TSFixMe) => ({ - value: schedule._id, - label: schedule.name - })) + value: schedule._id, + label: schedule.name + })) : []; const scriptOption = script && script.length > 0 ? script - .filter((s: $TSFixMe) => s._id !== currentScript) - .map((s: $TSFixMe) => ({ - value: s._id, - label: s.name - })) + .filter((s: $TSFixMe) => s._id !== currentScript) + .map((s: $TSFixMe) => ({ + value: s._id, + label: s.name + })) : []; if (fields.length === 0) { fields.push(); @@ -145,15 +145,15 @@ class UpdateScript extends Component { {fields.map((field: $TSFixMe, index: $TSFixMe) => { const optionObj = successEventValues && - successEventValues[index] && - successEventValues[index].type === 'callSchedule' + successEventValues[index] && + successEventValues[index].type === 'callSchedule' ? scheduleOption : successEventValues && - successEventValues[index] && - successEventValues[index].type === - 'automatedScript' - ? scriptOption - : []; + successEventValues[index] && + successEventValues[index].type === + 'automatedScript' + ? scriptOption + : []; return (
@@ -281,18 +281,18 @@ class UpdateScript extends Component { const scheduleOption = schedules && schedules.length > 0 ? schedules.map((schedule: $TSFixMe) => ({ - value: schedule._id, - label: schedule.name - })) + value: schedule._id, + label: schedule.name + })) : []; const scriptOption = script && script.length > 0 ? script - .filter((s: $TSFixMe) => s._id !== currentScript) - .map((s: $TSFixMe) => ({ - value: s._id, - label: s.name - })) + .filter((s: $TSFixMe) => s._id !== currentScript) + .map((s: $TSFixMe) => ({ + value: s._id, + label: s.name + })) : []; if (fields.length === 0) { fields.push(); @@ -301,15 +301,15 @@ class UpdateScript extends Component { {fields.map((field: $TSFixMe, index: $TSFixMe) => { const optionObj = failureEventValues && - failureEventValues[index] && - failureEventValues[index].type === 'callSchedule' + failureEventValues[index] && + failureEventValues[index].type === 'callSchedule' ? scheduleOption : failureEventValues && - failureEventValues[index] && - failureEventValues[index].type === - 'automatedScript' - ? scriptOption - : []; + failureEventValues[index] && + failureEventValues[index].type === + 'automatedScript' + ? scriptOption + : []; return (
@@ -523,104 +523,104 @@ class UpdateScript extends Component { Script
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message - {this.state.type === + // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{...Remove this comment to see the full error message + {this.state.type === 'JavaScript' && ( - - )} - // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message - {this.state.type === + + )} + // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message + {this.state.type === 'Bash' && ( - - )} + + )}
diff --git a/dashboard/src/components/basic/UploadFile.tsx b/dashboard/src/components/basic/UploadFile.tsx index 2258670406..a3bb1ace1e 100755 --- a/dashboard/src/components/basic/UploadFile.tsx +++ b/dashboard/src/components/basic/UploadFile.tsx @@ -3,10 +3,8 @@ import PropTypes from 'prop-types'; const UploadFile = ({ fileInputKey, - //eslint-disable-next-line input: { value: omitValue, ...inputProps }, - //eslint-disable-next-line meta: omitMeta, ...props diff --git a/dashboard/src/components/basic/WeekSelector.tsx b/dashboard/src/components/basic/WeekSelector.tsx index 9e8a4833c8..4c4f4dda27 100644 --- a/dashboard/src/components/basic/WeekSelector.tsx +++ b/dashboard/src/components/basic/WeekSelector.tsx @@ -44,7 +44,7 @@ let WeekSelector = ({ : invalidLabel; }; - // eslint-disable-next-line react/display-name + const renderWrappedWeekDay = (date: $TSFixMe, selectedDate: $TSFixMe, dayInCurrentMonth: $TSFixMe) => { const start = startOfWeek(selectedDate); const end = endOfWeek(selectedDate); diff --git a/dashboard/src/components/domains/CreateDomain.tsx b/dashboard/src/components/domains/CreateDomain.tsx index 1a4089cfbe..2863ccc29d 100644 --- a/dashboard/src/components/domains/CreateDomain.tsx +++ b/dashboard/src/components/domains/CreateDomain.tsx @@ -18,7 +18,7 @@ import { resetCreateProjectDomain, } from '../../actions/project'; -// eslint-disable-next-line no-unused-vars + function validate(_values: $TSFixMe) { const error = undefined; return error; diff --git a/dashboard/src/components/domains/EditDomain.tsx b/dashboard/src/components/domains/EditDomain.tsx index b0c84295e9..bcb620c66f 100644 --- a/dashboard/src/components/domains/EditDomain.tsx +++ b/dashboard/src/components/domains/EditDomain.tsx @@ -18,7 +18,7 @@ import { resetUpdateProjectDomain, } from '../../actions/project'; -// eslint-disable-next-line no-unused-vars + function validate(_values: $TSFixMe) { const error = undefined; return error; diff --git a/dashboard/src/components/monitor/NewMonitor.tsx b/dashboard/src/components/monitor/NewMonitor.tsx index 0f1ad7f738..d70913659d 100755 --- a/dashboard/src/components/monitor/NewMonitor.tsx +++ b/dashboard/src/components/monitor/NewMonitor.tsx @@ -13,7 +13,7 @@ import { change, isValid, FieldArray, -// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'redu... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'redu... Remove this comment to see the full error message } from 'redux-form'; import { createMonitor, @@ -71,7 +71,7 @@ import { fetchAutomatedScript } from '../../actions/automatedScript'; const defaultScript = '// modules available - request, puppeteer, axios (We can add more later).' + ' e.g - const request = require("request")\n\n' + - '// To inspect your script or add comments, use console.log\n\n' + + '// To inspect your script or add comments, use logger.info\n\n' + 'async function (done) {\n' + ' // write any javascript here \n' + ' done();\n' + @@ -418,7 +418,7 @@ class NewMonitor extends Component { return ( acc + (criterion.id !== criterionItem.id && - criterion.type === criterionItem.type + criterion.type === criterionItem.type ? 1 : 0) ); @@ -482,10 +482,10 @@ class NewMonitor extends Component { ? values[`type_${this.props.index}`] // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{... Remove this comment to see the full error message : this.props.edit - // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message - ? this.props.editMonitorProp.type - // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message - : this.props.type; + // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message + ? this.props.editMonitorProp.type + // @ts-expect-error ts-migrate(2339) FIXME: Property 'type' does not exist on type 'Readonly<{... Remove this comment to see the full error message + : this.props.type; // @ts-expect-error ts-migrate(2339) FIXME: Property 'resourceCategory' does not exist on type... Remove this comment to see the full error message postObj.resourceCategory = // @ts-expect-error ts-migrate(2339) FIXME: Property 'index' does not exist on type 'Readonly<... Remove this comment to see the full error message @@ -622,10 +622,10 @@ class NewMonitor extends Component { values[`criterion_${criterion.id}_schedules`]; const schedules = criterionSchedules ? criterionSchedules - .filter((scheduleObject: $TSFixMe) => { - return Object.values(scheduleObject)[0] === true; - }) - .map((scheduleObject: $TSFixMe) => Object.keys(scheduleObject)[0]) + .filter((scheduleObject: $TSFixMe) => { + return Object.values(scheduleObject)[0] === true; + }) + .map((scheduleObject: $TSFixMe) => Object.keys(scheduleObject)[0]) : []; // @ts-expect-error ts-migrate(2339) FIXME: Property 'scheduleIds' does not exist on type '{}'... Remove this comment to see the full error message @@ -1164,30 +1164,30 @@ class NewMonitor extends Component {
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{...Remove this comment to see the full error message New Monitor - // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{...Remove this comment to see the full error message Edit Monitor // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message {this.props.editMonitorProp && - // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message - this.props.editMonitorProp.name + // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message + this.props.editMonitorProp.name ? ' - ' + - // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message - this.props.editMonitorProp - .name + // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message + this.props.editMonitorProp + .name : null}

- // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{...Remove this comment to see the full error message Monitor any resources (Websites, @@ -1196,14 +1196,14 @@ class NewMonitor extends Component { they do not behave the way you want. - // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2339) FIXME: Property 'edit' does not exist on type 'Readonly<{...Remove this comment to see the full error message Edit Name and URL of // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message {this.props.editMonitorProp && - // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message - this.props.editMonitorProp.name + // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message + this.props.editMonitorProp.name // @ts-expect-error ts-migrate(2339) FIXME: Property 'editMonitorProp' does not exist on type ... Remove this comment to see the full error message ? ` ${this.props.editMonitorProp.name}` : ''} @@ -1325,15 +1325,14 @@ class NewMonitor extends Component {

@@ -1438,7 +1437,7 @@ class NewMonitor extends Component { - 0 + 0 } >
@@ -2343,21 +2340,21 @@ class NewMonitor extends Component { 'Select resource category', }, ...(resourceCategoryList && - resourceCategoryList.length > + resourceCategoryList.length > 0 ? resourceCategoryList.map( - (category: $TSFixMe) => ({ - value: - category._id, + (category: $TSFixMe) => ({ + value: + category._id, - label: - category.name - }) - ) + label: + category.name + }) + ) : []), ]} /> - // @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element; title: string; }' is no... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2322) FIXME: Type '{children: Element; title: string; }' is no... Remove this comment to see the full error message

@@ -2402,7 +2399,7 @@ class NewMonitor extends Component { Call duties. - // @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element; title: string; }' is no... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2322) FIXME: Type '{children: Element; title: string; }' is no... Remove this comment to see the full error message

@@ -2588,7 +2585,7 @@ class NewMonitor extends Component { /> )} - // @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element; title: string; }' is no... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2322) FIXME: Type '{children: Element; title: string; }' is no... Remove this comment to see the full error message

@@ -2706,7 +2703,7 @@ class NewMonitor extends Component { /> )} - // @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: Element; title: string; }' is no... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2322) FIXME: Type '{children: Element; title: string; }' is no... Remove this comment to see the full error message

@@ -2773,12 +2770,12 @@ class NewMonitor extends Component { (type === 'api' || type === 'url' || type === - 'server-monitor' || + 'server-monitor' || type === 'script' || type === - 'incomingHttpRequest' || + 'incomingHttpRequest' || type === - 'kubernetes' || + 'kubernetes' || type === 'ip') && // @ts-expect-error ts-migrate(2339) FIXME: Property 'advance' does not exist on type 'Readonl... Remove this comment to see the full error message !this.state.advance @@ -2827,12 +2824,12 @@ class NewMonitor extends Component { (type === 'api' || type === 'url' || type === - 'server-monitor' || + 'server-monitor' || type === 'script' || type === - 'incomingHttpRequest' || + 'incomingHttpRequest' || type === - 'kubernetes' || + 'kubernetes' || type === 'ip') } > @@ -2861,11 +2858,11 @@ class NewMonitor extends Component { (criterion: $TSFixMe) => { if ( criterionType.type === - criterion.type && + criterion.type && type === - 'ip' && + 'ip' && criterionType.type === - 'degraded' + 'degraded' ) return false; else { @@ -2934,43 +2931,102 @@ class NewMonitor extends Component { {criteria.length === 0 && ( -

-
-
- +
+
+ + + Monitor{' '} + {`${criterionType.type + .charAt( + 0 + ) + .toUpperCase() + + criterionType.type.slice( + 1 + )}`}{' '} + Criteria + +

+ + This + is + where + you + describe + when + your + monitor + is + considered + {` ${criterionType.type.toLowerCase()}`} + +

+
+ +
+
+

+ You + do + not + have + any Monitor{' '} {`${criterionType.type .charAt( @@ -2980,75 +3036,16 @@ class NewMonitor extends Component { criterionType.type.slice( 1 )}`}{' '} - Criteria - -

- - This - is - where - you - describe - when - your - monitor - is - considered - {` ${criterionType.type.toLowerCase()}`} - + Criteria, + feel + free + to + add + one

-
-
-

- You - do - not - have - any - Monitor{' '} - {`${criterionType.type - .charAt( - 0 - ) - .toUpperCase() + - criterionType.type.slice( - 1 - )}`}{' '} - Criteria, - feel - free - to - add - one -

-
-
- )} + )}
); })} @@ -3146,7 +3143,7 @@ class NewMonitor extends Component { planCategory ) || currentMonitorCount < - monitorCount + monitorCount } > { const currentPlanId = state.project && - state.project.currentProject && - state.project.currentProject.stripePlanId + state.project.currentProject && + state.project.currentProject.stripePlanId ? state.project.currentProject.stripePlanId : ''; diff --git a/dashboard/src/components/project/DeleteCaution.tsx b/dashboard/src/components/project/DeleteCaution.tsx index 56cfacbf54..b4882a7d5a 100755 --- a/dashboard/src/components/project/DeleteCaution.tsx +++ b/dashboard/src/components/project/DeleteCaution.tsx @@ -61,7 +61,7 @@ class DeleteCaution extends Component { // @ts-expect-error ts-migrate(2339) FIXME: Property 'hideOnDelete' does not exist on type 'Re... Remove this comment to see the full error message hideOnDelete, } = this.props; - // eslint-disable-next-line no-console + return (
( @@ -351,7 +351,7 @@ class Component extends React.Component { }} autoFocus={ field.key === - 'domain' + 'domain' ? true : false } diff --git a/dashboard/src/components/status-page/AddMoreDomainModal.tsx b/dashboard/src/components/status-page/AddMoreDomainModal.tsx index 0451a738d6..fbcb7e165c 100644 --- a/dashboard/src/components/status-page/AddMoreDomainModal.tsx +++ b/dashboard/src/components/status-page/AddMoreDomainModal.tsx @@ -20,7 +20,7 @@ import { import { createDomain } from '../../actions/domain'; import { Validate } from '../../config'; -// eslint-disable-next-line no-unused-vars + function validate(_values: $TSFixMe) { const error = undefined; return error; diff --git a/dashboard/src/components/status-page/Basic.tsx b/dashboard/src/components/status-page/Basic.tsx index a21b877b5b..131ab05e16 100755 --- a/dashboard/src/components/status-page/Basic.tsx +++ b/dashboard/src/components/status-page/Basic.tsx @@ -92,16 +92,16 @@ export class Branding extends Component { resetFaviconCache(); reset(); }, - function() {} + function () { } ); }; render() { // @ts-expect-error ts-migrate(2339) FIXME: Property 'handleSubmit' does not exist on type 'Re... Remove this comment to see the full error message const { handleSubmit } = this.props; - // eslint-disable-next-line no-unused-vars + let faviconImage = ; - // eslint-disable-next-line no-unused-vars + let logoImage = ; // @ts-expect-error ts-migrate(2339) FIXME: Property 'logourl' does not exist on type 'Readonl... Remove this comment to see the full error message const logoUrl = this.props.logourl @@ -109,22 +109,22 @@ export class Branding extends Component { ? this.props.logourl // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message : this.props.statusPage.status && - // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message - this.props.statusPage.status.logoPath - // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message - ? `${API_URL}/file/${this.props.statusPage.status.logoPath}` - : ''; + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message + this.props.statusPage.status.logoPath + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message + ? `${API_URL}/file/${this.props.statusPage.status.logoPath}` + : ''; // @ts-expect-error ts-migrate(2339) FIXME: Property 'faviconurl' does not exist on type 'Read... Remove this comment to see the full error message const faviconUrl = this.props.faviconurl // @ts-expect-error ts-migrate(2339) FIXME: Property 'faviconurl' does not exist on type 'Read... Remove this comment to see the full error message ? this.props.faviconurl // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message : this.props.statusPage.status && - // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message - this.props.statusPage.status.faviconPath - // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message - ? `${API_URL}/file/${this.props.statusPage.status.faviconPath}` - : ''; + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message + this.props.statusPage.status.faviconPath + // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message + ? `${API_URL}/file/${this.props.statusPage.status.faviconPath}` + : ''; if ( // @ts-expect-error ts-migrate(2339) FIXME: Property 'statusPage' does not exist on type 'Read... Remove this comment to see the full error message (this.props.statusPage && @@ -135,7 +135,7 @@ export class Branding extends Component { // @ts-expect-error ts-migrate(2339) FIXME: Property 'faviconurl' does not exist on type 'Read... Remove this comment to see the full error message this.props.faviconurl ) { - // eslint-disable-next-line no-unused-vars + faviconImage = ( ); @@ -150,7 +150,7 @@ export class Branding extends Component { // @ts-expect-error ts-migrate(2339) FIXME: Property 'faviconurl' does not exist on type 'Read... Remove this comment to see the full error message this.props.faviconurl ) { - // eslint-disable-next-line no-unused-vars + logoImage = ( ); @@ -311,8 +311,8 @@ function mapStateToProps(state: $TSFixMe) { initialValues: { name: state.statusPage && - state.statusPage.status && - state.statusPage.status.name + state.statusPage.status && + state.statusPage.status.name ? state.statusPage.status.name : '', }, diff --git a/dashboard/src/components/status-page/EditMoreDomainModal.tsx b/dashboard/src/components/status-page/EditMoreDomainModal.tsx index 5f106b77a3..a7966973d4 100644 --- a/dashboard/src/components/status-page/EditMoreDomainModal.tsx +++ b/dashboard/src/components/status-page/EditMoreDomainModal.tsx @@ -22,7 +22,7 @@ import { import { updateDomain } from '../../actions/domain'; import { Validate } from '../../config'; -// eslint-disable-next-line no-unused-vars + function validate(_values: $TSFixMe) { const error = undefined; return error; diff --git a/dashboard/src/components/status-page/EmbeddedBubble.tsx b/dashboard/src/components/status-page/EmbeddedBubble.tsx index f4142eb5c9..1cab059a16 100644 --- a/dashboard/src/components/status-page/EmbeddedBubble.tsx +++ b/dashboard/src/components/status-page/EmbeddedBubble.tsx @@ -100,7 +100,7 @@ const createScript = (url: $TSFixMe, css: $TSFixMe) => { placeholderTitleDiv.className = 'text'; placeholderTitleDiv.innerHTML = statusMessage; }) - .catch(err => console.error(err)); + .catch(err => logger.error(err)); };window.onload = function (){initializeBubble()}; `; }; diff --git a/dashboard/src/components/status-page/Setting.tsx b/dashboard/src/components/status-page/Setting.tsx index bad3b8a0fe..e93b7389b9 100755 --- a/dashboard/src/components/status-page/Setting.tsx +++ b/dashboard/src/components/status-page/Setting.tsx @@ -19,7 +19,7 @@ import AddMoreDomainModal from './AddMoreDomainModal'; import EditMoreDomainModal from './EditMoreDomainModal'; //Client side validation -// eslint-disable-next-line no-unused-vars + function validate(_values: $TSFixMe) { const error = undefined; return error; @@ -281,9 +281,9 @@ export class Setting extends Component { {IsAdminSubProject( subProject ) || - IsOwnerSubProject( - subProject - ) ? ( + IsOwnerSubProject( + subProject + ) ? (