From dadd0ce694bed93edec5e36a691c6f0e7993b61a Mon Sep 17 00:00:00 2001 From: Samantha Piatt Date: Thu, 10 Aug 2023 17:13:35 -0400 Subject: [PATCH] Update linting. --- .../src/parts/environments-builtin/EnvironmentDetailPage.js | 3 +-- .../packages/base-raas-ui/src/parts/users/DragDrop.js | 2 +- .../packages/base-raas-ui/src/parts/users/UserOnboarding.js | 2 +- .../packages/base-raas-services/.eslintrc.json | 3 ++- .../lib/__tests__/cfn-template-service.test.js | 2 +- .../base-raas-services/lib/aws-accounts/aws-cfn-service.js | 2 +- .../lib/data-source/data-source-registration-service.js | 2 +- .../lib/environment/built-in/environment-url-service.js | 2 +- .../__tests__/environment-sc-connection-service.test.js | 2 +- .../service-catalog/environment-sc-connection-service.js | 6 +++--- .../lib/storage-gateway/storage-gateway-service.js | 2 +- .../packages/serverless-backend-tools/lib/utils.js | 2 +- .../addon-base/packages/serverless-go-build-tools/index.js | 4 ++-- .../services/lib/db-password/db-password-service.js | 2 +- addons/addon-base/packages/services/lib/helpers/utils.js | 2 +- addons/addon-base/packages/services/lib/s3-service.js | 2 +- addons/addon-custom/packages/main/src/extend/withAuth.js | 2 ++ .../key-pair-mgmt-services/lib/key-pair/key-pair-service.js | 2 +- .../__test__/appstream-egress-enabled/route-tables.test.js | 1 + .../appstream-egress-enabled/security-groups.test.js | 1 + main/infrastructure-tests/jest.config.js | 2 +- main/integration-tests/.eslintrc.json | 3 ++- .../__test__/api-tests/common/budgets/create-budget.test.js | 1 + main/integration-tests/jest.config.js | 2 +- main/integration-tests/support/aws/services/cognito-idp.js | 2 +- main/integration-tests/support/aws/services/s3.js | 2 +- 26 files changed, 32 insertions(+), 26 deletions(-) diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-builtin/EnvironmentDetailPage.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-builtin/EnvironmentDetailPage.js index acaf22c750..22edaef470 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-builtin/EnvironmentDetailPage.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-builtin/EnvironmentDetailPage.js @@ -13,6 +13,7 @@ * permissions and limitations under the License. */ +import crypto from 'crypto'; import _ from 'lodash'; import React from 'react'; import { observer, inject, Observer } from 'mobx-react'; @@ -36,8 +37,6 @@ import { } from 'semantic-ui-react'; import { CopyToClipboard } from 'react-copy-to-clipboard'; -import crypto from 'crypto'; - import { gotoFn } from '@aws-ee/base-ui/dist/helpers/routing'; import { swallowError } from '@aws-ee/base-ui/dist/helpers/utils'; import { displayError } from '@aws-ee/base-ui/dist/helpers/notification'; diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/DragDrop.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/DragDrop.js index 7ae090612f..4b0c6b82b6 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/DragDrop.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/DragDrop.js @@ -216,7 +216,7 @@ class DragDrop extends Component { return (
- {} + {isFileTooLarge &&
File is too large.
}
); diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/UserOnboarding.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/UserOnboarding.js index 0b933b0a19..0a0fb46b8e 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/UserOnboarding.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/users/UserOnboarding.js @@ -592,7 +592,7 @@ class UserOnboarding extends React.Component { ) : (

Drag and drop a credentials.csv files here, or click to select a file

)} - {} + {isFileTooLarge &&
File is too large.
} ); diff --git a/addons/addon-base-raas/packages/base-raas-services/.eslintrc.json b/addons/addon-base-raas/packages/base-raas-services/.eslintrc.json index a9e56eda24..86b484c6a8 100644 --- a/addons/addon-base-raas/packages/base-raas-services/.eslintrc.json +++ b/addons/addon-base-raas/packages/base-raas-services/.eslintrc.json @@ -17,7 +17,8 @@ "no-underscore-dangle": 0, "no-param-reassign": 0, "class-methods-use-this": 0, - "no-use-before-define": 0 + "no-use-before-define": 0, + "no-console": 0 }, "env": { "jest/globals": true diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/__tests__/cfn-template-service.test.js b/addons/addon-base-raas/packages/base-raas-services/lib/__tests__/cfn-template-service.test.js index 420ee636cf..4433e74d8a 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/__tests__/cfn-template-service.test.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/__tests__/cfn-template-service.test.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const ServicesContainer = require('@aws-ee/base-services-container/lib/services-container'); const fs = require('fs'); +const ServicesContainer = require('@aws-ee/base-services-container/lib/services-container'); const SettingsServiceMock = require('@aws-ee/base-services/lib/settings/env-settings-service'); const { yamlParse } = require('yaml-cfn'); diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/aws-accounts/aws-cfn-service.js b/addons/addon-base-raas/packages/base-raas-services/lib/aws-accounts/aws-cfn-service.js index ec918ac502..34f334b78c 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/aws-accounts/aws-cfn-service.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/aws-accounts/aws-cfn-service.js @@ -13,9 +13,9 @@ * permissions and limitations under the License. */ +const crypto = require('crypto'); const _ = require('lodash'); const Service = require('@aws-ee/base-services-container/lib/service'); -const crypto = require('crypto'); const { allowIfActive, allowIfAdmin } = require('@aws-ee/base-services/lib/authorization/authorization-utils'); const { processInBatches } = require('@aws-ee/base-services/lib/helpers/utils'); diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/data-source/data-source-registration-service.js b/addons/addon-base-raas/packages/base-raas-services/lib/data-source/data-source-registration-service.js index 27f220aff6..666cc9598c 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/data-source/data-source-registration-service.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/data-source/data-source-registration-service.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const crypto = require('crypto'); +const _ = require('lodash'); const Service = require('@aws-ee/base-services-container/lib/service'); const { CfnTemplate } = require('../helpers/cfn-template'); diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/environment/built-in/environment-url-service.js b/addons/addon-base-raas/packages/base-raas-services/lib/environment/built-in/environment-url-service.js index bd2f9410b4..564461048e 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/environment/built-in/environment-url-service.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/environment/built-in/environment-url-service.js @@ -14,8 +14,8 @@ */ const crypto = require('crypto'); -const NodeRSA = require('node-rsa'); const querystring = require('querystring'); +const NodeRSA = require('node-rsa'); const request = require('request-promise-native'); const Service = require('@aws-ee/base-services-container/lib/service'); diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/__tests__/environment-sc-connection-service.test.js b/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/__tests__/environment-sc-connection-service.test.js index 151478e8aa..b91357d50d 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/__tests__/environment-sc-connection-service.test.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/__tests__/environment-sc-connection-service.test.js @@ -13,10 +13,10 @@ * permissions and limitations under the License. */ +const crypto = require('crypto'); const ServicesContainer = require('@aws-ee/base-services-container/lib/services-container'); const JsonSchemaValidationService = require('@aws-ee/base-services/lib/json-schema-validation-service'); const Logger = require('@aws-ee/base-services/lib/logger/logger-service'); -const crypto = require('crypto'); // Mocked dependencies const AwsService = require('@aws-ee/base-services/lib/aws/aws-service'); diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/environment-sc-connection-service.js b/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/environment-sc-connection-service.js index 0d1e491031..cde853daee 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/environment-sc-connection-service.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/environment/service-catalog/environment-sc-connection-service.js @@ -13,11 +13,11 @@ * permissions and limitations under the License. */ +const crypto = require('crypto'); +const querystring = require('querystring'); const _ = require('lodash'); let fetch = require('node-fetch'); -const crypto = require('crypto'); const NodeRSA = require('node-rsa'); -const querystring = require('querystring'); const Service = require('@aws-ee/base-services-container/lib/service'); const { retry, linearInterval } = require('@aws-ee/base-services/lib/helpers/utils'); const sshConnectionInfoSchema = require('../../schema/ssh-connection-info-sc.json'); @@ -438,7 +438,7 @@ class EnvironmentScConnectionService extends Service { async updateRoleToIncludeCurrentIP(iam, connection, currentPolicyResponse) { // Construct new statement which will allow the caller IP address permission to generate the presigned URL - const currentIpAddress = await fetch('http://checkip.amazonaws.com/').then(function(res) { + const currentIpAddress = await fetch('http://checkip.amazonaws.com/').then(function getText(res) { return res.text(); }); const newStatement = { diff --git a/addons/addon-base-raas/packages/base-raas-services/lib/storage-gateway/storage-gateway-service.js b/addons/addon-base-raas/packages/base-raas-services/lib/storage-gateway/storage-gateway-service.js index 782fffeedd..2065617337 100644 --- a/addons/addon-base-raas/packages/base-raas-services/lib/storage-gateway/storage-gateway-service.js +++ b/addons/addon-base-raas/packages/base-raas-services/lib/storage-gateway/storage-gateway-service.js @@ -261,7 +261,7 @@ class StorageGatewayService extends Service { } async fetchIP() { - const ipAddressResult = await fetch('http://httpbin.org/get').then(function(res) { + const ipAddressResult = await fetch('http://httpbin.org/get').then(function getJSON(res) { return res.json(); }); return ipAddressResult.origin; diff --git a/addons/addon-base/packages/serverless-backend-tools/lib/utils.js b/addons/addon-base/packages/serverless-backend-tools/lib/utils.js index ddb0a639bf..513d34d1ad 100644 --- a/addons/addon-base/packages/serverless-backend-tools/lib/utils.js +++ b/addons/addon-base/packages/serverless-backend-tools/lib/utils.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const inspect = require('util').inspect; +const _ = require('lodash'); // a promise friendly delay function function delay(seconds) { diff --git a/addons/addon-base/packages/serverless-go-build-tools/index.js b/addons/addon-base/packages/serverless-go-build-tools/index.js index 61fd24bfb8..8c4cfe1146 100644 --- a/addons/addon-base/packages/serverless-go-build-tools/index.js +++ b/addons/addon-base/packages/serverless-go-build-tools/index.js @@ -15,12 +15,12 @@ const { execSync } = require('child_process'); const { createReadStream } = require('fs'); const path = require('path'); -const _ = require('lodash'); -const chalk = require('chalk'); const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout, }); +const chalk = require('chalk'); +const _ = require('lodash'); // TODO: Make this a generic build artifact and upload to s3 tool in the future // ie - remove the hard-coded go bits and make it more extensible. diff --git a/addons/addon-base/packages/services/lib/db-password/db-password-service.js b/addons/addon-base/packages/services/lib/db-password/db-password-service.js index f8ce24e73c..a65f3e568e 100644 --- a/addons/addon-base/packages/services/lib/db-password/db-password-service.js +++ b/addons/addon-base/packages/services/lib/db-password/db-password-service.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const crypto = require('crypto'); +const _ = require('lodash'); const uuid = require('uuid/v4'); const Service = require('@aws-ee/base-services-container/lib/service'); const { ensureCurrentUserOrAdmin } = require('../authorization/assertions'); diff --git a/addons/addon-base/packages/services/lib/helpers/utils.js b/addons/addon-base/packages/services/lib/helpers/utils.js index d783432ed1..447df15613 100644 --- a/addons/addon-base/packages/services/lib/helpers/utils.js +++ b/addons/addon-base/packages/services/lib/helpers/utils.js @@ -13,10 +13,10 @@ * permissions and limitations under the License. */ +const crypto = require('crypto'); const _ = require('lodash'); const { nanoid: nanoIdSync } = require('nanoid'); const { nanoid } = require('nanoid/async'); -const crypto = require('crypto'); function toVersionString(num) { return `v${_.padStart(num, 4, '0')}_`; diff --git a/addons/addon-base/packages/services/lib/s3-service.js b/addons/addon-base/packages/services/lib/s3-service.js index e42f45a560..4061e00da8 100644 --- a/addons/addon-base/packages/services/lib/s3-service.js +++ b/addons/addon-base/packages/services/lib/s3-service.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const path = require('path'); +const _ = require('lodash'); const Service = require('@aws-ee/base-services-container/lib/service'); const moveS3ObjectSchema = require('./schema/move-s3-object.json'); diff --git a/addons/addon-custom/packages/main/src/extend/withAuth.js b/addons/addon-custom/packages/main/src/extend/withAuth.js index 8c5a5c7227..bd87259472 100644 --- a/addons/addon-custom/packages/main/src/extend/withAuth.js +++ b/addons/addon-custom/packages/main/src/extend/withAuth.js @@ -26,6 +26,8 @@ import { branding } from '@aws-ee/base-ui/dist/helpers/settings'; import TermsPage from '../parts/TermsPage'; import Register from '../parts/Register'; +/* eslint-disable react/jsx-no-bind */ + const noAuthPaths = [ { path: '/legal', component: TermsPage }, { path: '/register', component: Register }, diff --git a/addons/addon-key-pair-mgmt-api/packages/key-pair-mgmt-services/lib/key-pair/key-pair-service.js b/addons/addon-key-pair-mgmt-api/packages/key-pair-mgmt-services/lib/key-pair/key-pair-service.js index 6befe029a6..fcd8863e53 100644 --- a/addons/addon-key-pair-mgmt-api/packages/key-pair-mgmt-services/lib/key-pair/key-pair-service.js +++ b/addons/addon-key-pair-mgmt-api/packages/key-pair-mgmt-services/lib/key-pair/key-pair-service.js @@ -12,9 +12,9 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ +const { generateKeyPair } = require('crypto'); const _ = require('lodash'); const uuid = require('uuid/v4'); -const { generateKeyPair } = require('crypto'); const forge = require('node-forge'); const Service = require('@aws-ee/base-services-container/lib/service'); diff --git a/main/infrastructure-tests/__test__/appstream-egress-enabled/route-tables.test.js b/main/infrastructure-tests/__test__/appstream-egress-enabled/route-tables.test.js index 0fb0cec19c..f5991923ea 100644 --- a/main/infrastructure-tests/__test__/appstream-egress-enabled/route-tables.test.js +++ b/main/infrastructure-tests/__test__/appstream-egress-enabled/route-tables.test.js @@ -17,6 +17,7 @@ const AWS = require('aws-sdk'); const setupAws = require('../../support/setupAws'); const { getCFStackResources, getStackResourcesByType } = require('../../support/utilities'); +/* eslint-disable jest/expect-expect */ describe('Route tables', () => { beforeAll(async () => { await setupAws(); diff --git a/main/infrastructure-tests/__test__/appstream-egress-enabled/security-groups.test.js b/main/infrastructure-tests/__test__/appstream-egress-enabled/security-groups.test.js index d94bba9f6b..65bb5a8f02 100644 --- a/main/infrastructure-tests/__test__/appstream-egress-enabled/security-groups.test.js +++ b/main/infrastructure-tests/__test__/appstream-egress-enabled/security-groups.test.js @@ -17,6 +17,7 @@ const AWS = require('aws-sdk'); const setupAws = require('../../support/setupAws'); const { getStackResourcesByType } = require('../../support/utilities'); +/* eslint-disable jest/expect-expect */ describe('Security groups', () => { beforeAll(async () => { await setupAws(); diff --git a/main/infrastructure-tests/jest.config.js b/main/infrastructure-tests/jest.config.js index e7c232e9c3..2eb58997ae 100644 --- a/main/infrastructure-tests/jest.config.js +++ b/main/infrastructure-tests/jest.config.js @@ -12,8 +12,8 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ -const _ = require('lodash'); const path = require('path'); +const _ = require('lodash'); const fs = require('fs-extra'); const yaml = require('js-yaml'); const parse = require('yargs-parser'); diff --git a/main/integration-tests/.eslintrc.json b/main/integration-tests/.eslintrc.json index a9e56eda24..86b484c6a8 100644 --- a/main/integration-tests/.eslintrc.json +++ b/main/integration-tests/.eslintrc.json @@ -17,7 +17,8 @@ "no-underscore-dangle": 0, "no-param-reassign": 0, "class-methods-use-this": 0, - "no-use-before-define": 0 + "no-use-before-define": 0, + "no-console": 0 }, "env": { "jest/globals": true diff --git a/main/integration-tests/__test__/api-tests/common/budgets/create-budget.test.js b/main/integration-tests/__test__/api-tests/common/budgets/create-budget.test.js index de625538f0..41cbe8461e 100644 --- a/main/integration-tests/__test__/api-tests/common/budgets/create-budget.test.js +++ b/main/integration-tests/__test__/api-tests/common/budgets/create-budget.test.js @@ -16,6 +16,7 @@ const { runSetup } = require('../../../../support/setup'); const errorCode = require('../../../../support/utils/error-code'); +/* eslint-disable jest/no-commented-out-tests */ describe('Create budget', () => { let setup; let adminSession; diff --git a/main/integration-tests/jest.config.js b/main/integration-tests/jest.config.js index 4471fa7957..f8257ab08b 100644 --- a/main/integration-tests/jest.config.js +++ b/main/integration-tests/jest.config.js @@ -13,8 +13,8 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ -const _ = require('lodash'); const path = require('path'); +const _ = require('lodash'); const fs = require('fs-extra'); const yaml = require('js-yaml'); const parse = require('yargs-parser'); diff --git a/main/integration-tests/support/aws/services/cognito-idp.js b/main/integration-tests/support/aws/services/cognito-idp.js index db96709df2..6a75ab437b 100644 --- a/main/integration-tests/support/aws/services/cognito-idp.js +++ b/main/integration-tests/support/aws/services/cognito-idp.js @@ -13,8 +13,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const assert = require('assert'); +const _ = require('lodash'); class CognitoIdp { constructor({ aws, sdk }) { diff --git a/main/integration-tests/support/aws/services/s3.js b/main/integration-tests/support/aws/services/s3.js index 45fea3cd8b..9e8ba21750 100644 --- a/main/integration-tests/support/aws/services/s3.js +++ b/main/integration-tests/support/aws/services/s3.js @@ -15,8 +15,8 @@ * permissions and limitations under the License. */ -const _ = require('lodash'); const fs = require('fs'); +const _ = require('lodash'); const { run } = require('../../utils/utils');