Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds new tslint rule for no-unused-variables #121

Merged
merged 2 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we comment this block out and add a TODO here?

This feature is incomplete. It was intended to rename files from gs to js.

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