From e87d9da097f9b0a37a6c836e44c0484d857f7780 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Fri, 10 Apr 2020 18:50:51 -0700 Subject: [PATCH] fix: remove eslint, update gax, fix generated protos, run the generator (#507) Run the latest version of the generator, update google-gax, update gts, and remove direct dependencies on eslint. --- packages/google-cloud-translate/.jsdoc.js | 2 +- .../google-cloud-translate/.prettierrc.js | 2 +- packages/google-cloud-translate/package.json | 14 ++++------ .../google-cloud-translate/protos/protos.json | 16 +++++++++--- .../google-cloud-translate/src/v2/index.ts | 4 +-- .../google-cloud-translate/synth.metadata | 13 +++------- packages/google-cloud-translate/synth.py | 2 +- .../system-test/translate.ts | 1 - .../test/gapic_translation_service_v3.ts | 26 +++++++++---------- .../test/gapic_translation_service_v3beta1.ts | 26 +++++++++---------- 10 files changed, 51 insertions(+), 55 deletions(-) diff --git a/packages/google-cloud-translate/.jsdoc.js b/packages/google-cloud-translate/.jsdoc.js index 907b80b0b1e..a9fe77d5096 100644 --- a/packages/google-cloud-translate/.jsdoc.js +++ b/packages/google-cloud-translate/.jsdoc.js @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2019 Google, LLC.', + copyright: 'Copyright 2020 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/translate', diff --git a/packages/google-cloud-translate/.prettierrc.js b/packages/google-cloud-translate/.prettierrc.js index 08cba3775be..d1b95106f4c 100644 --- a/packages/google-cloud-translate/.prettierrc.js +++ b/packages/google-cloud-translate/.prettierrc.js @@ -4,7 +4,7 @@ // 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 +// https://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, diff --git a/packages/google-cloud-translate/package.json b/packages/google-cloud-translate/package.json index 45dce5d2078..5ba1b505e3b 100644 --- a/packages/google-cloud-translate/package.json +++ b/packages/google-cloud-translate/package.json @@ -30,25 +30,25 @@ "scripts": { "docs": "jsdoc -c .jsdoc.js", "predocs": "npm run compile", - "lint": "gts check && eslint '**/*.js'", + "lint": "gts fix", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", "system-test": "mocha build/system-test --timeout 600000", "test": "c8 mocha build/test", "compile": "tsc -p . && cp -r protos build/", - "fix": "gts fix && eslint --fix '**/*.js'", + "fix": "gts fix", "prepare": "npm run compile", "pretest": "npm run compile", "presystem-test": "npm run compile", "docs-test": "linkinator docs", "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm i" + "prelint": "cd samples; npm link ../; npm install" }, "dependencies": { "@google-cloud/common": "^3.0.0", "@google-cloud/promisify": "^2.0.0", "arrify": "^2.0.0", "extend": "^3.0.2", - "google-gax": "^2.0.1", + "google-gax": "^2.1.0", "is-html": "^2.0.0", "protobufjs": "^6.8.8" }, @@ -61,12 +61,8 @@ "@types/sinon": "^9.0.0", "c8": "^7.0.0", "codecov": "^3.0.2", - "eslint": "^6.0.0", - "eslint-config-prettier": "^6.0.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.0.0", "google-auth-library": "^6.0.0", - "gts": "2.0.0-alpha.9", + "gts": "^2.0.0", "http2spy": "^1.1.0", "jsdoc": "^3.6.2", "jsdoc-fresh": "^1.0.1", diff --git a/packages/google-cloud-translate/protos/protos.json b/packages/google-cloud-translate/protos/protos.json index f4f8d5076a9..4208aec51ea 100644 --- a/packages/google-cloud-translate/protos/protos.json +++ b/packages/google-cloud-translate/protos/protos.json @@ -2695,26 +2695,32 @@ "extend": "google.protobuf.MethodOptions" }, "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, "methods": { "ListOperations": { "requestType": "ListOperationsRequest", "responseType": "ListOperationsResponse", "options": { - "(google.api.http).get": "/v1/{name=operations}" + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" } }, "GetOperation": { "requestType": "GetOperationRequest", "responseType": "Operation", "options": { - "(google.api.http).get": "/v1/{name=operations/**}" + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" } }, "DeleteOperation": { "requestType": "DeleteOperationRequest", "responseType": "google.protobuf.Empty", "options": { - "(google.api.http).delete": "/v1/{name=operations/**}" + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" } }, "CancelOperation": { @@ -2722,7 +2728,8 @@ "responseType": "google.protobuf.Empty", "options": { "(google.api.http).post": "/v1/{name=operations/**}:cancel", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" } }, "WaitOperation": { @@ -2848,6 +2855,7 @@ }, "rpc": { "options": { + "cc_enable_arenas": true, "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", "java_multiple_files": true, "java_outer_classname": "StatusProto", diff --git a/packages/google-cloud-translate/src/v2/index.ts b/packages/google-cloud-translate/src/v2/index.ts index 76daff2c61d..3b4e0aaf718 100644 --- a/packages/google-cloud-translate/src/v2/index.ts +++ b/packages/google-cloud-translate/src/v2/index.ts @@ -271,7 +271,7 @@ export class Translate extends Service { }); // Deprecated. - // tslint:disable-next-line no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any delete (result as any).isReliable; return result; @@ -511,7 +511,7 @@ export class Translate extends Service { options = {to: optionsOrTo}; } - // tslint:disable-next-line no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any const body: any = { q: input, format: options.format || (isHtml(input[0]) ? 'html' : 'text'), diff --git a/packages/google-cloud-translate/synth.metadata b/packages/google-cloud-translate/synth.metadata index 99f1e93b671..2061cd076f2 100644 --- a/packages/google-cloud-translate/synth.metadata +++ b/packages/google-cloud-translate/synth.metadata @@ -1,19 +1,12 @@ { - "updateTime": "2020-04-03T12:20:41.545746Z", + "updateTime": "2020-04-11T01:04:33.653333Z", "sources": [ - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5378173a889f9c7d83e36e52d38a6267190de692", - "internalRef": "304594381" - } - }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "99820243d348191bc9c634f2b48ddf65096285ed" + "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5", + "log": "6f32150677c9784f3c3a7e1949472bd29c9d72c5\nfix: installs test_utils from its common repo (#480)\n\n\n74ce986d3b5431eb66985e9a00c4eb45295a4020\nfix: stop recording update_time in synth.metadata (#478)\n\n\n7f8e62aa3edd225f76347a16f92e400661fdfb52\nchore(java): release-please only updates non maven versions in README (#476)\n\nPrevent release-please and synthtool from fighting over the released library version. Synthtool updates the install snippets from the samples pom.xml files so the bots fight if they are temporarily out of sync after a release.\nc7e0e517d7f46f77bebd27da2e5afcaa6eee7e25\nbuild(java): fix nightly integration test config to run integrations (#465)\n\nThis was only running the units.\nbd69a2aa7b70875f3c988e269706b22fefbef40e\nbuild(java): fix retry_with_backoff when -e option set (#475)\n\n\nd9b173c427bfa0c6cca818233562e7e8841a357c\nfix: record version of working repo in synth.metadata (#473)\n\nPartial revert of b37cf74d12e9a42b9de9e61a4f26133d7cd9c168.\nf73a541770d95a609e5be6bf6b3b220d17cefcbe\nfeat(discogapic): allow local discovery-artifact-manager (#474)\n\n\n8cf0f5d93a70c3dcb0b4999d3152c46d4d9264bf\ndoc: describe the Autosynth & Synthtool protocol (#472)\n\n* doc: describe the Autosynth & Synthtool protocol\n\n* Accommodate review comments.\n980baaa738a1ad8fa02b4fdbd56be075ee77ece5\nfix: pin sphinx to <3.0.0 as new version causes new error (#471)\n\nThe error `toctree contains reference to document changlelog that doesn't have a title: no link will be generated` occurs as of 3.0.0. Pinning to 2.x until we address the docs build issue.\n\nTowards #470\n\nI did this manually for python-datastore https://github.com/googleapis/python-datastore/pull/22\n928b2998ac5023e7c7e254ab935f9ef022455aad\nchore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.15 (#466)\n\nCo-authored-by: Jeffrey Rennie \n188f1b1d53181f739b98f8aa5d40cfe99eb90c47\nfix: allow local and external deps to be specified (#469)\n\nModify noxfile.py to allow local and external dependencies for\nsystem tests to be specified.\n1df68ed6735ddce6797d0f83641a731c3c3f75b4\nfix: apache license URL (#468)\n\n\nf4a59efa54808c4b958263de87bc666ce41e415f\nfeat: Add discogapic support for GAPICBazel generation (#459)\n\n* feat: Add discogapic support for GAPICBazel generation\n\n* reformat with black\n\n* Rename source repository variable\n\nCo-authored-by: Jeffrey Rennie \n" } } ], diff --git a/packages/google-cloud-translate/synth.py b/packages/google-cloud-translate/synth.py index 7fb8ac76325..819ff17da00 100644 --- a/packages/google-cloud-translate/synth.py +++ b/packages/google-cloud-translate/synth.py @@ -45,5 +45,5 @@ # Node.js specific cleanup subprocess.run(["npm", "install"]) -subprocess.run(["npm", "run", "fix"]) +subprocess.run(["npm", "run", "lint"]) subprocess.run(["npx", "compileProtos", "src"]) diff --git a/packages/google-cloud-translate/system-test/translate.ts b/packages/google-cloud-translate/system-test/translate.ts index 561112ba0ad..a68415ee1ae 100644 --- a/packages/google-cloud-translate/system-test/translate.ts +++ b/packages/google-cloud-translate/system-test/translate.ts @@ -18,7 +18,6 @@ import {TranslationServiceClient} from '../src'; // eslint-disable-next-line @typescript-eslint/no-var-requires const http2spy = require('http2spy'); -const API_KEY = process.env.TRANSLATE_API_KEY; describe('translate', () => { const translate = new TranslationServiceClient(); diff --git a/packages/google-cloud-translate/test/gapic_translation_service_v3.ts b/packages/google-cloud-translate/test/gapic_translation_service_v3.ts index ac652102ace..1febe1880f1 100644 --- a/packages/google-cloud-translate/test/gapic_translation_service_v3.ts +++ b/packages/google-cloud-translate/test/gapic_translation_service_v3.ts @@ -331,7 +331,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.translateText(request); }, expectedError); assert( @@ -445,7 +445,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.detectLanguage(request); }, expectedError); assert( @@ -561,7 +561,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getSupportedLanguages(request); }, expectedError); assert( @@ -675,7 +675,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getGlossary(request); }, expectedError); assert( @@ -799,7 +799,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.batchTranslateText(request); }, expectedError); assert( @@ -834,7 +834,7 @@ describe('v3.TranslationServiceClient', () => { expectedError ); const [operation] = await client.batchTranslateText(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -958,7 +958,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.createGlossary(request); }, expectedError); assert( @@ -993,7 +993,7 @@ describe('v3.TranslationServiceClient', () => { expectedError ); const [operation] = await client.createGlossary(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -1117,7 +1117,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.deleteGlossary(request); }, expectedError); assert( @@ -1152,7 +1152,7 @@ describe('v3.TranslationServiceClient', () => { expectedError ); const [operation] = await client.deleteGlossary(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -1282,7 +1282,7 @@ describe('v3.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listGlossaries(request); }, expectedError); assert( @@ -1381,7 +1381,7 @@ describe('v3.TranslationServiceClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -1460,7 +1460,7 @@ describe('v3.TranslationServiceClient', () => { expectedError ); const iterable = client.listGlossariesAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.translation.v3.IGlossary[] = []; for await (const resource of iterable) { responses.push(resource!); diff --git a/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts b/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts index 03e054def8e..ee05fbaad51 100644 --- a/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts +++ b/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts @@ -347,7 +347,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.translateText(request); }, expectedError); assert( @@ -467,7 +467,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.detectLanguage(request); }, expectedError); assert( @@ -589,7 +589,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getSupportedLanguages(request); }, expectedError); assert( @@ -709,7 +709,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getGlossary(request); }, expectedError); assert( @@ -839,7 +839,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.batchTranslateText(request); }, expectedError); assert( @@ -876,7 +876,7 @@ describe('v3beta1.TranslationServiceClient', () => { expectedError ); const [operation] = await client.batchTranslateText(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -1006,7 +1006,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.createGlossary(request); }, expectedError); assert( @@ -1043,7 +1043,7 @@ describe('v3beta1.TranslationServiceClient', () => { expectedError ); const [operation] = await client.createGlossary(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -1173,7 +1173,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.deleteGlossary(request); }, expectedError); assert( @@ -1210,7 +1210,7 @@ describe('v3beta1.TranslationServiceClient', () => { expectedError ); const [operation] = await client.deleteGlossary(request); - assert.rejects(async () => { + await assert.rejects(async () => { await operation.promise(); }, expectedError); assert( @@ -1346,7 +1346,7 @@ describe('v3beta1.TranslationServiceClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listGlossaries(request); }, expectedError); assert( @@ -1449,7 +1449,7 @@ describe('v3beta1.TranslationServiceClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -1532,7 +1532,7 @@ describe('v3beta1.TranslationServiceClient', () => { expectedError ); const iterable = client.listGlossariesAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; for await (const resource of iterable) { responses.push(resource!);