Skip to content

Commit cebb530

Browse files
refactor: run gts fix (#265)
1 parent 84c7330 commit cebb530

10 files changed

Lines changed: 317 additions & 345 deletions

File tree

handwritten/nodejs-datastore/src/entity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class Key {
224224
*/
225225
Object.defineProperty(this, 'path', {
226226
enumerable: true,
227-
get: function() {
227+
get() {
228228
return arrify(this.parent && this.parent.path).concat([
229229
this.kind,
230230
this.name || this.id,
@@ -880,14 +880,14 @@ function queryToQueryProto(query) {
880880
name: filter.name,
881881
},
882882
op: OP_TO_OPERATOR[filter.op],
883-
value: value,
883+
value,
884884
},
885885
};
886886
});
887887

888888
queryProto.filter = {
889889
compositeFilter: {
890-
filters: filters,
890+
filters,
891891
op: 'AND',
892892
},
893893
};

handwritten/nodejs-datastore/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class Datastore extends DatastoreRequest {
544544
*/
545545
static int(value) {
546546
return new entity.Int(value);
547-
};
547+
}
548548

549549
int(value) {
550550
return Datastore.int(value);
@@ -564,7 +564,7 @@ class Datastore extends DatastoreRequest {
564564
*/
565565
static isInt(value) {
566566
return entity.isDsInt(value);
567-
};
567+
}
568568

569569
isInt(value) {
570570
return Datastore.isInt(value);
@@ -644,7 +644,7 @@ class Datastore extends DatastoreRequest {
644644
namespace = this.namespace;
645645
}
646646
return new Query(this, namespace, arrify(kind));
647-
};
647+
}
648648

649649
/**
650650
* Helper to create a Key object, scoped to the instance's namespace by default.
@@ -702,7 +702,7 @@ class Datastore extends DatastoreRequest {
702702
path: arrify(options),
703703
};
704704
return new entity.Key(options);
705-
};
705+
}
706706

707707
/**
708708
* Helper function to check if something is a Datastore Key object.
@@ -718,7 +718,7 @@ class Datastore extends DatastoreRequest {
718718
*/
719719
static isKey(value) {
720720
return entity.isDsKey(value);
721-
};
721+
}
722722
isKey(value) {
723723
return Datastore.isKey(value);
724724
}
@@ -739,7 +739,7 @@ class Datastore extends DatastoreRequest {
739739
*/
740740
transaction(options?) {
741741
return new Transaction(this, options);
742-
};
742+
}
743743

744744
/**
745745
* Determine the appropriate endpoint to use for API requests. If not explicitly
@@ -772,7 +772,7 @@ class Datastore extends DatastoreRequest {
772772
.replace(leadingProtocol, '')
773773
.replace(port, '')
774774
.replace(trailingSlashes, '');
775-
};
775+
}
776776

777777
/**
778778
* {@link DatastoreRequest} class.

handwritten/nodejs-datastore/src/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class Query {
212212
*/
213213
order(property: string, options?) {
214214
const sign = options && options.descending ? '-' : '+';
215-
this.orders.push({name: property, sign: sign});
215+
this.orders.push({name: property, sign});
216216
return this;
217217
}
218218

handwritten/nodejs-datastore/src/request.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class DatastoreRequest {
230230
const makeRequest = keys => {
231231
// tslint:disable-next-line no-any
232232
const reqOpts: any = {
233-
keys: keys,
233+
keys,
234234
};
235235

236236
if (options.consistency) {
@@ -245,7 +245,7 @@ class DatastoreRequest {
245245
{
246246
client: 'DatastoreClient',
247247
method: 'lookup',
248-
reqOpts: reqOpts,
248+
reqOpts,
249249
gaxOpts: options.gaxOptions,
250250
},
251251
(err, resp) => {
@@ -355,7 +355,7 @@ class DatastoreRequest {
355355
{
356356
client: 'DatastoreClient',
357357
method: 'commit',
358-
reqOpts: reqOpts,
358+
reqOpts,
359359
gaxOpts: gaxOptions,
360360
},
361361
callback
@@ -660,7 +660,7 @@ class DatastoreRequest {
660660
{
661661
client: 'DatastoreClient',
662662
method: 'runQuery',
663-
reqOpts: reqOpts,
663+
reqOpts,
664664
gaxOpts: options.gaxOptions,
665665
},
666666
onResultSet
@@ -935,7 +935,7 @@ class DatastoreRequest {
935935
}
936936

937937
const insertIndexes = {};
938-
const mutations: {}[] = [];
938+
const mutations: Array<{}> = [];
939939
const methods = {
940940
insert: true,
941941
update: true,
@@ -1002,7 +1002,7 @@ class DatastoreRequest {
10021002
});
10031003

10041004
const reqOpts = {
1005-
mutations: mutations,
1005+
mutations,
10061006
};
10071007

10081008
function onCommit(err, resp) {
@@ -1035,7 +1035,7 @@ class DatastoreRequest {
10351035
{
10361036
client: 'DatastoreClient',
10371037
method: 'commit',
1038-
reqOpts: reqOpts,
1038+
reqOpts,
10391039
gaxOpts: gaxOptions,
10401040
},
10411041
onCommit

handwritten/nodejs-datastore/src/transaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class Transaction extends DatastoreRequest {
209209
{
210210
client: 'DatastoreClient',
211211
method: 'commit',
212-
reqOpts: reqOpts,
212+
reqOpts,
213213
gaxOpts: gaxOptions,
214214
},
215215
(err, resp) => {
@@ -457,7 +457,7 @@ class Transaction extends DatastoreRequest {
457457
{
458458
client: 'DatastoreClient',
459459
method: 'beginTransaction',
460-
reqOpts: reqOpts,
460+
reqOpts,
461461
gaxOpts: options.gaxOptions,
462462
},
463463
(err, resp) => {

handwritten/nodejs-datastore/system-test/datastore.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {Datastore} from '../src';
2020
import {entity} from '../src/entity';
2121

2222
describe('Datastore', () => {
23-
const testKinds: {}[] = [];
23+
const testKinds: Array<{}> = [];
2424
const datastore = new Datastore();
2525
// Override the Key method so we can track what keys are created during the
2626
// tests. They are then deleted in the `after` hook.
@@ -81,38 +81,38 @@ describe('Datastore', () => {
8181
const postKey = datastore.key(['Post', 'post1']);
8282

8383
const data = {
84-
longString: longString,
84+
longString,
8585
notMetadata: true,
8686
longStringArray: [longString],
8787
metadata: {
88-
longString: longString,
88+
longString,
8989
otherProperty: 'value',
9090
obj: {
9191
longStringArray: [
9292
{
93-
longString: longString,
93+
longString,
9494
nestedLongStringArray: [
9595
{
96-
longString: longString,
96+
longString,
9797
nestedProperty: true,
9898
},
9999
{
100-
longString: longString,
100+
longString,
101101
},
102102
],
103103
},
104104
],
105105
},
106106
longStringArray: [
107107
{
108-
longString: longString,
108+
longString,
109109
nestedLongStringArray: [
110110
{
111-
longString: longString,
111+
longString,
112112
nestedProperty: true,
113113
},
114114
{
115-
longString: longString,
115+
longString,
116116
},
117117
],
118118
},
@@ -123,7 +123,7 @@ describe('Datastore', () => {
123123
datastore.save(
124124
{
125125
key: postKey,
126-
data: data,
126+
data,
127127
excludeFromIndexes: [
128128
'longString',
129129
'longStringArray[]',
@@ -189,7 +189,7 @@ describe('Datastore', () => {
189189
buf: Buffer.from('010100000000000000000059400000000000006940', 'hex'),
190190
};
191191

192-
datastore.save({key: postKey, data: data}, err => {
192+
datastore.save({key: postKey, data}, err => {
193193
assert.ifError(err);
194194

195195
const assignedId = postKey.id;
@@ -406,7 +406,7 @@ describe('Datastore', () => {
406406

407407
datastore.save(
408408
{
409-
key: key,
409+
key,
410410
data: {
411411
year: integerType,
412412
},
@@ -431,7 +431,7 @@ describe('Datastore', () => {
431431

432432
datastore.save(
433433
{
434-
key: key,
434+
key,
435435
data: {
436436
nines: doubleType,
437437
},
@@ -459,7 +459,7 @@ describe('Datastore', () => {
459459

460460
datastore.save(
461461
{
462-
key: key,
462+
key,
463463
data: {
464464
location: geoPointType,
465465
},
@@ -549,7 +549,7 @@ describe('Datastore', () => {
549549
before(done => {
550550
const keysToSave = keys.map((key, index) => {
551551
return {
552-
key: key,
552+
key,
553553
data: characters[index],
554554
};
555555
});
@@ -817,7 +817,7 @@ describe('Datastore', () => {
817817
assert.ifError(err);
818818
transaction.get(key, err => {
819819
assert.ifError(err);
820-
transaction.save({key: key, data: obj});
820+
transaction.save({key, data: obj});
821821
transaction.commit(err => {
822822
assert.ifError(err);
823823
datastore.get(key, (err, entity) => {
@@ -852,7 +852,7 @@ describe('Datastore', () => {
852852

853853
transaction.save([
854854
{
855-
key: key,
855+
key,
856856
data: {rating: 10},
857857
},
858858
{
@@ -906,7 +906,7 @@ describe('Datastore', () => {
906906

907907
transaction.save([
908908
{
909-
key: key,
909+
key,
910910
data: {
911911
rating: 10,
912912
},
@@ -969,7 +969,7 @@ describe('Datastore', () => {
969969
assert.ifError(err);
970970
transaction.get(key, err => {
971971
assert.ifError(err);
972-
transaction.save({key: key, data: {}});
972+
transaction.save({key, data: {}});
973973
transaction.commit(err => {
974974
assert(err instanceof Error);
975975
done();

handwritten/nodejs-datastore/test/entity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('entity', function() {
112112
describe('Key', function() {
113113
it('should assign the namespace', function() {
114114
const namespace = 'NS';
115-
const key = new entity.Key({namespace: namespace, path: []});
115+
const key = new entity.Key({namespace, path: []});
116116
assert.strictEqual(key.namespace, namespace);
117117
});
118118

@@ -295,7 +295,7 @@ describe('entity', function() {
295295
const valueProto = {
296296
valueType: 'timestampValue',
297297
timestampValue: {
298-
seconds: seconds,
298+
seconds,
299299
nanos: ms * 1e6,
300300
},
301301
};
@@ -1016,7 +1016,7 @@ describe('entity', function() {
10161016
const key = {};
10171017

10181018
const entityProto = {
1019-
key: key,
1019+
key,
10201020
};
10211021

10221022
const results = [

0 commit comments

Comments
 (0)