Skip to content

Commit

Permalink
style: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
PopGoesTheWza committed Dec 14, 2020
1 parent 5873184 commit b7cb6bc
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/apiutils.ts
@@ -1,6 +1,5 @@
import fuzzy from 'fuzzy';
import {script_v1 as scriptV1} from 'googleapis';
import {ReadonlyDeep} from 'type-fest';

import {loadAPICredentials, serviceUsage} from './auth';
import {ClaspError} from './clasp-error';
Expand All @@ -9,6 +8,8 @@ import {enableOrDisableAdvanceServiceInManifest} from './manifest';
import {ERROR} from './messages';
import {getProjectId, spinner, stopSpinner} from './utils';

import type {ReadonlyDeep} from 'type-fest';

type TypeFunction = Readonly<scriptV1.Schema$GoogleAppsScriptTypeFunction>;

/**
Expand Down
13 changes: 8 additions & 5 deletions src/auth.ts
@@ -1,18 +1,21 @@
import {Credentials, GenerateAuthUrlOpts, OAuth2Client, OAuth2ClientOptions} from 'google-auth-library';
import {google, script_v1 as scriptV1} from 'googleapis';
import {createServer, IncomingMessage, Server, ServerResponse} from 'http';
import {AddressInfo} from 'net';
import {createServer} from 'http';
import open from 'open';
import readline from 'readline';
import {ReadonlyDeep} from 'type-fest';
import {URL} from 'url';

import {ClaspError} from './clasp-error';
import {ClaspToken, DOTFILE, Dotfile} from './dotfile';
import {ERROR, LOG} from './messages';
import {checkIfOnlineOrDie, getOAuthSettings} from './utils';
// import {oauthScopesPrompt} from './inquirer';
// import {readManifest} from './manifest';
import {ERROR, LOG} from './messages';
import {checkIfOnlineOrDie, ClaspCredentials, getOAuthSettings} from './utils';

import type {IncomingMessage, Server, ServerResponse} from 'http';
import type {AddressInfo} from 'net';
import type {ReadonlyDeep} from 'type-fest';
import type {ClaspCredentials} from './utils';

/**
* Authentication with Google's APIs.
Expand Down
13 changes: 7 additions & 6 deletions src/commands/apis.ts
@@ -1,7 +1,5 @@
import {GaxiosResponse} from 'gaxios';
import {discovery_v1 as discoveryV1, serviceusage_v1 as serviceUsageV1} from 'googleapis';
import open from 'open';
import {ReadonlyDeep} from 'type-fest';

import {PUBLIC_ADVANCED_SERVICES} from '../apis';
import {enableOrDisableAPI} from '../apiutils';
Expand All @@ -11,6 +9,9 @@ import {ERROR} from '../messages';
import {URL} from '../urls';
import {checkIfOnlineOrDie, getProjectId} from '../utils';

import type {GaxiosResponse} from 'gaxios';
import type {ReadonlyDeep} from 'type-fest';

type DirectoryItem = Unpacked<discoveryV1.Schema$DirectoryList['items']>;
type PublicAdvancedService = ReadonlyDeep<Required<NonNullable<DirectoryItem>>>;

Expand All @@ -31,10 +32,10 @@ export default async (options: CommandOption): Promise<void> => {
return await openApiUrl();
}

// @ts-expect-error
const [bin, sourcePath, ...args] = process.argv;
// @ts-expect-error
const [command, subCommand, serviceName] = args;
// @ts-expect-error 'xxx' is declared but its value is never read.
const [_bin, _sourcePath, ...args] = process.argv;
// @ts-expect-error 'xxx' is declared but its value is never read.
const [_command, subCommand, serviceName] = args;

// The apis subcommands.
const apiSubCommands: {[key: string]: () => Promise<void>} = {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/default.ts
@@ -1,9 +1,9 @@
import {Command} from 'commander';
import {ReadonlyDeep} from 'type-fest';

import {ClaspError} from '../clasp-error';
import {ERROR} from '../messages';

import type {Command} from 'commander';
import type {ReadonlyDeep} from 'type-fest';

/**
* Displays a default message when an unknown command is typed.
* @param command {string} The command that was typed.
Expand Down
4 changes: 2 additions & 2 deletions src/files.ts
Expand Up @@ -35,7 +35,7 @@ const projectFileWithContent = (file: ProjectFile, transpileOptions: ts.Transpil
return type === 'TS'
? // Transpile TypeScript to Google Apps Script
// @see github.com/grant/ts2gas
{...file, source: ts2gas(source, transpileOptions), type: 'SERVER_JS'}
{...file, source: ts2gas(source, transpileOptions as any), type: 'SERVER_JS'}
: {...file, source, type};
};

Expand Down Expand Up @@ -247,7 +247,7 @@ export const isValidFileName = (
name: string,
type: string,
rootDir: string,
// @ts-expect-error
// @ts-expect-error 'xxx' is declared but its value is never read.
normalizedName: string,
ignoreMatches: readonly string[]
): boolean => {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -342,8 +342,8 @@ commander
*/
commander.command('*', {isDefault: true}).description('Any other command is not supported').action(defaultCmd);

// @ts-expect-error
const [bin, sourcePath, ...args] = process.argv;
// @ts-expect-error 'xxx' is declared but its value is never read.
const [_bin, _sourcePath, ...args] = process.argv;
// Defaults to help if commands are not provided
if (args.length === 0) {
commander.outputHelp();
Expand Down
3 changes: 2 additions & 1 deletion src/inquirer.ts
@@ -1,11 +1,12 @@
import {script_v1 as scriptV1} from 'googleapis';
import {prompt, registerPrompt} from 'inquirer';
import autocomplete from 'inquirer-autocomplete-prompt-ipt';
import {ReadonlyDeep} from 'type-fest';

import {SCRIPT_TYPES} from './apis';
import {LOG} from './messages';

import type {ReadonlyDeep} from 'type-fest';

registerPrompt('autocomplete', autocomplete);

export type functionNameSource = (
Expand Down

0 comments on commit b7cb6bc

Please sign in to comment.