Skip to content

Commit

Permalink
Enable no-var in eslint (#13)
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 e4d9efd commit e6c4f8a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-asset/.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
20 changes: 10 additions & 10 deletions packages/google-cloud-asset/src/v1beta1/asset_service_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class AssetServiceClient {
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
var gaxGrpc = new gax.GrpcClient(opts);
let gaxGrpc = new gax.GrpcClient(opts);

// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;

// Determine the client header string.
var clientHeader = [
let clientHeader = [
`gl-node/${process.version}`,
`grpc/${gaxGrpc.grpcVersion}`,
`gax/${gax.version}`,
Expand All @@ -89,7 +89,7 @@ class AssetServiceClient {
}

// Load the applicable protos.
var protos = merge(
let protos = merge(
{},
gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
Expand All @@ -103,7 +103,7 @@ class AssetServiceClient {
this._pathTemplates = {
projectPathTemplate: new gax.PathTemplate('projects/{project}'),
};
var protoFilesRoot = new gax.GoogleProtoFilesRoot();
let protoFilesRoot = new gax.GoogleProtoFilesRoot();
protoFilesRoot = protobuf.loadSync(
path.join(
__dirname,
Expand All @@ -123,10 +123,10 @@ class AssetServiceClient {
grpc: gaxGrpc.grpc,
}).operationsClient(opts);

var exportAssetsResponse = protoFilesRoot.lookup(
let exportAssetsResponse = protoFilesRoot.lookup(
'google.cloud.asset.v1beta1.ExportAssetsResponse'
);
var exportAssetsMetadata = protoFilesRoot.lookup(
let exportAssetsMetadata = protoFilesRoot.lookup(
'google.cloud.asset.v1beta1.ExportAssetsRequest'
);

Expand All @@ -139,7 +139,7 @@ class AssetServiceClient {
};

// Put together the default options sent with requests.
var defaults = gaxGrpc.constructSettings(
let defaults = gaxGrpc.constructSettings(
'google.cloud.asset.v1beta1.AssetService',
gapicConfig,
opts.clientConfig,
Expand All @@ -153,20 +153,20 @@ class AssetServiceClient {

// Put together the "service stub" for
// google.cloud.asset.v1beta1.AssetService.
var assetServiceStub = gaxGrpc.createStub(
let assetServiceStub = gaxGrpc.createStub(
protos.google.cloud.asset.v1beta1.AssetService,
opts
);

// Iterate over each of the methods that the service provides
// and create an API call method for each.
var assetServiceStubMethods = ['exportAssets', 'batchGetAssetsHistory'];
let assetServiceStubMethods = ['exportAssets', 'batchGetAssetsHistory'];
for (let methodName of assetServiceStubMethods) {
this._innerApiCalls[methodName] = gax.createApiCall(
assetServiceStub.then(
stub =>
function() {
var args = Array.prototype.slice.call(arguments, 0);
let args = Array.prototype.slice.call(arguments, 0);
return stub[methodName].apply(stub, args);
}
),
Expand Down
52 changes: 26 additions & 26 deletions packages/google-cloud-asset/test/gapic-v1beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ const assert = require('assert');

const assetModule = 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('AssetServiceClient', () => {
describe('exportAssets', function() {
it('invokes exportAssets without error', done => {
var client = new assetModule.v1beta1.AssetServiceClient({
let client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var formattedParent = client.projectPath('[PROJECT]');
var outputConfig = {};
var request = {
let formattedParent = client.projectPath('[PROJECT]');
let outputConfig = {};
let request = {
parent: formattedParent,
outputConfig: outputConfig,
};

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

// Mock Grpc layer
client._innerApiCalls.exportAssets = mockLongRunningGrpcMethod(
Expand All @@ -50,7 +50,7 @@ describe('AssetServiceClient', () => {
client
.exportAssets(request)
.then(responses => {
var operation = responses[0];
let operation = responses[0];
return operation.promise();
})
.then(responses => {
Expand All @@ -63,15 +63,15 @@ describe('AssetServiceClient', () => {
});

it('invokes exportAssets with error', done => {
var client = new assetModule.v1beta1.AssetServiceClient({
let client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var formattedParent = client.projectPath('[PROJECT]');
var outputConfig = {};
var request = {
let formattedParent = client.projectPath('[PROJECT]');
let outputConfig = {};
let request = {
parent: formattedParent,
outputConfig: outputConfig,
};
Expand All @@ -86,7 +86,7 @@ describe('AssetServiceClient', () => {
client
.exportAssets(request)
.then(responses => {
var operation = responses[0];
let operation = responses[0];
return operation.promise();
})
.then(() => {
Expand All @@ -100,7 +100,7 @@ describe('AssetServiceClient', () => {
});

it('has longrunning decoder functions', () => {
var client = new assetModule.v1beta1.AssetServiceClient({
let client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
Expand All @@ -117,23 +117,23 @@ describe('AssetServiceClient', () => {

describe('batchGetAssetsHistory', () => {
it('invokes batchGetAssetsHistory without error', done => {
var client = new assetModule.v1beta1.AssetServiceClient({
let client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var formattedParent = client.projectPath('[PROJECT]');
var contentType = 'CONTENT_TYPE_UNSPECIFIED';
var readTimeWindow = {};
var request = {
let formattedParent = client.projectPath('[PROJECT]');
let contentType = 'CONTENT_TYPE_UNSPECIFIED';
let readTimeWindow = {};
let request = {
parent: formattedParent,
contentType: contentType,
readTimeWindow: readTimeWindow,
};

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

// Mock Grpc layer
client._innerApiCalls.batchGetAssetsHistory = mockSimpleGrpcMethod(
Expand All @@ -149,16 +149,16 @@ describe('AssetServiceClient', () => {
});

it('invokes batchGetAssetsHistory with error', done => {
var client = new assetModule.v1beta1.AssetServiceClient({
let client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
var formattedParent = client.projectPath('[PROJECT]');
var contentType = 'CONTENT_TYPE_UNSPECIFIED';
var readTimeWindow = {};
var request = {
let formattedParent = client.projectPath('[PROJECT]');
let contentType = 'CONTENT_TYPE_UNSPECIFIED';
let readTimeWindow = {};
let request = {
parent: formattedParent,
contentType: contentType,
readTimeWindow: readTimeWindow,
Expand Down Expand Up @@ -197,7 +197,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

0 comments on commit e6c4f8a

Please sign in to comment.