Skip to content

Commit

Permalink
Adds new tslint rule for no-unused-variables (#121)
Browse files Browse the repository at this point in the history
* Adds new tslint rule for no-unused-variables
* Comment out the .gs -> .js renaming code
  • Loading branch information
campionfellin authored and grant committed Apr 19, 2018
1 parent c89e71b commit 939225e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
23 changes: 11 additions & 12 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { google } from 'googleapis';
import * as http from 'http';
const isOnline = require('is-online');
import * as mkdirp from 'mkdirp';
import { OAuth2Client, GoogleAuthOptions } from 'google-auth-library';
import { OAuth2Client } from 'google-auth-library';
const open = require('open');
import * as os from 'os';
const path = require('path');
Expand All @@ -42,7 +42,6 @@ import { Spinner } from 'cli-spinner';
const splitLines = require('split-lines');
import * as url from 'url';
const readline = require('readline');
import { Server } from "http";
const logging = require('@google-cloud/logging');
const chalk = require('chalk');

Expand Down Expand Up @@ -309,7 +308,7 @@ function getAPICredentials(cb: (rc: ClaspSettings | void) => void, isLocal?: boo
* to handle the auth response. False if manual entry used.
*/
function authorize(useLocalhost: boolean, writeToOwnKey: boolean) {
const codes = oauth2Client.generateCodeVerifier();
// const codes = oauth2Client.generateCodeVerifier();
// See https://developers.google.com/identity/protocols/OAuth2InstalledApp#step1-code-verifier
const options = {
access_type: 'offline',
Expand Down Expand Up @@ -347,7 +346,6 @@ function authorizeWithLocalhost(opts: any): Promise<string> {
return new Promise((res: Function, rej: Function) => {
const server = http.createServer((req: http.ServerRequest, resp: http.ServerResponse) => {
const urlParts = url.parse(req.url || '', true);
const code = urlParts.query.code;
if (urlParts.query.code) {
res(urlParts.query.code);
} else {
Expand Down Expand Up @@ -469,13 +467,14 @@ function getProjectFiles(rootDir: string, callback: FilesCallback): void {
if (err) return callback(new Error(err), null, null);
// Check if there are any .gs files
// We will prompt the user to rename files
let canRenameToJS = false;
filePaths.map((name, i) => {
if (path.extname(name) === '.gs') {
canRenameToJS = true;
}
});

//
// TODO: implement renaming files from .gs to .js
// let canRenameToJS = false;
// filePaths.map((name, i) => {
// if (path.extname(name) === '.gs') {
// canRenameToJS = true;
// }
// });
// Check if there are files that will conflict if renamed .gs to .js
filePaths.map((name: string) => {
const fileNameWithoutExt = name.slice(0, -path.extname(name).length);
Expand Down Expand Up @@ -704,7 +703,7 @@ commander
console.log(err);
spinner.stop(true);
} else if (projectFiles) {
const [nonIgnoredFilePaths, ignoredFilePaths] = projectFiles;
const [nonIgnoredFilePaths] = projectFiles;
script.projects.updateContent({
scriptId,
resource: { files }
Expand Down
1 change: 1 addition & 0 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"no-reference": true,
"no-string-throw": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [
Expand Down

0 comments on commit 939225e

Please sign in to comment.