Skip to content

Commit

Permalink
Enable no-var in eslint (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and alexander-fenster committed Sep 18, 2018
1 parent c7161fc commit e35ee20
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 96 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-node/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ rules:
block-scoped-var: error
eqeqeq: error
no-warning-comments: warn
no-var: error
14 changes: 7 additions & 7 deletions packages/google-cloud-node/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

'use strict';

var common = require('@google-cloud/common');
var pumpify = require('pumpify');
var streamEvents = require('stream-events');
var through = require('through2');
let common = require('@google-cloud/common');
let pumpify = require('pumpify');
let streamEvents = require('stream-events');
let through = require('through2');

/*!
* Return a dictionary-like object with helpers to augment the Speech
* GAPIC.
*/
module.exports = () => {
var methods = {};
let methods = {};

/**
* Performs bidirectional streaming speech recognition: receive results while
Expand Down Expand Up @@ -69,9 +69,9 @@ module.exports = () => {
}

// Format the audio content as input request for pipeline
var recognizeStream = streamEvents(pumpify.obj());
let recognizeStream = streamEvents(pumpify.obj());

var requestStream = this._innerApiCalls
let requestStream = this._innerApiCalls
.streamingRecognize(options)
.on('error', err => {
recognizeStream.destroy(err);
Expand Down
18 changes: 9 additions & 9 deletions packages/google-cloud-node/system-test/speech_smoke_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ describe('SpeechSmokeTest', () => {
it('successfully makes a call to the service', done => {
const speech = require('../src');

var client = new speech.v1.SpeechClient({
let client = new speech.v1.SpeechClient({
// optional auth parameters.
});

var languageCode = 'en-US';
var sampleRateHertz = 44100;
var encoding = 'FLAC';
var config = {
let languageCode = 'en-US';
let sampleRateHertz = 44100;
let encoding = 'FLAC';
let config = {
languageCode: languageCode,
sampleRateHertz: sampleRateHertz,
encoding: encoding,
};
var uri = 'gs://gapic-toolkit/hello.flac';
var audio = {
let uri = 'gs://gapic-toolkit/hello.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};
client
.recognize(request)
.then(responses => {
var response = responses[0];
let response = responses[0];
console.log(response);
})
.then(done)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ describe('SpeechSmokeTest v1p1beta1', () => {
it('successfully makes a call to the service', done => {
const speech = require('../src');

var client = new speech.v1p1beta1.SpeechClient({
let client = new speech.v1p1beta1.SpeechClient({
// optional auth parameters.
});

var languageCode = 'en-US';
var sampleRateHertz = 44100;
var encoding = 'FLAC';
var config = {
let languageCode = 'en-US';
let sampleRateHertz = 44100;
let encoding = 'FLAC';
let config = {
languageCode: languageCode,
sampleRateHertz: sampleRateHertz,
encoding: encoding,
};
var uri = 'gs://gapic-toolkit/hello.flac';
var audio = {
let uri = 'gs://gapic-toolkit/hello.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};
client
.recognize(request)
.then(responses => {
var response = responses[0];
let response = responses[0];
console.log(response);
})
.then(done)
Expand Down
80 changes: 40 additions & 40 deletions packages/google-cloud-node/test/gapic-v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ const assert = require('assert');

const speechModule = require('../src');

var FAKE_STATUS_CODE = 1;
var error = new Error();
let FAKE_STATUS_CODE = 1;
let error = new Error();
error.code = FAKE_STATUS_CODE;

describe('SpeechClient', () => {
describe('recognize', () => {
it('invokes recognize without error', done => {
var client = new speechModule.v1.SpeechClient({
let client = new speechModule.v1.SpeechClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var encoding = 'FLAC';
var sampleRateHertz = 44100;
var languageCode = 'en-US';
var config = {
let encoding = 'FLAC';
let sampleRateHertz = 44100;
let languageCode = 'en-US';
let config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};
var uri = 'gs://bucket_name/file_name.flac';
var audio = {
let uri = 'gs://bucket_name/file_name.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};

// Mock response
var expectedResponse = {};
let expectedResponse = {};

// Mock Grpc layer
client._innerApiCalls.recognize = mockSimpleGrpcMethod(
Expand All @@ -65,25 +65,25 @@ describe('SpeechClient', () => {
});

it('invokes recognize with error', done => {
var client = new speechModule.v1.SpeechClient({
let client = new speechModule.v1.SpeechClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var encoding = 'FLAC';
var sampleRateHertz = 44100;
var languageCode = 'en-US';
var config = {
let encoding = 'FLAC';
let sampleRateHertz = 44100;
let languageCode = 'en-US';
let config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};
var uri = 'gs://bucket_name/file_name.flac';
var audio = {
let uri = 'gs://bucket_name/file_name.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};
Expand All @@ -106,31 +106,31 @@ describe('SpeechClient', () => {

describe('longRunningRecognize', function() {
it('invokes longRunningRecognize without error', done => {
var client = new speechModule.v1.SpeechClient({
let client = new speechModule.v1.SpeechClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var encoding = 'FLAC';
var sampleRateHertz = 44100;
var languageCode = 'en-US';
var config = {
let encoding = 'FLAC';
let sampleRateHertz = 44100;
let languageCode = 'en-US';
let config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};
var uri = 'gs://bucket_name/file_name.flac';
var audio = {
let uri = 'gs://bucket_name/file_name.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};

// Mock response
var expectedResponse = {};
let expectedResponse = {};

// Mock Grpc layer
client._innerApiCalls.longRunningRecognize = mockLongRunningGrpcMethod(
Expand All @@ -141,7 +141,7 @@ describe('SpeechClient', () => {
client
.longRunningRecognize(request)
.then(responses => {
var operation = responses[0];
let operation = responses[0];
return operation.promise();
})
.then(responses => {
Expand All @@ -154,25 +154,25 @@ describe('SpeechClient', () => {
});

it('invokes longRunningRecognize with error', done => {
var client = new speechModule.v1.SpeechClient({
let client = new speechModule.v1.SpeechClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var encoding = 'FLAC';
var sampleRateHertz = 44100;
var languageCode = 'en-US';
var config = {
let encoding = 'FLAC';
let sampleRateHertz = 44100;
let languageCode = 'en-US';
let config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};
var uri = 'gs://bucket_name/file_name.flac';
var audio = {
let uri = 'gs://bucket_name/file_name.flac';
let audio = {
uri: uri,
};
var request = {
let request = {
config: config,
audio: audio,
};
Expand All @@ -187,7 +187,7 @@ describe('SpeechClient', () => {
client
.longRunningRecognize(request)
.then(responses => {
var operation = responses[0];
let operation = responses[0];
return operation.promise();
})
.then(() => {
Expand All @@ -201,7 +201,7 @@ describe('SpeechClient', () => {
});

it('has longrunning decoder functions', () => {
var client = new speechModule.v1.SpeechClient({
let client = new speechModule.v1.SpeechClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
Expand Down Expand Up @@ -233,7 +233,7 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {
function mockLongRunningGrpcMethod(expectedRequest, response, error) {
return request => {
assert.deepStrictEqual(request, expectedRequest);
var mockOperation = {
let mockOperation = {
promise: function() {
return new Promise((resolve, reject) => {
if (error) {
Expand Down
Loading

0 comments on commit e35ee20

Please sign in to comment.