From 583496c632bf05374a7271bbdf3cd2afa905f31d Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Wed, 19 Sep 2018 20:51:35 -0700 Subject: [PATCH 1/2] Enable prefer-const in the eslint config --- .eslintrc.yml | 1 + samples/concepts.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 65f1dce6c..73eeec276 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -12,3 +12,4 @@ rules: eqeqeq: error no-warning-comments: warn no-var: error + prefer-const: error diff --git a/samples/concepts.js b/samples/concepts.js index 6f5ac3705..c1d1a7ad7 100644 --- a/samples/concepts.js +++ b/samples/concepts.js @@ -560,7 +560,7 @@ class Metadata extends TestHelper { }); console.log('Properties by Kind:'); - for (let key in propertiesByKind) { + for (const key in propertiesByKind) { console.log(key, propertiesByKind[key]); } @@ -599,7 +599,7 @@ class Metadata extends TestHelper { }); console.log('Task property representations:'); - for (let key in representationsByProperty) { + for (const key in representationsByProperty) { console.log(key, representationsByProperty[key]); } From d61f7dca2624ac888a7e0549abb07da90902d63e Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Thu, 20 Sep 2018 13:25:49 -0700 Subject: [PATCH 2/2] fixy --- package.json | 3 ++- src/v1/datastore_client.js | 2 +- test/transaction.js | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index aab123e07..a5b03b4fd 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "test-no-cover": "mocha test/*.js", "test": "npm run cover", - "system-test": "mocha system-test/*.js --timeout 600000" + "system-test": "mocha system-test/*.js --timeout 600000", + "fix": "eslint '**/*.js' --fix && npm run prettier" }, "dependencies": { "@google-cloud/projectify": "^0.3.0", diff --git a/src/v1/datastore_client.js b/src/v1/datastore_client.js index 0e00048c6..ab66b76d8 100644 --- a/src/v1/datastore_client.js +++ b/src/v1/datastore_client.js @@ -132,7 +132,7 @@ class DatastoreClient { 'allocateIds', 'reserveIds', ]; - for (let methodName of datastoreStubMethods) { + for (const methodName of datastoreStubMethods) { this._innerApiCalls[methodName] = gax.createApiCall( datastoreStub.then( stub => diff --git a/test/transaction.js b/test/transaction.js index a3a7717c0..119be0658 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -119,8 +119,6 @@ describe('Transaction', function() { }); it('should localize request function', function(done) { - let transaction; - const fakeDataset = { request_: { bind: function(context) { @@ -136,7 +134,7 @@ describe('Transaction', function() { }, }; - transaction = new Transaction(fakeDataset); + const transaction = new Transaction(fakeDataset); }); it('should localize default properties', function() {