From d3aae80ba020ca337b6b78c61d1a3a473352807f Mon Sep 17 00:00:00 2001 From: Corey Pyle Date: Mon, 23 Sep 2024 10:35:18 -0400 Subject: [PATCH 1/2] JavaScript (v3): Lint - Add eslint-disable to files that haven't been touched since the linter was turned on. --- javascriptv3/.eslintignore | 3 +- .../tests/cloudwatch-query.unit.test.js | 3 +- .../cloudwatch/libs/cloudwatch-helper.js | 1 + .../tests/put-metric-data.integration.test.js | 2 + .../codepipeline/MyCodePipelineFunction.js | 211 +++++++++--------- .../src/handlers/get-items-handler.ts | 4 +- .../src/handlers/post-items-handler.ts | 4 +- .../src/handlers/post-items-report-handler.ts | 10 +- .../src/handlers/put-items-archive-handler.ts | 4 +- .../aurora-serverless-app/src/index.ts | 6 +- .../src/middleware/validate-db.ts | 2 + .../src/types/sendable.d.ts | 6 +- .../aurora-serverless-app/watch.js | 6 +- .../helper-functions/lambda-function-setup.js | 13 +- .../src/helper-functions/populate-table.js | 7 +- .../src/libs/dynamoClient.js | 5 +- .../src/libs/lambdaClient.js | 5 +- .../lambda-api-gateway/src/libs/snsClient.js | 5 +- .../src/mylamdbafunction.js | 13 +- .../helper-functions/lambda-function-setup.js | 11 +- .../src/helper-functions/populate-table.js | 7 +- .../src/libs/dynamoClient.js | 5 +- .../src/libs/lambdaClient.js | 5 +- .../src/libs/snsClient.js | 5 +- .../src/mylamdbafunction.js | 1 + .../cross-services/lex-bot/src/index.js | 7 +- .../cross-services/textract-react/src/App.js | 3 +- .../textract-react/src/ExplorerCard.js | 1 + .../textract-react/src/ExplorerTree.js | 3 +- .../textract-react/src/ExtractButtons.js | 1 + .../textract-react/src/ImageDisplay.js | 5 +- .../textract-react/src/ImageLoader.js | 1 + .../textract-react/src/LoginCard.js | 1 + .../textract-react/src/TextractModel.js | 11 +- .../textract-react/src/__test__/App.test.js | 11 +- .../src/__test__/ExplorerCard.test.js | 7 +- .../src/__test__/ExplorerTree.test.js | 11 +- .../src/__test__/ExtractButtons.test.js | 1 + .../src/__test__/ImageDisplay.test.js | 5 +- .../src/__test__/ImageLoader.test.js | 3 +- .../src/__test__/LoginCard.test.js | 1 + .../src/__test__/TextractModel.test.js | 3 +- .../textract-react/src/index.js | 3 +- .../textract-react/src/setupTests.js | 4 + .../example_code/glacier/src/createVault.ts | 1 + .../glacier/src/libs/glacierClient.js | 1 + .../example_code/glacier/src/uploadArchive.ts | 1 + .../object-locking/repl.steps.unit.test.js | 2 + 48 files changed, 236 insertions(+), 195 deletions(-) diff --git a/javascriptv3/.eslintignore b/javascriptv3/.eslintignore index f72fa40b2b5..cbb5a738ff2 100644 --- a/javascriptv3/.eslintignore +++ b/javascriptv3/.eslintignore @@ -1,3 +1,4 @@ /example_code/reactnative/ /example_code/medical-imaging/scenarios/health-image-sets/pixel-data-verification -/example_code/kinesis/kinesis-cdk \ No newline at end of file +/example_code/kinesis/kinesis-cdk +**/dist \ No newline at end of file diff --git a/javascriptv3/example_code/cloudwatch-logs/tests/cloudwatch-query.unit.test.js b/javascriptv3/example_code/cloudwatch-logs/tests/cloudwatch-query.unit.test.js index ec6ab3fdcc8..c355df1897f 100644 --- a/javascriptv3/example_code/cloudwatch-logs/tests/cloudwatch-query.unit.test.js +++ b/javascriptv3/example_code/cloudwatch-logs/tests/cloudwatch-query.unit.test.js @@ -1,7 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import { describe, it, vi, expect } from "vitest"; import { CloudWatchQuery } from "../scenarios/large-query/cloud-watch-query.js"; diff --git a/javascriptv3/example_code/cloudwatch/libs/cloudwatch-helper.js b/javascriptv3/example_code/cloudwatch/libs/cloudwatch-helper.js index 1807ee90628..0345f3bea53 100644 --- a/javascriptv3/example_code/cloudwatch/libs/cloudwatch-helper.js +++ b/javascriptv3/example_code/cloudwatch/libs/cloudwatch-helper.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import { DeleteAlarmsCommand, diff --git a/javascriptv3/example_code/cloudwatch/tests/put-metric-data.integration.test.js b/javascriptv3/example_code/cloudwatch/tests/put-metric-data.integration.test.js index e1e16cbd898..0b1bc58df0d 100644 --- a/javascriptv3/example_code/cloudwatch/tests/put-metric-data.integration.test.js +++ b/javascriptv3/example_code/cloudwatch/tests/put-metric-data.integration.test.js @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { describe, it, expect } from "vitest"; import { v4 as uuidv4 } from "uuid"; import { getMetricData } from "../libs/cloudwatch-helper.js"; diff --git a/javascriptv3/example_code/codepipeline/MyCodePipelineFunction.js b/javascriptv3/example_code/codepipeline/MyCodePipelineFunction.js index 0185caa08aa..6cf41cc57dc 100644 --- a/javascriptv3/example_code/codepipeline/MyCodePipelineFunction.js +++ b/javascriptv3/example_code/codepipeline/MyCodePipelineFunction.js @@ -1,103 +1,108 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - - -// snippet-start:[codepipeline.javascript.MyCodePipelineFunction.complete] - -var assert = require('assert'); -var AWS = require('aws-sdk'); -var http = require('http'); - -exports.handler = function(event, context) { - - var codepipeline = new AWS.CodePipeline(); - - // Retrieve the Job ID from the Lambda action - var jobId = event["CodePipeline.job"].id; - - // Retrieve the value of UserParameters from the Lambda action configuration in AWS CodePipeline, in this case a URL which will be - // health checked by this function. - var url = event["CodePipeline.job"].data.actionConfiguration.configuration.UserParameters; - - // Notify AWS CodePipeline of a successful job - var putJobSuccess = function(message) { - var params = { - jobId: jobId - }; - codepipeline.putJobSuccessResult(params, function(err, data) { - if(err) { - context.fail(err); - } else { - context.succeed(message); - } - }); - }; - - // Notify AWS CodePipeline of a failed job - var putJobFailure = function(message) { - var params = { - jobId: jobId, - failureDetails: { - message: JSON.stringify(message), - type: 'JobFailed', - externalExecutionId: context.invokeid - } - }; - codepipeline.putJobFailureResult(params, function(err, data) { - context.fail(message); - }); - }; - - // Validate the URL passed in UserParameters - if(!url || url.indexOf('http://') === -1) { - putJobFailure('The UserParameters field must contain a valid URL address to test, including http:// or https://'); - return; - } - - // Helper function to make a HTTP GET request to the page. - // The helper will test the response and succeed or fail the job accordingly - var getPage = function(url, callback) { - var pageObject = { - body: '', - statusCode: 0, - contains: function(search) { - return this.body.indexOf(search) > -1; - } - }; - http.get(url, function(response) { - pageObject.body = ''; - pageObject.statusCode = response.statusCode; - - response.on('data', function (chunk) { - pageObject.body += chunk; - }); - - response.on('end', function () { - callback(pageObject); - }); - - response.resume(); - }).on('error', function(error) { - // Fail the job if our request failed - putJobFailure(error); - }); - }; - - getPage(url, function(returnedPage) { - try { - // Check if the HTTP response has a 200 status - assert(returnedPage.statusCode === 200); - // Check if the page contains the text "Congratulations" - // You can change this to check for different text, or add other tests as required - assert(returnedPage.contains('Congratulations')); - - // Succeed the job - putJobSuccess("Tests passed."); - } catch (ex) { - // If any of the assertions failed then fail the job - putJobFailure(ex); - } - }); -}; - -// snippet-end:[codepipeline.javascript.MyCodePipelineFunction.complete] +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + +// snippet-start:[codepipeline.javascript.MyCodePipelineFunction.complete] + +var assert = require("assert"); +var AWS = require("aws-sdk"); +var http = require("http"); + +exports.handler = function (event, context) { + var codepipeline = new AWS.CodePipeline(); + + // Retrieve the Job ID from the Lambda action + var jobId = event["CodePipeline.job"].id; + + // Retrieve the value of UserParameters from the Lambda action configuration in AWS CodePipeline, in this case a URL which will be + // health checked by this function. + var url = + event["CodePipeline.job"].data.actionConfiguration.configuration + .UserParameters; + + // Notify AWS CodePipeline of a successful job + var putJobSuccess = function (message) { + var params = { + jobId: jobId, + }; + codepipeline.putJobSuccessResult(params, function (err, data) { + if (err) { + context.fail(err); + } else { + context.succeed(message); + } + }); + }; + + // Notify AWS CodePipeline of a failed job + var putJobFailure = function (message) { + var params = { + jobId: jobId, + failureDetails: { + message: JSON.stringify(message), + type: "JobFailed", + externalExecutionId: context.invokeid, + }, + }; + codepipeline.putJobFailureResult(params, function (err, data) { + context.fail(message); + }); + }; + + // Validate the URL passed in UserParameters + if (!url || url.indexOf("http://") === -1) { + putJobFailure( + "The UserParameters field must contain a valid URL address to test, including http:// or https://", + ); + return; + } + + // Helper function to make a HTTP GET request to the page. + // The helper will test the response and succeed or fail the job accordingly + var getPage = function (url, callback) { + var pageObject = { + body: "", + statusCode: 0, + contains: function (search) { + return this.body.indexOf(search) > -1; + }, + }; + http + .get(url, function (response) { + pageObject.body = ""; + pageObject.statusCode = response.statusCode; + + response.on("data", function (chunk) { + pageObject.body += chunk; + }); + + response.on("end", function () { + callback(pageObject); + }); + + response.resume(); + }) + .on("error", function (error) { + // Fail the job if our request failed + putJobFailure(error); + }); + }; + + getPage(url, function (returnedPage) { + try { + // Check if the HTTP response has a 200 status + assert(returnedPage.statusCode === 200); + // Check if the page contains the text "Congratulations" + // You can change this to check for different text, or add other tests as required + assert(returnedPage.contains("Congratulations")); + + // Succeed the job + putJobSuccess("Tests passed."); + } catch (ex) { + // If any of the assertions failed then fail the job + putJobFailure(ex); + } + }); +}; + +// snippet-end:[codepipeline.javascript.MyCodePipelineFunction.complete] diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/get-items-handler.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/get-items-handler.ts index 7ae6c5c0477..9336200494e 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/get-items-handler.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/get-items-handler.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { Handler } from "src/types/handler.js"; import { command as getAllItemsCommand } from "../statement-commands/get-all-items.js"; import { command as getArchivedItemsCommand } from "../statement-commands/get-archived-items.js"; @@ -18,7 +20,7 @@ const getItemsHandler: Handler = { }; const response = await rdsDataClient.send<{ records: DBRecords }>( - commands[archived] || getAllItemsCommand + commands[archived] || getAllItemsCommand, ); res.send(response.records.map(parseItem)); diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-handler.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-handler.ts index a7248a2c7c6..31a062096a5 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-handler.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-handler.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { v4 as uuidv4 } from "uuid"; import { Handler } from "src/types/handler.js"; import { Item } from "src/types/item.js"; @@ -12,7 +14,7 @@ const postItemsHandler: Handler = { const { description, guide, status, name }: Item = req.body; const command = buildStatementCommand( "insert into items (iditem, description, guide, status, username, archived)\n" + - `values ("${uuidv4()}", "${description}", "${guide}", "${status}", "${name}", 0)` + `values ("${uuidv4()}", "${description}", "${guide}", "${status}", "${name}", 0)`, ); await rdsDataClient.send(command); diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-report-handler.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-report-handler.ts index e64deae3174..d16aa15faac 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-report-handler.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-report-handler.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { SendRawEmailCommand } from "@aws-sdk/client-ses"; import { createMimeMessage, TextFormat } from "mimetext"; import { format } from "prettier"; @@ -47,7 +49,7 @@ const csvToHtmlTable = (csv: string) => { const buildSendRawEmailCommand = ( emailAddress: string, - reportData: { csv: string; date: string; itemCount: number } + reportData: { csv: string; date: string; itemCount: number }, ) => { const msg = createMimeMessage(); msg.setSender({ name: emailAddress.split("@")[0], addr: emailAddress }); @@ -56,13 +58,13 @@ const buildSendRawEmailCommand = ( msg.setMessage( "text/html", `

Item Report

- ${csvToHtmlTable(reportData.csv)}` + ${csvToHtmlTable(reportData.csv)}`, ); msg.setMessage("text/plain", "Report"); msg.setAttachment( "report.csv", "text/csv" as TextFormat, - Buffer.from(reportData.csv).toString("base64") + Buffer.from(reportData.csv).toString("base64"), ); return new SendRawEmailCommand({ @@ -77,7 +79,7 @@ const postItemsReportHandler: Handler = { ({ rdsDataClient, sesClient }) => async (req, res) => { const { records } = await rdsDataClient.send<{ records: DBRecords }>( - getActiveItemsCommand + getActiveItemsCommand, ); const date = new Date().toLocaleString("en-US"); const csv = makeCsv(records); diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/put-items-archive-handler.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/put-items-archive-handler.ts index 6fce1916336..206b4fbd776 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/put-items-archive-handler.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/put-items-archive-handler.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import type { Handler } from "src/types/handler.js"; import { buildStatementCommand } from "../statement-commands/command-helper.js"; @@ -10,7 +12,7 @@ const putItemsArchiveHandler: Handler = { const { itemId } = req.params; const command = buildStatementCommand( - "update items\n" + "set archived = 1\n" + `where iditem = "${itemId}"` + "update items\n" + "set archived = 1\n" + `where iditem = "${itemId}"`, ); await rdsDataClient.send(command); diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/index.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/index.ts index 5aa4e000970..403349e830d 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/index.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/index.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import express from "express"; import cors from "cors"; import { rdsDataClient, sesClient } from "./client.js"; @@ -22,14 +24,14 @@ exp.get("/api/items", getItemsHandler.withClient({ rdsDataClient })); exp.post( "/api/items\\:report", - postItemsReportHandler.withClient({ rdsDataClient, sesClient }) + postItemsReportHandler.withClient({ rdsDataClient, sesClient }), ); exp.post("/api/items", postItemsHandler.withClient({ rdsDataClient })); exp.put( "/api/items/:itemId\\:archive", - putItemsArchiveHandler.withClient({ rdsDataClient }) + putItemsArchiveHandler.withClient({ rdsDataClient }), ); exp.listen(port, () => { diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/middleware/validate-db.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/middleware/validate-db.ts index 7737396b3d4..5054d4ce345 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/middleware/validate-db.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/middleware/validate-db.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { RequestHandler } from "express"; import { command as createTableCommand } from "../statement-commands/create-table.js"; import { command as getAllItemsCommand } from "../statement-commands/get-all-items.js"; diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/types/sendable.d.ts b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/types/sendable.d.ts index 810c0ac275b..052afcfd867 100644 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/src/types/sendable.d.ts +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/src/types/sendable.d.ts @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + declare interface Sendable { - send: (command: any) => Promise -} \ No newline at end of file + send: (command: any) => Promise; +} diff --git a/javascriptv3/example_code/cross-services/aurora-serverless-app/watch.js b/javascriptv3/example_code/cross-services/aurora-serverless-app/watch.js index ed386c72bba..cae79aa5de1 100755 --- a/javascriptv3/example_code/cross-services/aurora-serverless-app/watch.js +++ b/javascriptv3/example_code/cross-services/aurora-serverless-app/watch.js @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { spawn } from "node:child_process"; const format = (data) => data.toString().trim(); @@ -15,7 +17,9 @@ const loadApp = (app) => { app.kill(); } - const newApp = spawn("node", ["./build/cross-services/aurora-serverless-app/src/index.js"]); + const newApp = spawn("node", [ + "./build/cross-services/aurora-serverless-app/src/index.js", + ]); newApp.stdout.on("data", (data) => appLogger(format(data))); newApp.stderr.on("data", (data) => appLogger(format(data))); return newApp; diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/lambda-function-setup.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/lambda-function-setup.js index 52bc3c865e8..45ede5433e5 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/lambda-function-setup.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/lambda-function-setup.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -24,10 +25,8 @@ node lambda-function-setup.js // snippet-start:[lambda.JavaScript.general-examples-dynamodb-lambda.LambdaFunctionSetUpV3] -const { - CreateFunctionCommand, -} = require("@aws-sdk/client-lambda"); -const {lambdaClient} = require ( "../libs/lambdaClient.js" ); +const { CreateFunctionCommand } = require("@aws-sdk/client-lambda"); +const { lambdaClient } = require("../libs/lambdaClient.js"); const params = { Code: { @@ -39,8 +38,8 @@ const params = { Role: "IAM_ROLE_ARN", // IAM_ROLE_ARN; e.g., arn:aws:iam::650138640062:role/v3-lambda-tutorial-lambda-role Runtime: "nodejs12.x", Description: - "Scans a DynamoDB table of employee details and using Amazon Simple Notification Service (Amazon SNS) to " + - "send employees an email on the anniversary of their start-date.", + "Scans a DynamoDB table of employee details and using Amazon Simple Notification Service (Amazon SNS) to " + + "send employees an email on the anniversary of their start-date.", }; const run = async () => { @@ -53,5 +52,3 @@ const run = async () => { }; run(); // snippet-end:[lambda.JavaScript.general-examples-dynamodb-lambda.LambdaFunctionSetUpV3] - - diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/populate-table.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/populate-table.js index ce64a33652a..7f10ac6e4d1 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/populate-table.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/helper-functions/populate-table.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -18,10 +19,8 @@ node populate-table.js */ // snippet-start:[lambda.JavaScript.general-examples-dynamodb-lambda.CreateTableV3] // Load the required Amazon DynamoDB client and commands. -const { - BatchWriteItemCommand -} = require("@aws-sdk/client-dynamodb"); -const {dynamoClient} = require ( "../libs/dynamoClient.js" ); +const { BatchWriteItemCommand } = require("@aws-sdk/client-dynamodb"); +const { dynamoClient } = require("../libs/dynamoClient.js"); // Set the parameters. const params = { diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/dynamoClient.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/dynamoClient.js index ad949e49859..9189f43555b 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/dynamoClient.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/dynamoClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -15,12 +16,10 @@ Inputs (replace in code): */ // snippet-start:[dynamodb.JavaScript.apigateway.createclientv3] -const { DynamoDBClient } = require ( "@aws-sdk/client-dynamodb" ); +const { DynamoDBClient } = require("@aws-sdk/client-dynamodb"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon DynamoDB service client object. const dynamoClient = new DynamoDBClient({ region: REGION }); module.exports = { dynamoClient }; // snippet-end:[dynamodb.JavaScript.apigateway.createclientv3] - - diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/lambdaClient.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/lambdaClient.js index 8fc92ce0092..2727f626079 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/lambdaClient.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/lambdaClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -14,12 +15,10 @@ Inputs (replace in code): */ // snippet-start:[lambda.JavaScript.apigateway.createclientv3] -const { LambdaClient } = require ( "@aws-sdk/client-lambda" ); +const { LambdaClient } = require("@aws-sdk/client-lambda"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon Lambda service client object. const lambdaClient = new LambdaClient({ region: REGION }); module.exports = { lambdaClient }; // snippet-end:[lambda.JavaScript.apigateway.createclientv3] - - diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/snsClient.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/snsClient.js index c448a4e9619..8efd18ba006 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/snsClient.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/libs/snsClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -14,12 +15,10 @@ Inputs (replace in code): */ // snippet-start:[sns.JavaScript.apigateway.createclientv3] -const { SNSClient } = require ( "@aws-sdk/client-sns" ); +const { SNSClient } = require("@aws-sdk/client-sns"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon SNS service client object. const snsClient = new SNSClient({ region: REGION }); module.exports = { snsClient }; // snippet-end:[sns.JavaScript.apigateway.createclientv3] - - diff --git a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/mylamdbafunction.js b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/mylamdbafunction.js index 5a1ded4f52c..d45547335a3 100644 --- a/javascriptv3/example_code/cross-services/lambda-api-gateway/src/mylamdbafunction.js +++ b/javascriptv3/example_code/cross-services/lambda-api-gateway/src/mylamdbafunction.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -21,8 +22,8 @@ Inputs (replace in code): "use strict"; const { ScanCommand } = require("@aws-sdk/client-dynamodb"); const { PublishCommand } = require("@aws-sdk/client-sns"); -const {snsClient} = require ( "./libs/snsClient" ); -const {dynamoClient} = require ( "./libs/dynamoClient" ); +const { snsClient } = require("./libs/snsClient"); +const { dynamoClient } = require("./libs/dynamoClient"); // Get today's date. const today = new Date(); @@ -63,9 +64,9 @@ exports.handler = async () => { const textParams = { PhoneNumber: element.phone.N, Message: - "Hi " + - element.firstName.S + - "; congratulations on your work anniversary!", + "Hi " + + element.firstName.S + + "; congratulations on your work anniversary!", }; // Send message using Amazon SNS. sendText(textParams); @@ -76,5 +77,3 @@ exports.handler = async () => { }; // snippet-end:[lambda.JavaScript.general-examples-dynamodb-lambda.scanAndPublishV3.handler] // snippet-end:[lambda.JavaScript.general-examples-dynamodb-lambda.scanAndPublishV3] - - diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/lambda-function-setup.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/lambda-function-setup.js index 30526b1ac20..8a8eabc335b 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/lambda-function-setup.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/lambda-function-setup.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -24,10 +25,8 @@ ts-node lambda-function-setup.ts // snippet-start:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.LambdaFunctionSetUpV3] -const { - CreateFunctionCommand, -} = require("@aws-sdk/client-lambda"); -const {lambdaClient} = require ( "../libs/lambdaClient.js" ); +const { CreateFunctionCommand } = require("@aws-sdk/client-lambda"); +const { lambdaClient } = require("../libs/lambdaClient.js"); const params = { Code: { @@ -39,8 +38,8 @@ const params = { Role: "IAM_ROLE_ARN", // IAM_ROLE_ARN; e.g., arn:aws:iam::650138640062:role/v3-lambda-tutorial-lambda-role Runtime: "nodejs12.x", Description: - "Scans a DynamoDB table of employee details and using Amazon Simple Notification Service (Amazon SNS) to " + - "send employees an email on the anniversary of their start-date.", + "Scans a DynamoDB table of employee details and using Amazon Simple Notification Service (Amazon SNS) to " + + "send employees an email on the anniversary of their start-date.", }; const run = async () => { diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/populate-table.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/populate-table.js index 28dfb85536d..59bf646a1e2 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/populate-table.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/helper-functions/populate-table.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -20,10 +21,8 @@ ts-node populate-table.t s */ // snippet-start:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.CreateTableV3] // Load the required Amazon DynamoDB client and commands. -const { - BatchWriteItemCommand -} = require("@aws-sdk/client-dynamodb"); -const {dynamoClient} = require ( "../libs/dynamoClient.js" ); +const { BatchWriteItemCommand } = require("@aws-sdk/client-dynamodb"); +const { dynamoClient } = require("../libs/dynamoClient.js"); // Set the parameters. const params = { diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/dynamoClient.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/dynamoClient.js index 3126bb4d9c3..8dc0760519b 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/dynamoClient.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/dynamoClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -15,12 +16,10 @@ Inputs (replace in code): */ // snippet-start:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.dynamoClient] -const { DynamoDBClient } = require ( "@aws-sdk/client-dynamodb" ); +const { DynamoDBClient } = require("@aws-sdk/client-dynamodb"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon DynamoDB service client object. const dynamoClient = new DynamoDBClient({ region: REGION }); module.exports = { dynamoClient }; // snippet-end:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.dynamoClient] - - diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/lambdaClient.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/lambdaClient.js index d54088adc99..932ab94c940 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/lambdaClient.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/lambdaClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -14,12 +15,10 @@ Inputs (replace in code): */ // snippet-start:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.lambdaClient] -const { LambdaClient } = require ( "@aws-sdk/client-lambda" ); +const { LambdaClient } = require("@aws-sdk/client-lambda"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon Lambda service client object. const lambdaClient = new LambdaClient({ region: REGION }); module.exports = { lambdaClient }; // snippet-end:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.lambdaClient] - - diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/snsClient.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/snsClient.js index 964a74cdc65..f349fef5a61 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/snsClient.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/libs/snsClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -14,12 +15,10 @@ Inputs (replace in code): */ // snippet-start:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.sns] -const { SNSClient } = require ( "@aws-sdk/client-sns" ); +const { SNSClient } = require("@aws-sdk/client-sns"); // Set the AWS Region. const REGION = "REGION"; //e.g. "us-east-1" // Create an Amazon SNS service client object. const snsClient = new SNSClient({ region: REGION }); module.exports = { snsClient }; // snippet-end:[lambda.JavaScript.cross-service-examples.lambda-scheduled-events.sns] - - diff --git a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/mylamdbafunction.js b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/mylamdbafunction.js index 271e4148b52..179dd342162 100644 --- a/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/mylamdbafunction.js +++ b/javascriptv3/example_code/cross-services/lambda-scheduled-events/src/mylamdbafunction.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), diff --git a/javascriptv3/example_code/cross-services/lex-bot/src/index.js b/javascriptv3/example_code/cross-services/lex-bot/src/index.js index 03d03d6a4df..dfab7ca5d22 100644 --- a/javascriptv3/example_code/cross-services/lex-bot/src/index.js +++ b/javascriptv3/example_code/cross-services/lex-bot/src/index.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), @@ -85,11 +86,11 @@ const createResponse = async () => { }; try { const data = await comprehendClient.send( - new DetectDominantLanguageCommand(comprehendParams) + new DetectDominantLanguageCommand(comprehendParams), ); console.log( "Success. The language code is: ", - data.Languages[0].LanguageCode + data.Languages[0].LanguageCode, ); const translateParams = { SourceLanguageCode: data.Languages[0].LanguageCode, @@ -98,7 +99,7 @@ const createResponse = async () => { }; try { const data = await translateClient.send( - new TranslateTextCommand(translateParams) + new TranslateTextCommand(translateParams), ); console.log("Success. Translated text: ", data.TranslatedText); const lexParams = { diff --git a/javascriptv3/example_code/cross-services/textract-react/src/App.js b/javascriptv3/example_code/cross-services/textract-react/src/App.js index 54fe94a6c30..697206e1408 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/App.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/App.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React, { useState, useEffect } from "react"; import { ImageLoader } from "./ImageLoader"; @@ -32,7 +33,7 @@ function App(props) { Id: polyId, BlockType: blockType, Geometry: geometry, - }) + }), ); } else { setShownPolygons(shownPolygons.filter((poly) => poly.Id !== polyId)); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/ExplorerCard.js b/javascriptv3/example_code/cross-services/textract-react/src/ExplorerCard.js index 9a621818e25..4e817f5ea8e 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/ExplorerCard.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/ExplorerCard.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React, { useRef } from "react"; import { ExplorerTree } from "./ExplorerTree"; diff --git a/javascriptv3/example_code/cross-services/textract-react/src/ExplorerTree.js b/javascriptv3/example_code/cross-services/textract-react/src/ExplorerTree.js index 4809e829c29..ca0cf27d687 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/ExplorerTree.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/ExplorerTree.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React from "react"; import { ColorMap, FilterMap } from "./Utils"; @@ -32,7 +33,7 @@ const ExplorerNode = (props) => { props.Id, props.BlockType, props.Geometry, - event.target.checked + event.target.checked, ) } /> diff --git a/javascriptv3/example_code/cross-services/textract-react/src/ExtractButtons.js b/javascriptv3/example_code/cross-services/textract-react/src/ExtractButtons.js index 40897cb7502..2d8993289e4 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/ExtractButtons.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/ExtractButtons.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React, { useState } from "react"; diff --git a/javascriptv3/example_code/cross-services/textract-react/src/ImageDisplay.js b/javascriptv3/example_code/cross-services/textract-react/src/ImageDisplay.js index 9d757978fd5..c09111995c0 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/ImageDisplay.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/ImageDisplay.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React, { useRef, useLayoutEffect } from "react"; import { ColorMap } from "./Utils"; @@ -41,12 +42,12 @@ export const ImageDisplay = (props) => { context.beginPath(); context.moveTo( canvas.width * points[0].X, - canvas.height * points[0].Y + canvas.height * points[0].Y, ); points .slice(1) .forEach((point) => - context.lineTo(canvas.width * point.X, canvas.height * point.Y) + context.lineTo(canvas.width * point.X, canvas.height * point.Y), ); context.closePath(); context.stroke(); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/ImageLoader.js b/javascriptv3/example_code/cross-services/textract-react/src/ImageLoader.js index abfa8223ac0..cb68eeb0b43 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/ImageLoader.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/ImageLoader.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React, { useState } from "react"; diff --git a/javascriptv3/example_code/cross-services/textract-react/src/LoginCard.js b/javascriptv3/example_code/cross-services/textract-react/src/LoginCard.js index 433c5115f3e..a4fc85ccfe8 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/LoginCard.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/LoginCard.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import React from "react"; diff --git a/javascriptv3/example_code/cross-services/textract-react/src/TextractModel.js b/javascriptv3/example_code/cross-services/textract-react/src/TextractModel.js index 9b2b03424cc..ba9c66d6b4e 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/TextractModel.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/TextractModel.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ import { DetectDocumentTextCommand, @@ -118,7 +119,7 @@ export default class TextractModel { console.log(`Loading from ${bucketName}:${objectKey}`); try { const resp = await this.s3.send( - new GetObjectCommand({ Bucket: bucketName, Key: objectKey }) + new GetObjectCommand({ Bucket: bucketName, Key: objectKey }), ); const str_data = await this._readStream(resp.Body); this.imageData = { @@ -217,12 +218,12 @@ export default class TextractModel { console.log(`JobId: ${jobId}`); let waitTime = 0; - const getJob = async () => { + const getJob = async () => { const { Messages } = await this.sqs.send( new ReceiveMessageCommand({ QueueUrl: this.queueUrl, MaxNumberOfMessages: 1, - }) + }), ); if (Messages) { console.log(`Message[0]: ${Messages[0].Body}`); @@ -230,7 +231,7 @@ export default class TextractModel { new DeleteMessageCommand({ QueueUrl: this.queueUrl, ReceiptHandle: Messages[0].ReceiptHandle, - }) + }), ); if ( JSON.parse(JSON.parse(Messages[0].Body).Message).Status === @@ -256,7 +257,7 @@ export default class TextractModel { console.log(`Waited ${waitTime / 1000} seconds. No messages yet.`); setTimeout(getJob, tick); } - } + }; await getJob(jobId); } diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/App.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/App.test.js index 53ec2ba8de0..5c5f0660955 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/App.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/App.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the App component. @@ -24,16 +25,16 @@ describe("app functions", () => { render(); expect(screen.getByText(/Image location/i)).toBeInTheDocument(); expect(screen.getByRole("textbox", { name: /Bucket/i })).toHaveValue( - Config.DefaultBucketName + Config.DefaultBucketName, ); expect(screen.getByRole("textbox", { name: /Image name/i })).toHaveValue( - Config.DefaultImageName + Config.DefaultImageName, ); expect(screen.getByAltText("Extraction source")).toBeInTheDocument(); expect(screen.getByRole("toolbar")).toBeInTheDocument(); expect(screen.getByText(/Data explorer/i)).toBeInTheDocument(); expect( - screen.queryByText(new RegExp(Config.DefaultImageName, "i")) + screen.queryByText(new RegExp(Config.DefaultImageName, "i")), ).toBeNull(); }); @@ -47,7 +48,7 @@ describe("app functions", () => { await userEvent.click(screen.getByRole("button", { name: /Load/i })); expect(model.loadImage).toHaveBeenCalledWith( Config.DefaultBucketName, - Config.DefaultImageName + Config.DefaultImageName, ); }); @@ -62,7 +63,7 @@ describe("app functions", () => { model.extraction = TestExtractDocument; render(); expect( - screen.getByText(new RegExp(TestExtractDocument.Name, "i")) + screen.getByText(new RegExp(TestExtractDocument.Name, "i")), ).toBeInTheDocument(); expect(screen.getByRole("checkbox", { name: /PAGE/i })).toBeInTheDocument(); }); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerCard.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerCard.test.js index a155022ee42..78df5decfb0 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerCard.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerCard.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the ExplorerCard component. @@ -14,7 +15,7 @@ describe("extraction props", () => { render(); expect(screen.queryByText(testHeader)).toBeInTheDocument(); expect( - screen.queryByText(/Extracted data is shown here/i) + screen.queryByText(/Extracted data is shown here/i), ).toBeInTheDocument(); expect(screen.queryByText(/Showing extracted/i)).toBeNull(); expect(screen.queryByText(/Click an element/i)).toBeNull(); @@ -25,8 +26,8 @@ describe("extraction props", () => { render(); expect( screen.queryByText( - new RegExp(`Showing extracted ${testExtraction.ExtractType} data`, "i") - ) + new RegExp(`Showing extracted ${testExtraction.ExtractType} data`, "i"), + ), ).toBeInTheDocument(); expect(screen.queryByText(/Click an element/i)).toBeInTheDocument(); }); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerTree.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerTree.test.js index 37bbb258be5..6190def980e 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerTree.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExplorerTree.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the ExplorerTree component. @@ -24,11 +25,11 @@ describe("extraction props", () => { test("render with test extraction", () => { render( - + , ); expect(screen.getByRole("checkbox", { name: "PAGE" })).not.toBeChecked(); expect( - screen.getByRole("checkbox", { name: "LINE LINE 1" }) + screen.getByRole("checkbox", { name: "LINE LINE 1" }), ).not.toBeChecked(); }); @@ -45,7 +46,7 @@ describe("extraction props", () => { + />, ); expect(screen.getByRole("checkbox", { name: "PAGE" })).toBeChecked(); expect(screen.getByRole("checkbox", { name: "LINE LINE 1" })).toBeChecked(); @@ -58,14 +59,14 @@ describe("extraction props", () => { extraction={TestExtractDocument} togglePolygon={toggle} shownPolygons={[]} - /> + />, ); await userEvent.click(screen.getByRole("checkbox", { name: "PAGE" })); expect(toggle).toHaveBeenCalledWith( "page1", "PAGE", { test: "test geometry" }, - true + true, ); }); }); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExtractButtons.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExtractButtons.test.js index bb184dc1dfb..1fe6607af7d 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExtractButtons.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ExtractButtons.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the ExtractButtons component. diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageDisplay.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageDisplay.test.js index aea10ef9b2c..3e1552b7307 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageDisplay.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageDisplay.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the ImageDisplay component. @@ -16,7 +17,7 @@ describe("imageData props", () => { test("render with test image", () => { render( - + , ); expect(screen.getByRole("img")).toBeInTheDocument(); }); @@ -36,7 +37,7 @@ describe("imageData props", () => { }, }, ]} - /> + />, ); }); }); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageLoader.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageLoader.test.js index 6c40127ed17..7f72e3e51f7 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageLoader.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/ImageLoader.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the ImageLoader component. @@ -21,7 +22,7 @@ describe("rendering", () => { const image = "test-image"; render(); expect(screen.getByRole("textbox", { name: /Bucket/i })).toHaveValue( - bucket + bucket, ); expect(screen.getByRole("textbox", { name: /Image/i })).toHaveValue(image); }); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/LoginCard.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/LoginCard.test.js index 3c4513fa6a8..faa3cf8f8e7 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/LoginCard.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/LoginCard.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the LoginCard component. diff --git a/javascriptv3/example_code/cross-services/textract-react/src/__test__/TextractModel.test.js b/javascriptv3/example_code/cross-services/textract-react/src/__test__/TextractModel.test.js index fff24f1bfd6..e4e940fbdb1 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/__test__/TextractModel.test.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/__test__/TextractModel.test.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ // Unit tests for the TextractModel component. @@ -215,7 +216,7 @@ describe("extractDocument", () => { expect(sqs.send).toHaveBeenCalledTimes(2); expect(tm.extraction).toEqual(TestExtractDocument); expect(tm.inform).toHaveBeenCalled(); - } + }, ); test("asynchronous form type calls analyze command", async () => { diff --git a/javascriptv3/example_code/cross-services/textract-react/src/index.js b/javascriptv3/example_code/cross-services/textract-react/src/index.js index 4833211076a..1e5b554356d 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/index.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/index.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /** * The main entry point for the React application. @@ -42,7 +43,7 @@ const render = () => , - document.getElementById("root") + document.getElementById("root"), ); model.subscribe(render); diff --git a/javascriptv3/example_code/cross-services/textract-react/src/setupTests.js b/javascriptv3/example_code/cross-services/textract-react/src/setupTests.js index d0de870dc55..17508e6909c 100644 --- a/javascriptv3/example_code/cross-services/textract-react/src/setupTests.js +++ b/javascriptv3/example_code/cross-services/textract-react/src/setupTests.js @@ -1 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import "@testing-library/jest-dom"; diff --git a/javascriptv3/example_code/glacier/src/createVault.ts b/javascriptv3/example_code/glacier/src/createVault.ts index 3620544065d..a3b1cd98ca6 100644 --- a/javascriptv3/example_code/glacier/src/createVault.ts +++ b/javascriptv3/example_code/glacier/src/createVault.ts @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), diff --git a/javascriptv3/example_code/glacier/src/libs/glacierClient.js b/javascriptv3/example_code/glacier/src/libs/glacierClient.js index 806e50016b4..822bb19be21 100644 --- a/javascriptv3/example_code/glacier/src/libs/glacierClient.js +++ b/javascriptv3/example_code/glacier/src/libs/glacierClient.js @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), diff --git a/javascriptv3/example_code/glacier/src/uploadArchive.ts b/javascriptv3/example_code/glacier/src/uploadArchive.ts index ca95bb884bf..f9ca2ddb843 100644 --- a/javascriptv3/example_code/glacier/src/uploadArchive.ts +++ b/javascriptv3/example_code/glacier/src/uploadArchive.ts @@ -1,5 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ /* ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 3 (v3), diff --git a/javascriptv3/example_code/s3/scenarios/object-locking/repl.steps.unit.test.js b/javascriptv3/example_code/s3/scenarios/object-locking/repl.steps.unit.test.js index 46c6fab66d9..4c031f7fd93 100644 --- a/javascriptv3/example_code/s3/scenarios/object-locking/repl.steps.unit.test.js +++ b/javascriptv3/example_code/s3/scenarios/object-locking/repl.steps.unit.test.js @@ -1,5 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +/* eslint-disable -- This file existed pre-eslint configuration. Fix the next time the file is touched. */ + import { describe, it, expect, vi, beforeEach } from "vitest"; import * as Scenarios from "@aws-doc-sdk-examples/lib/scenario/index.js"; import { choices, replAction, replInput } from "./repl.steps.js"; From b151bed70a20091f24712fb3582aef01a9d7a346 Mon Sep 17 00:00:00 2001 From: Corey Pyle Date: Mon, 23 Sep 2024 11:00:51 -0400 Subject: [PATCH 2/2] JavaScript (v3): Lint - Run writeme. --- javascriptv3/example_code/glacier/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascriptv3/example_code/glacier/README.md b/javascriptv3/example_code/glacier/README.md index e9bf82357d0..859e715b5ef 100644 --- a/javascriptv3/example_code/glacier/README.md +++ b/javascriptv3/example_code/glacier/README.md @@ -33,8 +33,8 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `javas Code excerpts that show you how to call individual service functions. -- [CreateVault](src/libs/glacierClient.js#L15) -- [UploadArchive](src/libs/glacierClient.js#L15) +- [CreateVault](src/libs/glacierClient.js#L16) +- [UploadArchive](src/libs/glacierClient.js#L16)