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
build!: update to latest version of gts/typescript #183
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./node_modules/gts" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules/* | ||
samples/node_modules/* | ||
src/**/doc/* | ||
**/node_modules | ||
**/.coverage | ||
build/ | ||
docs/ | ||
protos/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
module.exports = { | ||
...require('gts/.prettierrc.json') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* eslint-disable prefer-rest-params */ | ||
|
||
// Copyright 2014 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -66,8 +68,7 @@ export function promisify( | |
const slice = Array.prototype.slice; | ||
|
||
// tslint:disable-next-line:no-any | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly these won't work with eslint. There's a different syntax (which I can't remember right now) for disabling a line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const wrapper: any = function(this: WithPromise) { | ||
const context = this; | ||
const wrapper: any = function (this: WithPromise) { | ||
let last; | ||
|
||
for (last = arguments.length - 1; last >= 0; last--) { | ||
|
@@ -81,7 +82,7 @@ export function promisify( | |
break; // non-callback last argument found. | ||
} | ||
|
||
return originalMethod.apply(context, arguments); | ||
return originalMethod.apply(this, arguments); | ||
} | ||
|
||
// peel trailing undefined. | ||
|
@@ -93,8 +94,8 @@ export function promisify( | |
// Because dedupe will likely create a single install of | ||
// @google-cloud/common to be shared amongst all modules, we need to | ||
// localize it at the Service level. | ||
if (context && context.Promise) { | ||
PromiseCtor = context.Promise; | ||
if (this && this.Promise) { | ||
PromiseCtor = this.Promise; | ||
} | ||
|
||
return new PromiseCtor((resolve, reject) => { | ||
|
@@ -114,7 +115,7 @@ export function promisify( | |
} | ||
}); | ||
|
||
originalMethod.apply(context, args); | ||
originalMethod.apply(this, args); | ||
}); | ||
}; | ||
|
||
|
@@ -165,16 +166,14 @@ export function callbackify(originalMethod: CallbackMethod) { | |
} | ||
|
||
// tslint:disable-next-line:no-any | ||
const wrapper = function(this: any) { | ||
const context = this; | ||
|
||
const wrapper = function (this: any) { | ||
if (typeof arguments[arguments.length - 1] !== 'function') { | ||
return originalMethod.apply(context, arguments); | ||
return originalMethod.apply(this, arguments); | ||
} | ||
|
||
const cb = Array.prototype.pop.call(arguments); | ||
|
||
originalMethod.apply(context, arguments).then( | ||
originalMethod.apply(this, arguments).then( | ||
// tslint:disable-next-line:no-any | ||
(res: any) => { | ||
res = Array.isArray(res) ? res : [res]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this after the license header I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the eslint-disable inline statements, we will probably want a replacement soonish depending on how migrating other libraries goes.