From c764fef8dd96fbee19b0e1444cbe3d880e1e3f43 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Wed, 9 Mar 2022 21:48:27 +0000 Subject: [PATCH] Fix lint --- .gitignore | 2 +- package.json | 3 ++- src/server_manager/cloud/gcp_api.ts | 16 ++++++++-------- src/server_manager/web_app/app.ts | 2 +- src/server_manager/web_app/cloud_accounts.ts | 2 ++ .../web_app/data_formatting.spec.ts | 1 - src/server_manager/web_app/survey.spec.ts | 1 - tsconfig.json | 1 + tslint.json | 1 - 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 629f93e1..491ca9d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -/build +/build/ node_modules/ /src/server_manager/install_scripts/do_install_script.ts /src/server_manager/install_scripts/gcp_install_script.ts diff --git a/package.json b/package.json index eb183586..80ba7330 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "clean": "rm -rf src/*/node_modules/ build/ node_modules/ src/server_manager/install_scripts/do_install_script.ts src/server_manager/install_scripts/gcp_install_script.ts third_party/shellcheck/download/", "lint": "npm run lint:sh && npm run lint:ts", "lint:sh": "bash ./scripts/shellcheck.sh", - "lint:ts": "npx tslint 'src/**/*.ts' -e '**/node_modules/**'" + "lint:ts": "npx tslint 'src/**/*.ts' -e '**/node_modules/**'", + "test": "npm run lint && npm run action metrics_server/test && npm run action sentry_webhook/build && npm run action server_manager/test && npm run action shadowbox/test" }, "workspaces": [ "src/*" diff --git a/src/server_manager/cloud/gcp_api.ts b/src/server_manager/cloud/gcp_api.ts index 60d49f37..ada9afc2 100644 --- a/src/server_manager/cloud/gcp_api.ts +++ b/src/server_manager/cloud/gcp_api.ts @@ -579,7 +579,6 @@ export class RestApiClient { * @see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims */ getUserInfo(): Promise { - const parameters = new Map([['access_token', this.accessToken]]); return this.fetchAuthenticated( 'POST', new URL('https://openidconnect.googleapis.com/v1/userinfo'), this.GCP_HEADERS); } @@ -607,13 +606,14 @@ export class RestApiClient { * * @param token - A refresh token or access token */ - private async revokeGcpToken(token: string): Promise { - const headers = new Map( - [['Host', 'oauth2.googleapis.com'], ['Content-Type', 'application/x-www-form-urlencoded']]); - const parameters = new Map([['token', token]]); - return this.fetchUnauthenticated( - 'GET', new URL('https://oauth2.googleapis.com/revoke'), headers, parameters); - } + // TODO(fortuna): use this to revoke the access token on account disconnection. + // private async revokeGcpToken(token: string): Promise { + // const headers = new Map( + // [['Host', 'oauth2.googleapis.com'], ['Content-Type', 'application/x-www-form-urlencoded']]); + // const parameters = new Map([['token', token]]); + // return this.fetchUnauthenticated( + // 'GET', new URL('https://oauth2.googleapis.com/revoke'), headers, parameters); + // } // tslint:disable-next-line:no-any private async fetchAuthenticated(method: string, url: URL, headers: Map, parameters?: Map, data?: any): Promise { diff --git a/src/server_manager/web_app/app.ts b/src/server_manager/web_app/app.ts index db4123ca..53286ac3 100644 --- a/src/server_manager/web_app/app.ts +++ b/src/server_manager/web_app/app.ts @@ -35,7 +35,7 @@ import type {DisplayAccessKey, ServerView} from './ui_components/outline-server- // The Outline DigitalOcean team's referral code: // https://www.digitalocean.com/help/referral-program/ -const UNUSED_DIGITALOCEAN_REFERRAL_CODE = '5ddb4219b716'; +//const UNUSED_DIGITALOCEAN_REFERRAL_CODE = '5ddb4219b716'; const CHANGE_KEYS_PORT_VERSION = '1.0.0'; const DATA_LIMITS_VERSION = '1.1.0'; diff --git a/src/server_manager/web_app/cloud_accounts.ts b/src/server_manager/web_app/cloud_accounts.ts index 9b0a946b..b88ecf44 100644 --- a/src/server_manager/web_app/cloud_accounts.ts +++ b/src/server_manager/web_app/cloud_accounts.ts @@ -60,12 +60,14 @@ export class CloudAccounts implements accounts.CloudAccounts { /** See {@link CloudAccounts#disconnectDigitalOceanAccount} */ disconnectDigitalOceanAccount(): void { + // TODO(fortuna): Revoke access token. this.digitalOceanAccount = null; this.save(); } /** See {@link CloudAccounts#disconnectGcpAccount} */ disconnectGcpAccount(): void { + // TODO(fortuna): Revoke access token. this.gcpAccount = null; this.save(); } diff --git a/src/server_manager/web_app/data_formatting.spec.ts b/src/server_manager/web_app/data_formatting.spec.ts index 63d1cdd4..fae6d978 100644 --- a/src/server_manager/web_app/data_formatting.spec.ts +++ b/src/server_manager/web_app/data_formatting.spec.ts @@ -14,7 +14,6 @@ limitations under the License. */ -import {format} from 'path'; import * as formatting from './data_formatting'; describe('formatBytesParts', () => { diff --git a/src/server_manager/web_app/survey.spec.ts b/src/server_manager/web_app/survey.spec.ts index 6ad9d562..bc96e15f 100644 --- a/src/server_manager/web_app/survey.spec.ts +++ b/src/server_manager/web_app/survey.spec.ts @@ -13,7 +13,6 @@ // limitations under the License. import {InMemoryStorage} from '../infrastructure/memory_storage'; -import {Surveys} from '../model/survey'; import {OutlineSurveys} from './survey'; diff --git a/tsconfig.json b/tsconfig.json index ed55b99a..a7ffe792 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,5 +9,6 @@ "experimentalDecorators":true, "allowJs": true, "resolveJsonModule": true, + "noUnusedLocals": true, } } diff --git a/tslint.json b/tslint.json index 32abeaea..c46f0724 100644 --- a/tslint.json +++ b/tslint.json @@ -25,7 +25,6 @@ "no-reference": true, "no-require-imports": true, "no-unused-expression": true, - "no-unused-variable": [true, {"ignore-pattern": "^UNUSED"}], "no-use-before-declare": false, "no-var-keyword": true, "object-literal-shorthand": true,