diff --git a/packages/@aws-cdk/assert/lib/assertions/have-resource.ts b/packages/@aws-cdk/assert/lib/assertions/have-resource.ts index bf5ac8719f692..2ea670b9c394d 100644 --- a/packages/@aws-cdk/assert/lib/assertions/have-resource.ts +++ b/packages/@aws-cdk/assert/lib/assertions/have-resource.ts @@ -102,7 +102,7 @@ export class HaveResourceAssertion extends JestFriendlyAssertion } public get description(): string { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len return `resource '${this.resourceType}' with ${JSON.stringify(this.matcher, undefined, 2)}`; } } diff --git a/packages/@aws-cdk/assert/lib/synth-utils.ts b/packages/@aws-cdk/assert/lib/synth-utils.ts index 57d21926919b1..b66216362d363 100644 --- a/packages/@aws-cdk/assert/lib/synth-utils.ts +++ b/packages/@aws-cdk/assert/lib/synth-utils.ts @@ -1,7 +1,7 @@ -import * as core from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs'; import * as path from 'path'; +import * as core from '@aws-cdk/core'; +import * as cxapi from '@aws-cdk/cx-api'; export class SynthUtils { public static synthesize(stack: core.Stack, options: core.SynthesisOptions = { }): cxapi.CloudFormationStackArtifact { diff --git a/packages/@aws-cdk/assert/test/have-output.test.ts b/packages/@aws-cdk/assert/test/have-output.test.ts index 250f30e038ce5..b7233d61de96a 100644 --- a/packages/@aws-cdk/assert/test/have-output.test.ts +++ b/packages/@aws-cdk/assert/test/have-output.test.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import { unlink, writeFileSync } from 'fs'; import { join } from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; import '../jest'; let templateFilePath: string; diff --git a/packages/@aws-cdk/assert/test/have-resource.test.ts b/packages/@aws-cdk/assert/test/have-resource.test.ts index 69ab649433350..ad114a485dead 100644 --- a/packages/@aws-cdk/assert/test/have-resource.test.ts +++ b/packages/@aws-cdk/assert/test/have-resource.test.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import { writeFileSync } from 'fs'; import { join } from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; import { ABSENT, arrayWith, exactValue, expect as cdkExpect, haveResource, haveResourceLike } from '../lib/index'; test('support resource with no properties', () => { diff --git a/packages/@aws-cdk/aws-amplify/lib/app.ts b/packages/@aws-cdk/aws-amplify/lib/app.ts index 640c9684625df..1d41c0e07ede3 100644 --- a/packages/@aws-cdk/aws-amplify/lib/app.ts +++ b/packages/@aws-cdk/aws-amplify/lib/app.ts @@ -210,7 +210,7 @@ export class App extends Resource implements IApp, iam.IGrantable { buildSpec: props.autoBranchCreation.buildSpec && props.autoBranchCreation.buildSpec.toBuildSpec(), enableAutoBranchCreation: true, enableAutoBuild: props.autoBranchCreation.autoBuild === undefined ? true : props.autoBranchCreation.autoBuild, - environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables )}, { omitEmptyArray: true }), // tslint:disable-line max-line-length + environmentVariables: Lazy.anyValue({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables )}, { omitEmptyArray: true }), // eslint-disable-line max-len enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview === undefined ? true : props.autoBranchCreation.pullRequestPreview, pullRequestEnvironmentName: props.autoBranchCreation.pullRequestEnvironmentName, stage: props.autoBranchCreation.stage, diff --git a/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts b/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts index 0332859518b01..1ef0e5d29c246 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts @@ -1,7 +1,7 @@ // Copyright 2012-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Originally generated from the AWS CloudFormation Resource Specification. Now, hand managed. -// tslint:disable:max-line-length +/* eslint-disable max-len */ import * as cdk from '@aws-cdk/core'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/method.ts b/packages/@aws-cdk/aws-apigateway/lib/method.ts index 6e3ed26a0c6d9..172eb77cd1877 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/method.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/method.ts @@ -270,7 +270,7 @@ export class Method extends Resource { credentials = options.credentialsRole.roleArn; } else if (options.credentialsPassthrough) { // arn:aws:iam::*:user/* - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len credentials = Stack.of(this).formatArn({ service: 'iam', region: '', account: '*', resource: 'user', sep: '/', resourceName: '*' }); } diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts index 981dc3d28994a..517b5fe0c3d4b 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ export const handler = async (event: any, _context: any = {}): Promise => { const authToken: string = event.headers.Authorization; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.ts index 43746c4dee677..776d9d580c39e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as lambda from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; import * as path from 'path'; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts index 67bd522a81f9c..39a63e7da30b4 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts index 7481578045036..4d1f1d9307e39 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ export const handler = async (event: any, _context: any = {}): Promise => { const authToken: string = event.authorizationToken; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts index 7dbbcce503294..7e8c89ee799d5 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as lambda from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; import * as path from 'path'; diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts b/packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts index c2eb7a76a449b..dd19c03dd795f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts @@ -1,5 +1,5 @@ exports.handler = async (evt: any) => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(JSON.stringify(evt, undefined, 2)); return { statusCode: 200, diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts b/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts index 966e162acc228..bd847d46b326e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as lambda from '@aws-cdk/aws-lambda'; import { App, Construct, Stack, StackProps } from '@aws-cdk/core'; import * as path from 'path'; diff --git a/packages/@aws-cdk/aws-apigateway/test/test.domains.ts b/packages/@aws-cdk/aws-apigateway/test/test.domains.ts index 197978922c5a1..9001e0b8ca31e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.domains.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.domains.ts @@ -1,10 +1,11 @@ -// tslint:disable:object-literal-key-quotes import { ABSENT, expect, haveResource } from '@aws-cdk/assert'; import * as acm from '@aws-cdk/aws-certificatemanager'; import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as apigw from '../lib'; +/* eslint-disable quote-props */ + export = { 'can define either an EDGE or REGIONAL domain name'(test: Test) { // GIVEN @@ -365,7 +366,7 @@ export = { }); const testStage = new apigw.Stage(stack, 'test-stage', { - deployment : testDeploy, + deployment: testDeploy, }); // WHEN diff --git a/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts b/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts index 2c72ee3895835..a4fb4757aaba3 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts @@ -4,7 +4,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as apigw from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'LambdaRestApi defines a REST API with Lambda proxy integration'(test: Test) { diff --git a/packages/@aws-cdk/aws-apigateway/test/test.resource.ts b/packages/@aws-cdk/aws-apigateway/test/test.resource.ts index 93c28db5823e7..43db34771346f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.resource.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.resource.ts @@ -3,7 +3,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as apigw from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'ProxyResource defines a "{proxy+}" resource with ANY method'(test: Test) { diff --git a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts index 4df5bd3fd2755..3b51f66a611e3 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts @@ -4,7 +4,7 @@ import { App, CfnElement, CfnResource, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as apigw from '../lib'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'minimal setup'(test: Test) { @@ -956,7 +956,7 @@ export = { test.done(); }, - 'Import': { + Import: { 'fromRestApiId()'(test: Test) { // GIVEN const stack = new Stack(); @@ -995,7 +995,7 @@ export = { }, }, - 'SpecRestApi': { + SpecRestApi: { 'add Methods and Resources'(test: Test) { // GIVEN const stack = new Stack(); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts index f4a6d91c01793..6f6092b5452d9 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/test/test.step-scaling-policy.ts @@ -74,7 +74,7 @@ export = { return steps.every(step => { return reportFalse(intervals.find(interval => { const acceptableLowerBounds = step.MetricIntervalLowerBound === -Infinity ? [undefined, 0] : [undefined, step.MetricIntervalLowerBound]; - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len const acceptableUpperBounds = step.MetricIntervalUpperBound === Infinity ? [undefined, Infinity] : [undefined, step.MetricIntervalUpperBound]; return (acceptableLowerBounds.includes(interval.lower) && acceptableUpperBounds.includes(interval.upper)); @@ -259,7 +259,7 @@ function apply(x: T | undefined, f: (x: T) => U | undefined): U | undefine */ function reportFalse(cond: boolean, ...repr: any[]) { if (!cond) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error('PROPERTY FAILS ON:', ...repr); } return cond; diff --git a/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts b/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts index 2b0b906f4b892..92ef8f62ba2e0 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts +++ b/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts @@ -8,7 +8,7 @@ import * as cdk from '@aws-cdk/core'; import { nodeunitShim, Test } from 'nodeunit-shim'; import * as autoscaling from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ nodeunitShim({ 'default fleet'(test: Test) { @@ -1134,17 +1134,17 @@ nodeunitShim({ // THEN expect(stack).to(haveResource('AWS::AutoScaling::AutoScalingGroup', { - NotificationConfigurations : [ + NotificationConfigurations: [ { - TopicARN : { Ref : 'MyTopic86869434' }, - NotificationTypes : [ + TopicARN: { Ref: 'MyTopic86869434' }, + NotificationTypes: [ 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR', 'autoscaling:EC2_INSTANCE_TERMINATE_ERROR', ], }, { - TopicARN : { Ref : 'MyTopic86869434' }, - NotificationTypes : [ + TopicARN: { Ref: 'MyTopic86869434' }, + NotificationTypes: [ 'autoscaling:EC2_INSTANCE_TERMINATE', ], }, @@ -1174,10 +1174,10 @@ nodeunitShim({ // THEN expect(stack).to(haveResource('AWS::AutoScaling::AutoScalingGroup', { - NotificationConfigurations : [ + NotificationConfigurations: [ { - TopicARN : { Ref : 'MyTopic86869434' }, - NotificationTypes : [ + TopicARN: { Ref: 'MyTopic86869434' }, + NotificationTypes: [ 'autoscaling:EC2_INSTANCE_LAUNCH', 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR', 'autoscaling:EC2_INSTANCE_TERMINATE', @@ -1206,10 +1206,10 @@ nodeunitShim({ // THEN expect(stack).to(haveResource('AWS::AutoScaling::AutoScalingGroup', { - NotificationConfigurations : [ + NotificationConfigurations: [ { - TopicARN : { Ref : 'MyTopic86869434' }, - NotificationTypes : [ + TopicARN: { Ref: 'MyTopic86869434' }, + NotificationTypes: [ 'autoscaling:EC2_INSTANCE_LAUNCH', 'autoscaling:EC2_INSTANCE_LAUNCH_ERROR', 'autoscaling:EC2_INSTANCE_TERMINATE', diff --git a/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts b/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts index 1d075c7e2d756..55dccb51e485c 100644 --- a/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts +++ b/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts @@ -38,7 +38,6 @@ class TaskDefinition { * * @internal */ - // tslint:disable-next-line: no-empty public _linkContainer() {} /** diff --git a/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts b/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts index f09b30f0129fa..36258615fbf8e 100644 --- a/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts +++ b/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts @@ -168,7 +168,7 @@ describe('Batch Compute Evironment', () => { generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, hardwareType: ecs.AmiHardwareType.STANDARD, }), - instanceRole: new iam.CfnInstanceProfile(stack, 'Instance-Profile', { + instanceRole: new iam.CfnInstanceProfile(stack, 'Instance-Profile', { roles: [ new iam.Role(stack, 'Ecs-Instance-Role', { assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), managedPolicies: [ diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json index c3d25504c9324..377aff5edcb80 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json @@ -10,7 +10,7 @@ "scripts": { "build": "echo No build", "test": "jest", - "lint": "eslint lib", + "eslint": "eslint lib", "build+test+package": "npm run build+test", "build+test": "npm run build && npm test" }, diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts index 37606b21a874e..77e6247f38198 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts @@ -232,7 +232,7 @@ export enum ValidationMethod { DNS = 'DNS', } -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len function renderDomainValidation(validation: CertificateValidation, domainNames: string[]): CfnCertificate.DomainValidationOptionProperty[] | undefined { const domainValidation: CfnCertificate.DomainValidationOptionProperty[] = []; diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts b/packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts index 28a0acc326317..7f2222e22aabb 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts @@ -1,5 +1,5 @@ // This file has been generated using ../suffixes/build-map.py -// tslint:disable:no-trailing-whitespace object-literal-key-quotes +/* eslint-disable quote-props */ export const publicSuffixes = { 'ac': { 'com': {}, diff --git a/packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts b/packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts index 3da16e9b84b6c..adfa3cdf1ef24 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ exports.handler = async (evt: any) => { console.error(JSON.stringify(evt, undefined, 2)); diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts b/packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts index 5a372f057593e..b83a9218a3e58 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable no-console */ export function handler(event: any) { console.log('I am a custom resource'); diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts b/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts index 2c219f757825d..084e661b5c0b1 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets /* * Stack verification steps: * - Deploy with `--no-clean` diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts b/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts index 02f2a1e55b638..3431211740c88 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as lambda from '@aws-cdk/aws-lambda'; import { App, Construct, Stack } from '@aws-cdk/core'; import * as path from 'path'; diff --git a/packages/@aws-cdk/aws-cloudformation/test/test.nested-stack.ts b/packages/@aws-cdk/aws-cloudformation/test/test.nested-stack.ts index 4a71ab81e0ea3..4eedbf0e75c4c 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/test.nested-stack.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/test.nested-stack.ts @@ -1,13 +1,13 @@ +import * as fs from 'fs'; +import * as path from 'path'; import { expect, haveResource, matchTemplate, SynthUtils } from '@aws-cdk/assert'; import * as s3_assets from '@aws-cdk/aws-s3-assets'; import * as sns from '@aws-cdk/aws-sns'; import { App, CfnParameter, CfnResource, Construct, ContextProvider, Stack } from '@aws-cdk/core'; -import * as fs from 'fs'; import { Test } from 'nodeunit'; -import * as path from 'path'; import { NestedStack } from '../lib/nested-stack'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'fails if defined as a root'(test: Test) { diff --git a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts index b66d845634353..5dcfe360336c2 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts @@ -5,7 +5,7 @@ import * as cdk from '@aws-cdk/core'; import { Test, testCase } from 'nodeunit'; import { CustomResource, CustomResourceProvider } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = testCase({ 'custom resources honor removalPolicy': { diff --git a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts index f6c9c0fe89019..1359a91bde3be 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts +++ b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts @@ -533,6 +533,7 @@ export class GeoRestriction { } locations.forEach(location => { if (!GeoRestriction.LOCATION_REGEX.test(location)) { + // eslint-disable-next-line max-len throw new Error(`Invalid location format for location: ${location}, location should be two-letter and uppercase country ISO 3166-1-alpha-2 code`); } }); @@ -739,7 +740,7 @@ export class CloudFrontWebDistribution extends cdk.Construct implements IDistrib httpVersion: props.httpVersion || HttpVersion.HTTP2, priceClass: props.priceClass || PriceClass.PRICE_CLASS_100, ipv6Enabled: (props.enableIpV6 !== undefined) ? props.enableIpV6 : true, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len customErrorResponses: props.errorConfigurations, // TODO: validation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl webAclId: props.webACLId, }; @@ -883,7 +884,7 @@ export class CloudFrontWebDistribution extends cdk.Construct implements IDistrib const validProtocols = this.VALID_SSL_PROTOCOLS[sslSupportMethod as SSLMethod]; if (validProtocols.indexOf(minimumProtocolVersion.toString()) === -1) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`${minimumProtocolVersion} is not compabtible with sslMethod ${sslSupportMethod}.\n\tValid Protocols are: ${validProtocols.join(', ')}`); } } diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts index 453b51df57fa4..89936cad97485 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts @@ -16,7 +16,7 @@ new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], geoRestriction: cloudfront.GeoRestriction.whitelist('US', 'UK'), diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts index 889c412bfb44f..10f17b6189ddb 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts @@ -17,7 +17,7 @@ new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], enableIpV6: false, diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts index 237732d8128b8..e1581ada8fc82 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts @@ -27,7 +27,7 @@ new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true, lambdaFunctionAssociations: [{ + behaviors: [ {isDefaultBehavior: true, lambdaFunctionAssociations: [{ eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, lambdaFunction: lambdaVersion, }]}], diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts index 28dc4b478b33b..534ad08f9042d 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts @@ -17,7 +17,7 @@ new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], }); diff --git a/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts b/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts index 36616f12471ba..3f3a95327a9f1 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts @@ -3,7 +3,7 @@ import * as cdk from '@aws-cdk/core'; import { nodeunitShim, Test } from 'nodeunit-shim'; import { OriginAccessIdentity } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ nodeunitShim({ 'Origin Access Identity with automatic comment'(test: Test) { diff --git a/packages/@aws-cdk/aws-cloudfront/test/web_distribution.test.ts b/packages/@aws-cdk/aws-cloudfront/test/web_distribution.test.ts index 245f85a176d4b..c8b2fb322995f 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/web_distribution.test.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/web_distribution.test.ts @@ -15,7 +15,7 @@ import { ViewerProtocolPolicy, } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ nodeunitShim({ @@ -819,7 +819,7 @@ nodeunitShim({ originConfigs: [ { s3OriginSource: { s3BucketSource: sourceBucket }, - behaviors : [ + behaviors: [ { isDefaultBehavior: true, lambdaFunctionAssociations: [ { @@ -869,7 +869,7 @@ nodeunitShim({ originConfigs: [ { s3OriginSource: { s3BucketSource: sourceBucket }, - behaviors : [ + behaviors: [ { isDefaultBehavior: true, lambdaFunctionAssociations: [ { @@ -888,7 +888,7 @@ nodeunitShim({ }, 'geo restriction': { - 'success' : { + 'success': { 'whitelist'(test: Test) { const stack = new cdk.Stack(); const sourceBucket = new s3.Bucket(stack, 'Bucket'); diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts index ad8614b3c1564..672d146192c09 100644 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts +++ b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts @@ -30,7 +30,7 @@ Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ resources: [Trailbucket.arnForObjects(`AWSLogs/${cdk.Stack.of(stack).account}/*`)], actions: ['s3:PutObject'], principals: [cloudTrailPrincipal], - conditions: { + conditions: { StringEquals: {'s3:x-amz-acl': 'bucket-owner-full-control'}, }, })); diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts b/packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts index f860bcb095d44..7d7a25d2e9104 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts @@ -62,7 +62,6 @@ export class AlarmRule { * @param operand IAlarmRule to be wrapped in NOT operator. */ public static not(operand: IAlarmRule): IAlarmRule { - // tslint:disable-next-line:new-parens return new class implements IAlarmRule { public renderAlarmRule(): string { return `(NOT (${operand.renderAlarmRule()}))`; @@ -76,7 +75,6 @@ export class AlarmRule { * @param value boolean value to be used in rule expression. */ public static fromBoolean(value: boolean): IAlarmRule { - // tslint:disable-next-line:new-parens return new class implements IAlarmRule { public renderAlarmRule(): string { return `${String(value).toUpperCase()}`; @@ -91,7 +89,6 @@ export class AlarmRule { * @param alarmState AlarmState to be used in Rule Expression. */ public static fromAlarm(alarm: IAlarm, alarmState: AlarmState): IAlarmRule { - // tslint:disable-next-line:new-parens return new class implements IAlarmRule { public renderAlarmRule(): string { return `${alarmState}(${alarm.alarmArn})`; @@ -105,7 +102,6 @@ export class AlarmRule { * @param alarmRule string to be used in Rule Expression. */ public static fromString(alarmRule: string): IAlarmRule { - // tslint:disable-next-line:new-parens return new class implements IAlarmRule { public renderAlarmRule(): string { return alarmRule; @@ -114,7 +110,6 @@ export class AlarmRule { } private static concat(operator: Operator, ...operands: IAlarmRule[]): IAlarmRule { - // tslint:disable-next-line:new-parens return new class implements IAlarmRule { public renderAlarmRule(): string { const expression = operands diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts index 299220eb8d42f..d1ebea096629e 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts @@ -197,7 +197,7 @@ export class Alarm extends AlarmBase { this.metric = props.metric; const datapoints = props.datapointsToAlarm || props.evaluationPeriods; this.annotation = { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len label: `${this.metric} ${OPERATOR_SYMBOLS[comparisonOperator]} ${props.threshold} for ${datapoints} datapoints within ${describePeriod(props.evaluationPeriods * metricPeriod(props.metric).toSeconds())}`, value: props.threshold, }; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts b/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts index bae996a137e71..589e3d99ad474 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts @@ -109,7 +109,7 @@ export function metricPeriod(metric: IMetric): Duration { * repeated in all places where code needs to make a distinction on the type * of metric object that is being passed. */ -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export function dispatchMetric(metric: IMetric, fns: { withStat: (x: MetricStatConfig, c: MetricConfig) => A, withExpression: (x: MetricExpressionConfig, c: MetricConfig) => B }): A | B { const conf = metric.toMetricConfig(); if (conf.metricStat && conf.mathExpression) { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/test.dashboard.ts b/packages/@aws-cdk/aws-cloudwatch/test/test.dashboard.ts index 34b0241d338b5..80d24718af79a 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/test.dashboard.ts +++ b/packages/@aws-cdk/aws-cloudwatch/test/test.dashboard.ts @@ -180,7 +180,7 @@ function thatHasWidgets(widgets: any): (props: any) => boolean { const actualWidgets = JSON.parse(props.DashboardBody).widgets; return isSuperObject(actualWidgets, widgets); } catch (e) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error('Error parsing', props); throw e; } diff --git a/packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts b/packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts index 8c06e079b2a97..4d233def20845 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts @@ -3,7 +3,6 @@ import { CodePipelineArtifacts } from './codepipeline-artifacts'; import { CodePipelineSource } from './codepipeline-source'; import { CommonProjectProps, Project } from './project'; -// tslint:disable-next-line:no-empty-interface export interface PipelineProjectProps extends CommonProjectProps { } diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index 7badf7c9b8f46..8fcf052c9358f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -9,7 +9,7 @@ import * as codebuild from '../lib'; import { CodePipelineSource } from '../lib/codepipeline-source'; import { NoSource } from '../lib/no-source'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default properties': { diff --git a/packages/@aws-cdk/aws-codebuild/test/test.project.ts b/packages/@aws-cdk/aws-codebuild/test/test.project.ts index 19dd60ed5e758..0714a400acc25 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.project.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.project.ts @@ -6,7 +6,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as codebuild from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'can use filename as buildspec'(test: Test) { diff --git a/packages/@aws-cdk/aws-codebuild/test/test.report-group.ts b/packages/@aws-cdk/aws-codebuild/test/test.report-group.ts index 1e942413cc08f..4bc69d40ee4c6 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.report-group.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.report-group.ts @@ -6,7 +6,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as codebuild from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ /* eslint-disable quotes */ export = { diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-config.ts index 33520ea4d84d5..7b8c43a1ae0d5 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-config.ts @@ -3,7 +3,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as codedeploy from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CodeDeploy DeploymentConfig': { diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts index d87b2e3a98b2a..fd486f20f1eb2 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts @@ -7,7 +7,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as codedeploy from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CodeDeploy Server Deployment Group': { diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts b/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts index 0fbf063cccfaa..8b26f916d26f1 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts +++ b/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts @@ -3,7 +3,7 @@ import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; import { Stack } from '@aws-cdk/core'; import { ProfilingGroup } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('profiling group', () => { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts index 6fb8770796824..8245c2507fa6a 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts @@ -47,7 +47,6 @@ export interface BitBucketSourceActionProps extends codepipeline.CommonAwsAction readonly branch?: string; // long URL in @see - // tslint:disable:max-line-length /** * Whether the output should be the contents of the repository * (which is the default), diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts index 44ad86f4c3f34..2a9faa0cb3db3 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts @@ -139,7 +139,6 @@ export class CloudFormationExecuteChangeSetAction extends CloudFormationAction { } } -// tslint:disable:max-line-length Because of long URLs in documentation /** * Properties common to CloudFormation actions that stage deployments */ @@ -451,7 +450,6 @@ export class CloudFormationCreateUpdateStackAction extends CloudFormationDeployA /** * Properties for the CloudFormationDeleteStackAction. */ -// tslint:disable-next-line:no-empty-interface export interface CloudFormationDeleteStackActionProps extends CloudFormationDeployActionProps { } diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/custom-action-registration.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/custom-action-registration.ts index 3b51ffd0630ab..2bd7f8825adcf 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/custom-action-registration.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/custom-action-registration.ts @@ -19,9 +19,6 @@ export interface CustomActionProperty { */ description?: string; - // because of @see URLs - // tslint:disable:max-line-length - /** * Whether this property is a key. * diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts index 7cabc529fbf07..c08842f0edd8c 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts @@ -8,9 +8,6 @@ import { Action } from '../action'; * Construction properties of the {@link LambdaInvokeAction Lambda invoke CodePipeline Action}. */ export interface LambdaInvokeActionProps extends codepipeline.CommonAwsActionProps { - // because of @see links - // tslint:disable:max-line-length - /** * The optional input Artifacts of the Action. * A Lambda Action can have up to 5 inputs. diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/test.bitbucket-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/test.bitbucket-source-action.ts index f245a720a2fd9..a4f120f2abf68 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/test.bitbucket-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/test.bitbucket-source-action.ts @@ -5,7 +5,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'BitBucket source Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts index ea613c14db4f4..122add214cc3a 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.cloudformation-pipeline-actions.ts @@ -8,7 +8,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CreateChangeSetAction can be used to make a change set from a CodePipeline'(test: Test) { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.pipeline-actions.ts index 610c55176c061..9a6b99351ee7b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test.pipeline-actions.ts @@ -8,7 +8,7 @@ import * as nodeunit from 'nodeunit'; import * as cpactions from '../../lib'; export = nodeunit.testCase({ - 'CreateReplaceChangeSet': { + CreateReplaceChangeSet: { 'works'(test: nodeunit.Test) { const app = new cdk.App(); const stack = new cdk.Stack(app, 'Stack'); @@ -95,9 +95,9 @@ export = nodeunit.testCase({ Condition: { StringEqualsIfExists: { 'cloudformation:ChangeSetName': 'MyChangeSet' } }, Effect: 'Allow', Resource: [ - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':cloudformation:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':stack/StackA/*' ] ] }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':cloudformation:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':stack/StackB/*' ] ] }, ], }, @@ -108,7 +108,7 @@ export = nodeunit.testCase({ }, }, - 'ExecuteChangeSet': { + ExecuteChangeSet: { 'works'(test: nodeunit.Test) { const stack = new cdk.Stack(); const pipelineRole = new RoleDouble(stack, 'PipelineRole'); @@ -167,9 +167,9 @@ export = nodeunit.testCase({ Condition: { StringEqualsIfExists: { 'cloudformation:ChangeSetName': 'MyChangeSet' } }, Effect: 'Allow', Resource: [ - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':cloudformation:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':stack/StackA/*' ] ] }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':cloudformation:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':stack/StackB/*' ] ] }, ], }, diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/test.codebuild-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/test.codebuild-action.ts index 10c09811e851e..3dc54909d8f53 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/test.codebuild-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/test.codebuild-action.ts @@ -8,7 +8,7 @@ import { App, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CodeBuild action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts index 0650c50f2b596..e62e301168fa1 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/test.codecommit-source-action.ts @@ -6,7 +6,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CodeCommit Source Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/test.ecr-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/test.ecr-source-action.ts index 6160e7f159af5..b27ad5f89f880 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/test.ecr-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/test.ecr-source-action.ts @@ -6,7 +6,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'ECR source Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/github/test.github-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/github/test.github-source-action.ts index 02f8847c6bf92..56131d3d15b1e 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/github/test.github-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/github/test.github-source-action.ts @@ -5,7 +5,7 @@ import { SecretValue, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'GitHub source Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts index 33311f6a5a7d6..921227a3224ba 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts @@ -4,7 +4,7 @@ import * as codepipeline from '@aws-cdk/aws-codepipeline'; import * as cdk from '@aws-cdk/core'; import * as cpactions from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts index 4f5eba55965c1..e969e350482dc 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts @@ -7,7 +7,7 @@ import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; import * as cpactions from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/test.lambda-invoke-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/test.lambda-invoke-action.ts index ab0cd120ac90e..84af1c50a7583 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/test.lambda-invoke-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/test.lambda-invoke-action.ts @@ -7,7 +7,7 @@ import { Aws, Lazy, SecretValue, Stack, Token } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'Lambda invoke Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-deploy-action.ts index 37ad397848a51..01ebb43dca605 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-deploy-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-deploy-action.ts @@ -5,7 +5,7 @@ import { Duration, SecretValue, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'S3 Deploy Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts index 909fcb9bd6d8b..6c927ed36d1cb 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/test.s3-source-action.ts @@ -6,7 +6,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'S3 Source Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/test.manual-approval.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/test.manual-approval.ts index 7adc663d9e6c2..8efbbd0040ca9 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/test.manual-approval.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/test.manual-approval.ts @@ -5,7 +5,7 @@ import { SecretValue, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as cpactions from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'manual approval Action': { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts index 64f9c44a41147..6a7001630b3c5 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/test.pipeline.ts @@ -11,7 +11,7 @@ import { App, Aws, CfnParameter, ConstructNode, SecretValue, Stack } from '@aws- import { Test } from 'nodeunit'; import * as cpactions from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'basic pipeline'(test: Test) { diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts index 1ff1783a9c3a9..2032be87ac430 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts @@ -7,7 +7,7 @@ import * as validations from '../lib/validation'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'artifact bounds validation': { diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts b/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts index b638a3c1c7b90..dc023846667e3 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts @@ -5,7 +5,7 @@ import * as codepipeline from '../lib'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'Artifacts in CodePipeline': { diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts index 5d1c91edd51af..32f3604191e6a 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts @@ -9,7 +9,7 @@ import * as codepipeline from '../lib'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'Pipeline': { @@ -305,7 +305,7 @@ export = { app.node.setContext(cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT, true); const pipelineStack = new cdk.Stack(app, 'PipelineStack', { - env: { region: 'us-west-2', account: '123456789012' }, + env: { region: 'us-west-2', account: '123456789012' }, }); const sourceOutput = new codepipeline.Artifact(); new codepipeline.Pipeline(pipelineStack, 'Pipeline', { diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.stages.ts b/packages/@aws-cdk/aws-codepipeline/test/test.stages.ts index 19ead05bb1410..62088e0f9d8b0 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.stages.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.stages.ts @@ -4,7 +4,7 @@ import { Test } from 'nodeunit'; import * as codepipeline from '../lib'; import { Stage } from '../lib/stage'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'Pipeline Stages': { @@ -105,7 +105,6 @@ export = { }); // incredibly, an arrow function below causes nodeunit to crap out with: // "TypeError: Function has non-object prototype 'undefined' in instanceof check" - // tslint:disable-next-line:only-arrow-functions }, function(e: any) { return /rightBefore/.test(e) && /justAfter/.test(e); }); diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts b/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts index 8c01171187c6d..92ae8c8b8ac6a 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts @@ -5,7 +5,7 @@ import * as codepipeline from '../lib'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'Pipeline Variables': { diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts index 60c011fd9a71b..0c81c4bf5d687 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts @@ -147,7 +147,6 @@ export interface ICustomAttribute { * Configuration that will be fed into CloudFormation for any custom attribute type. */ export interface CustomAttributeConfig { - // tslint:disable:max-line-length /** * The data type of the custom attribute. * diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts index c584ca8be7e46..0d22c76cb6b5a 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts @@ -132,7 +132,6 @@ export class OAuthScope { return new OAuthScope(name); } - // tslint:disable:max-line-length /** * The name of this scope as recognized by CloudFormation. * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-allowedoauthscopes diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts index abde60a7cd12c..7a45e144ffc3c 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts +++ b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import { App, CfnOutput, Stack } from '@aws-cdk/core'; import { UserPool } from '../lib'; diff --git a/packages/@aws-cdk/aws-docdb/lib/instance.ts b/packages/@aws-cdk/aws-docdb/lib/instance.ts index ab6400f5480e4..e65c6ddd27e10 100644 --- a/packages/@aws-cdk/aws-docdb/lib/instance.ts +++ b/packages/@aws-cdk/aws-docdb/lib/instance.ts @@ -145,7 +145,6 @@ export interface DatabaseInstanceProps { */ readonly autoMinorVersionUpgrade?: boolean; - // tslint:disable:max-line-length /** * The weekly time range (in UTC) during which system maintenance can occur. * diff --git a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json index 741bb93500809..f3a9fcb2d92fa 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json @@ -10,7 +10,7 @@ "scripts": { "build": "echo No build", "test": "jest", - "lint": "eslint lib", + "eslint": "eslint lib", "build+test+package": "npm run build+test", "build+test": "npm run build && npm test" }, diff --git a/packages/@aws-cdk/aws-dynamodb-global/test/test.dynamodb.global.ts b/packages/@aws-cdk/aws-dynamodb-global/test/test.dynamodb.global.ts index 28829b80f20a4..e68f9230b69cd 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/test/test.dynamodb.global.ts +++ b/packages/@aws-cdk/aws-dynamodb-global/test/test.dynamodb.global.ts @@ -4,7 +4,7 @@ import { App, CfnOutput, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { GlobalTable, GlobalTableProps } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ // CDK parameters const CONSTRUCT_NAME = 'aws-cdk-dynamodb-global'; diff --git a/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts b/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts index 044d1c0c359ac..814bad346ece2 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts @@ -1,4 +1,4 @@ -/* tslint:disable no-console */ +/* eslint-disable no-console */ import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies diff --git a/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts b/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts index d10f023631297..dbfd8761aff05 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts @@ -1,8 +1,8 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import { Construct, Duration, NestedStack, Stack } from '@aws-cdk/core'; import * as cr from '@aws-cdk/custom-resources'; -import * as path from 'path'; export class ReplicaProvider extends NestedStack { /** diff --git a/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts b/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts index 83ce773e31d9a..4ec8e1365773f 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts @@ -17,7 +17,7 @@ export class ScalableTableAttribute extends appscaling.BaseScalableAttribute { */ public scaleOnUtilization(props: UtilizationScalingProps) { if (props.targetUtilizationPercent < 10 || props.targetUtilizationPercent > 90) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new RangeError(`targetUtilizationPercent for DynamoDB scaling must be between 10 and 90 percent, got: ${props.targetUtilizationPercent}`); } const predefinedMetric = this.props.dimension.indexOf('ReadCapacity') === -1 diff --git a/packages/@aws-cdk/aws-dynamodb/lib/table.ts b/packages/@aws-cdk/aws-dynamodb/lib/table.ts index d2594c95fa9b2..f5cf9df385869 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/table.ts +++ b/packages/@aws-cdk/aws-dynamodb/lib/table.ts @@ -890,7 +890,7 @@ export class Table extends TableBase { } this.billingMode = BillingMode.PAY_PER_REQUEST; } else if (props.stream) { - streamSpecification = { streamViewType : props.stream }; + streamSpecification = { streamViewType: props.stream }; } this.table = new CfnTable(this, 'Resource', { diff --git a/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts b/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts index c0c0fe9633ac0..05287f09adaa5 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts +++ b/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts @@ -16,7 +16,7 @@ import { TableEncryption, } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ // CDK parameters const CONSTRUCT_NAME = 'MyTable'; @@ -59,7 +59,7 @@ function* LSI_GENERATOR(): Generator { while (true) { const localSecondaryIndexProps: LocalSecondaryIndexProps = { indexName: `${LSI_NAME}${n}`, - sortKey: { name : `${LSI_SORT_KEY.name}${n}`, type: LSI_SORT_KEY.type }, + sortKey: { name: `${LSI_SORT_KEY.name}${n}`, type: LSI_SORT_KEY.type }, }; yield localSecondaryIndexProps; n++; @@ -2775,7 +2775,7 @@ describe('global', () => { function testGrant(expectedActions: string[], invocation: (user: iam.IPrincipal, table: Table) => void) { // GIVEN const stack = new Stack(); - const table = new Table(stack, 'my-table', { partitionKey: { name: 'ID', type: AttributeType.STRING } }); + const table = new Table(stack, 'my-table', { partitionKey: { name: 'ID', type: AttributeType.STRING } }); const user = new iam.User(stack, 'user'); // WHEN diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts index c911a7b698f7d..b4ae5d01abccb 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts +++ b/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import { App, Construct, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; import * as dynamodb from '../lib'; diff --git a/packages/@aws-cdk/aws-ec2/lib/util.ts b/packages/@aws-cdk/aws-ec2/lib/util.ts index e33bc9338eccb..4f5a765b96bc5 100644 --- a/packages/@aws-cdk/aws-ec2/lib/util.ts +++ b/packages/@aws-cdk/aws-ec2/lib/util.ts @@ -58,12 +58,12 @@ export class ImportSubnetGroup { this.groups = this.subnetIds.length / this.availabilityZones.length; if (Math.floor(this.groups) !== this.groups) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Number of ${idField} (${this.subnetIds.length}) must be a multiple of availability zones (${this.availabilityZones.length}).`); } if (this.routeTableIds.length !== this.subnetIds.length && routeTableIds != null) { // We don't err if no routeTableIds were provided to maintain backwards-compatibility. See https://github.com/aws/aws-cdk/pull/3171 - // tslint:disable-next-line: max-line-length + /* eslint-disable max-len */ throw new Error(`Number of ${routeTableIdField} (${this.routeTableIds.length}) must be equal to the amount of ${idField} (${this.subnetIds.length}).`); } diff --git a/packages/@aws-cdk/aws-ec2/lib/volume.ts b/packages/@aws-cdk/aws-ec2/lib/volume.ts index 6a6445dc87379..5dfd157460484 100644 --- a/packages/@aws-cdk/aws-ec2/lib/volume.ts +++ b/packages/@aws-cdk/aws-ec2/lib/volume.ts @@ -473,7 +473,7 @@ abstract class VolumeBase extends Resource implements IVolume { const result = Grant.addToPrincipal({ grantee, actions: [ 'ec2:AttachVolume' ], - resourceArns : this.collectGrantResourceArns(instances), + resourceArns: this.collectGrantResourceArns(instances), }); if (this.encryptionKey) { @@ -519,7 +519,7 @@ abstract class VolumeBase extends Resource implements IVolume { const result = Grant.addToPrincipal({ grantee, actions: [ 'ec2:DetachVolume' ], - resourceArns : this.collectGrantResourceArns(instances), + resourceArns: this.collectGrantResourceArns(instances), }); // Note: No encryption key permissions are required to detach an encrypted volume. return result; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 509c42daebaf9..0b6ef2473b4db 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -1406,11 +1406,10 @@ export class Subnet extends Resource implements ISubnet { /** * Import existing subnet from id. */ - // tslint:disable:no-shadowed-variable + // eslint-disable-next-line no-shadow public static fromSubnetId(scope: Construct, id: string, subnetId: string): ISubnet { return this.fromSubnetAttributes(scope, id, { subnetId }); } - // tslint:enable:no-shadowed-variable /** * The Availability Zone the subnet is located in @@ -1662,7 +1661,6 @@ function routerTypeToPropName(routerType: RouterType) { })[routerType]; } -// tslint:disable-next-line:no-empty-interface export interface PublicSubnetProps extends SubnetProps { } @@ -1701,7 +1699,6 @@ export class PublicSubnet extends Subnet implements IPublicSubnet { } } -// tslint:disable-next-line:no-empty-interface export interface PrivateSubnetProps extends SubnetProps { } @@ -1746,11 +1743,11 @@ class ImportedVpc extends VpcBase { this._vpnGatewayId = props.vpnGatewayId; this.incompleteSubnetDefinition = isIncomplete; - // tslint:disable:max-line-length + /* eslint-disable max-len */ const pub = new ImportSubnetGroup(props.publicSubnetIds, props.publicSubnetNames, props.publicSubnetRouteTableIds, SubnetType.PUBLIC, this.availabilityZones, 'publicSubnetIds', 'publicSubnetNames', 'publicSubnetRouteTableIds'); const priv = new ImportSubnetGroup(props.privateSubnetIds, props.privateSubnetNames, props.privateSubnetRouteTableIds, SubnetType.PRIVATE, this.availabilityZones, 'privateSubnetIds', 'privateSubnetNames', 'privateSubnetRouteTableIds'); const iso = new ImportSubnetGroup(props.isolatedSubnetIds, props.isolatedSubnetNames, props.isolatedSubnetRouteTableIds, SubnetType.ISOLATED, this.availabilityZones, 'isolatedSubnetIds', 'isolatedSubnetNames', 'isolatedSubnetRouteTableIds'); - // tslint:enable:max-line-length + /* eslint-enable max-len */ this.publicSubnets = pub.import(this); this.privateSubnets = priv.import(this); @@ -1876,7 +1873,7 @@ class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivat const ref = Token.isUnresolved(attrs.subnetId) ? `at '${scope.node.path}/${id}'` : `'${attrs.subnetId}'`; - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len scope.node.addWarning(`No routeTableId was provided to the subnet ${ref}. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)`); } @@ -1890,7 +1887,7 @@ class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivat public get availabilityZone(): string { if (!this._availabilityZone) { - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len throw new Error("You cannot reference a Subnet's availability zone if it was not supplied. Add the availabilityZone when importing using Subnet.fromSubnetAttributes()"); } return this._availabilityZone; @@ -1924,12 +1921,12 @@ function determineNatGatewayCount(requestedCount: number | undefined, subnetConf const count = requestedCount !== undefined ? Math.min(requestedCount, azCount) : (hasPrivateSubnets ? azCount : 0); if (count === 0 && hasPrivateSubnets) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error('If you do not want NAT gateways (natGateways=0), make sure you don\'t configure any PRIVATE subnets in \'subnetConfiguration\' (make them PUBLIC or ISOLATED instead)'); } if (count > 0 && !hasPublicSubnets) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`If you configure PRIVATE subnets in 'subnetConfiguration', you must also configure PUBLIC subnets to put the NAT gateways into (got ${JSON.stringify(subnetConfig)}.`); } diff --git a/packages/@aws-cdk/aws-ec2/lib/vpn.ts b/packages/@aws-cdk/aws-ec2/lib/vpn.ts index 073271572ad92..d826c4cbab0cd 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpn.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpn.ts @@ -1,6 +1,6 @@ +import * as net from 'net'; import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as cdk from '@aws-cdk/core'; -import * as net from 'net'; import { CfnCustomerGateway, CfnVPNConnection, @@ -252,9 +252,9 @@ export class VpnConnection extends cdk.Resource implements IVpnConnection { props.tunnelOptions.forEach((options, index) => { if (options.preSharedKey && !/^[a-zA-Z1-9._][a-zA-Z\d._]{7,63}$/.test(options.preSharedKey)) { - // tslint:disable:max-line-length + /* eslint-disable max-len */ throw new Error(`The \`preSharedKey\` ${options.preSharedKey} for tunnel ${index + 1} is invalid. Allowed characters are alphanumeric characters and ._. Must be between 8 and 64 characters in length and cannot start with zero (0).`); - // tslint:enable:max-line-length + /* eslint-enable max-len */ } if (options.tunnelInsideCidr) { @@ -263,9 +263,8 @@ export class VpnConnection extends cdk.Resource implements IVpnConnection { } if (!/^169\.254\.\d{1,3}\.\d{1,3}\/30$/.test(options.tunnelInsideCidr)) { - // tslint:disable:max-line-length + /* eslint-disable-next-line max-len */ throw new Error(`The \`tunnelInsideCidr\` ${options.tunnelInsideCidr} for tunnel ${index + 1} is not a size /30 CIDR block from the 169.254.0.0/16 range.`); - // tslint:enable:max-line-length } } }); diff --git a/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts b/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts index 9d151296b7e1a..b14134eec2363 100644 --- a/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts +++ b/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts @@ -115,7 +115,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2016_SWEDISH_FULL_BASE = 'Windows_Server-2016-Swedish-Full-Base', WINDOWS_SERVER_2016_TURKISH_FULL_BASE = 'Windows_Server-2016-Turkish-Full-Base', WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE_SQL_2012_SP4_STANDARD = 'Windows_Server-2008-R2_SP1-English-64Bit-Core_SQL_2012_SP4_Standard', - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_STANDARD = 'Windows_Server-2008-R2_SP1-Language_Packs-64Bit-SQL_2008_R2_SP3_Standard', WINDOWS_SERVER_2012_RTM_CZECH_64BIT_BASE = 'Windows_Server-2012-RTM-Czech-64Bit-Base', WINDOWS_SERVER_2012_RTM_TURKISH_64BIT_BASE = 'Windows_Server-2012-RTM-Turkish-64Bit-Base', diff --git a/packages/@aws-cdk/aws-ec2/test/instance.test.ts b/packages/@aws-cdk/aws-ec2/test/instance.test.ts index 06afe520cb1aa..2a78f3cdf516e 100644 --- a/packages/@aws-cdk/aws-ec2/test/instance.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/instance.test.ts @@ -104,7 +104,7 @@ nodeunitShim({ test.done(); }, - 'blockDeviceMappings': { + blockDeviceMappings: { 'can set blockDeviceMappings'(test: Test) { // GIVEN const stack = new Stack(); diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts index f7840f14829a2..0f641a3403839 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts @@ -3,7 +3,7 @@ import { ArnPrincipal } from '@aws-cdk/aws-iam'; import { Stack } from '@aws-cdk/core'; import { nodeunitShim, Test } from 'nodeunit-shim'; -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len import { IVpcEndpointServiceLoadBalancer, Vpc, VpcEndpointService } from '../lib'; /** diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts index 60d18187027b1..b0e63a42a4874 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -3,7 +3,7 @@ import { AnyPrincipal, PolicyStatement } from '@aws-cdk/aws-iam'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { ContextProvider, Stack } from '@aws-cdk/core'; import { nodeunitShim, Test } from 'nodeunit-shim'; -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len import { GatewayVpcEndpoint, GatewayVpcEndpointAwsService, InterfaceVpcEndpoint, InterfaceVpcEndpointAwsService, InterfaceVpcEndpointService, SecurityGroup, SubnetType, Vpc } from '../lib'; nodeunitShim({ diff --git a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts b/packages/@aws-cdk/aws-ec2/test/vpc.test.ts index 280c1e2ac4e11..b92ef155a5ccb 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc.test.ts @@ -1179,7 +1179,7 @@ nodeunitShim({ const subnet = Subnet.fromSubnetId(stack, 'subnet1', 'pub-1'); // THEN - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len test.throws(() => subnet.availabilityZone, "You cannot reference a Subnet's availability zone if it was not supplied. Add the availabilityZone when importing using Subnet.fromSubnetAttributes()"); test.done(); }, @@ -1189,11 +1189,11 @@ nodeunitShim({ const stack = getTestStack(); // WHEN - const subnet = Subnet.fromSubnetAttributes(stack, 'subnet1', { subnetId : 'pub-1', availabilityZone: '' }); + const subnet = Subnet.fromSubnetAttributes(stack, 'subnet1', { subnetId: 'pub-1', availabilityZone: '' }); // THEN test.deepEqual(subnet.subnetId, 'pub-1'); - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len test.throws(() => subnet.availabilityZone, "You cannot reference a Subnet's availability zone if it was not supplied. Add the availabilityZone when importing using Subnet.fromSubnetAttributes()"); test.done(); }, @@ -1203,7 +1203,7 @@ nodeunitShim({ const stack = getTestStack(); // WHEN - const subnet = Subnet.fromSubnetAttributes(stack, 'subnet1', { subnetId : 'pub-1', availabilityZone: 'az-1234' }); + const subnet = Subnet.fromSubnetAttributes(stack, 'subnet1', { subnetId: 'pub-1', availabilityZone: 'az-1234' }); // THEN test.deepEqual(subnet.subnetId, 'pub-1'); @@ -1305,11 +1305,11 @@ function hasTags(expectedTags: Array<{Key: string, Value: string}>): (props: any }); return actualTags.length === expectedTags.length; } catch (e) { - // tslint:disable:no-console + /* eslint-disable no-console */ console.error('Tags are incorrect'); console.error('found tags ', props.Tags); console.error('expected tags ', expectedTags); - // tslint:enable:no-console + /* eslint-enable no-console */ throw e; } }; diff --git a/packages/@aws-cdk/aws-ecr-assets/test/test.image-asset.ts b/packages/@aws-cdk/aws-ecr-assets/test/test.image-asset.ts index 3a3d0d94e5661..54930ec176e14 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/test.image-asset.ts +++ b/packages/@aws-cdk/aws-ecr-assets/test/test.image-asset.ts @@ -7,7 +7,7 @@ import { Test } from 'nodeunit'; import * as path from 'path'; import { DockerImageAsset } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'test instantiating Asset Image'(test: Test) { diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts b/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts index 9feece9392f8e..a7b1766081354 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts +++ b/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as cdk from '@aws-cdk/core'; import * as ecr from '../lib'; diff --git a/packages/@aws-cdk/aws-ecr/test/test.repository.ts b/packages/@aws-cdk/aws-ecr/test/test.repository.ts index f93cfe16fe006..f53e67310d7e5 100644 --- a/packages/@aws-cdk/aws-ecr/test/test.repository.ts +++ b/packages/@aws-cdk/aws-ecr/test/test.repository.ts @@ -4,7 +4,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as ecr from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'construct repository'(test: Test) { @@ -51,7 +51,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":1,"selection":{"tagStatus":"tagged","tagPrefixList":["abc"],"countType":"imageCountMoreThan","countNumber":1},"action":{"type":"expire"}}]}', }, })); @@ -72,7 +72,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":1,"selection":{"tagStatus":"any","countType":"sinceImagePushed","countNumber":5,"countUnit":"days"},"action":{"type":"expire"}}]}', }, })); @@ -93,7 +93,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":1,"selection":{"tagStatus":"any","countType":"imageCountMoreThan","countNumber":5},"action":{"type":"expire"}}]}', }, })); @@ -113,7 +113,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":10,"selection":{"tagStatus":"tagged","tagPrefixList":["b"],"countType":"imageCountMoreThan","countNumber":5},"action":{"type":"expire"}},{"rulePriority":11,"selection":{"tagStatus":"tagged","tagPrefixList":["a"],"countType":"imageCountMoreThan","countNumber":5},"action":{"type":"expire"}}]}', }, })); @@ -133,7 +133,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":1,"selection":{"tagStatus":"tagged","tagPrefixList":["important"],"countType":"imageCountMoreThan","countNumber":999},"action":{"type":"expire"}},{"rulePriority":2,"selection":{"tagStatus":"any","countType":"imageCountMoreThan","countNumber":5},"action":{"type":"expire"}}]}', }, })); @@ -155,7 +155,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { 'LifecyclePolicy': { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'LifecyclePolicyText': '{"rules":[{"rulePriority":1,"selection":{"tagStatus":"any","countType":"imageCountMoreThan","countNumber":3},"action":{"type":"expire"}}]}', }, })); diff --git a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts index 6e37c99b2250a..acf23a40e9305 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts @@ -591,7 +591,7 @@ export abstract class BaseService extends Resource * This method is called to create a networkConfiguration. * @deprecated use configureAwsVpcNetworkingWithSecurityGroups instead. */ - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len protected configureAwsVpcNetworking(vpc: ec2.IVpc, assignPublicIp?: boolean, vpcSubnets?: ec2.SubnetSelection, securityGroup?: ec2.ISecurityGroup) { if (vpcSubnets === undefined) { vpcSubnets = assignPublicIp ? { subnetType: ec2.SubnetType.PUBLIC } : {}; @@ -613,7 +613,7 @@ export abstract class BaseService extends Resource /** * This method is called to create a networkConfiguration. */ - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len protected configureAwsVpcNetworkingWithSecurityGroups(vpc: ec2.IVpc, assignPublicIp?: boolean, vpcSubnets?: ec2.SubnetSelection, securityGroups?: ec2.ISecurityGroup[]) { if (vpcSubnets === undefined) { vpcSubnets = assignPublicIp ? { subnetType: ec2.SubnetType.PUBLIC } : {}; diff --git a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts b/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts index 8560a3c0e2ba7..447cd0224b114 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts @@ -6,7 +6,6 @@ import { Construct } from '@aws-cdk/core'; /** * The properties of a scalable attribute representing task count. */ -// tslint:disable-next-line:no-empty-interface export interface ScalableTaskCountProps extends appscaling.BaseScalableAttributeProps { } diff --git a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts b/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts index a04e51781b018..94bc5bbef39b4 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts @@ -341,7 +341,7 @@ export class TaskDefinition extends TaskDefinitionBase { const targetContainerPort = options.containerPort || targetContainer.containerPort; const portMapping = targetContainer.findPortMapping(targetContainerPort, targetProtocol); if (portMapping === undefined) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Container '${targetContainer}' has no mapping for port ${options.containerPort} and protocol ${targetProtocol}. Did you call "container.addPortMappings()"?`); } return { diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-task-definition.ts b/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-task-definition.ts index d6bee7ccea946..a22c4801fcebb 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-task-definition.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-task-definition.ts @@ -420,7 +420,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ECR::Repository', { LifecyclePolicy: { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len LifecyclePolicyText: '{"rules":[{"rulePriority":10,"selection":{"tagStatus":"tagged","tagPrefixList":["abc"],"countType":"imageCountMoreThan","countNumber":1},"action":{"type":"expire"}}]}', RegistryId: '123456789101', }, diff --git a/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts b/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts index b7d4b59a47e79..d0be3430ceb50 100644 --- a/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts +++ b/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts @@ -56,7 +56,7 @@ export = { { Ref: 'EcsCluster97242B84', }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', ], ], @@ -201,7 +201,7 @@ export = { { Ref: 'EcsCluster97242B84', }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', ], ], @@ -501,7 +501,7 @@ export = { { Ref: 'EcsCluster97242B84', }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', ], ], @@ -1259,7 +1259,7 @@ export = { { Ref: 'EcsCluster97242B84', }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', ], ], diff --git a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts index 942be37ca9a3f..8103ee40bae79 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts @@ -4,13 +4,11 @@ import { ConcreteDependable, Construct, IDependable, IResource, RemovalPolicy, R import { AccessPoint, AccessPointOptions } from './access-point'; import { CfnFileSystem, CfnMountTarget } from './efs.generated'; -// tslint:disable:max-line-length /** * EFS Lifecycle Policy, if a file is not accessed for given days, it will move to EFS Infrequent Access. * * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-lifecyclepolicies */ -// tslint:enable export enum LifecyclePolicy { /** * After 7 days of not being accessed. diff --git a/packages/@aws-cdk/aws-eks-legacy/test/test.awsauth.ts b/packages/@aws-cdk/aws-eks-legacy/test/test.awsauth.ts index 6bdf28747b11e..c9bba19a0e35e 100644 --- a/packages/@aws-cdk/aws-eks-legacy/test/test.awsauth.ts +++ b/packages/@aws-cdk/aws-eks-legacy/test/test.awsauth.ts @@ -5,7 +5,7 @@ import { Cluster, KubernetesResource } from '../lib'; import { AwsAuth } from '../lib/aws-auth'; import { testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'empty aws-auth'(test: Test) { diff --git a/packages/@aws-cdk/aws-eks-legacy/test/test.cluster.ts b/packages/@aws-cdk/aws-eks-legacy/test/test.cluster.ts index 3e536e0b92f6e..92b1dab642b6b 100644 --- a/packages/@aws-cdk/aws-eks-legacy/test/test.cluster.ts +++ b/packages/@aws-cdk/aws-eks-legacy/test/test.cluster.ts @@ -7,7 +7,7 @@ import * as eks from '../lib'; import { spotInterruptHandler } from '../lib/spot-interrupt-handler'; import { testFixture, testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'a default cluster spans all subnets'(test: Test) { diff --git a/packages/@aws-cdk/aws-eks-legacy/test/test.helm-chart.ts b/packages/@aws-cdk/aws-eks-legacy/test/test.helm-chart.ts index e2a621871d023..5bdec9c9e62a3 100644 --- a/packages/@aws-cdk/aws-eks-legacy/test/test.helm-chart.ts +++ b/packages/@aws-cdk/aws-eks-legacy/test/test.helm-chart.ts @@ -3,7 +3,7 @@ import { Test } from 'nodeunit'; import * as eks from '../lib'; import { testFixtureCluster } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'add Helm chart': { diff --git a/packages/@aws-cdk/aws-eks-legacy/test/test.manifest.ts b/packages/@aws-cdk/aws-eks-legacy/test/test.manifest.ts index 21459b633f6b0..30afa40e3069e 100644 --- a/packages/@aws-cdk/aws-eks-legacy/test/test.manifest.ts +++ b/packages/@aws-cdk/aws-eks-legacy/test/test.manifest.ts @@ -3,7 +3,7 @@ import { Test } from 'nodeunit'; import { Cluster, KubernetesResource } from '../lib'; import { testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'basic usage'(test: Test) { diff --git a/packages/@aws-cdk/aws-eks-legacy/test/test.user-data.ts b/packages/@aws-cdk/aws-eks-legacy/test/test.user-data.ts index c3d62ede114b4..e841ebf280d62 100644 --- a/packages/@aws-cdk/aws-eks-legacy/test/test.user-data.ts +++ b/packages/@aws-cdk/aws-eks-legacy/test/test.user-data.ts @@ -4,7 +4,7 @@ import { App, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { renderUserData } from '../lib/user-data'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'default user data'(test: Test) { diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts index f20ddd85c5704..d88c8900e3020 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; // eslint-disable-next-line import/no-extraneous-dependencies diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts index 57d3ae20f8cef..7383689e4a95a 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts @@ -60,7 +60,7 @@ export abstract class ResourceHandler { } protected log(x: any) { - // tslint:disable-next-line: no-console + // eslint-disable-next-line no-console console.log(JSON.stringify(x, undefined, 2)); } diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts index f2b796297246a..d1be0c12e1e38 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; // eslint-disable-next-line import/no-extraneous-dependencies diff --git a/packages/@aws-cdk/aws-eks/lib/user-data.ts b/packages/@aws-cdk/aws-eks/lib/user-data.ts index b613663b42a67..cf38cf7ee9761 100644 --- a/packages/@aws-cdk/aws-eks/lib/user-data.ts +++ b/packages/@aws-cdk/aws-eks/lib/user-data.ts @@ -2,7 +2,7 @@ import * as autoscaling from '@aws-cdk/aws-autoscaling'; import { Stack } from '@aws-cdk/core'; import { BootstrapOptions, ICluster } from './cluster'; -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export function renderAmazonLinuxUserData(clusterName: string, autoScalingGroup: autoscaling.AutoScalingGroup, options: BootstrapOptions = {}): string[] { const stack = Stack.of(autoScalingGroup); diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts index f346b24dee180..50665e154833a 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts +++ b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; import { App, CfnOutput, Duration } from '@aws-cdk/core'; diff --git a/packages/@aws-cdk/aws-eks/test/test.awsauth.ts b/packages/@aws-cdk/aws-eks/test/test.awsauth.ts index ca13492487027..998dd00c184fb 100644 --- a/packages/@aws-cdk/aws-eks/test/test.awsauth.ts +++ b/packages/@aws-cdk/aws-eks/test/test.awsauth.ts @@ -5,7 +5,7 @@ import { Cluster, KubernetesResource, KubernetesVersion } from '../lib'; import { AwsAuth } from '../lib/aws-auth'; import { testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ const CLUSTER_VERSION = KubernetesVersion.V1_16; diff --git a/packages/@aws-cdk/aws-eks/test/test.cluster.ts b/packages/@aws-cdk/aws-eks/test/test.cluster.ts index 4101348a06774..784e8c94f3b2c 100644 --- a/packages/@aws-cdk/aws-eks/test/test.cluster.ts +++ b/packages/@aws-cdk/aws-eks/test/test.cluster.ts @@ -1,8 +1,8 @@ +import * as fs from 'fs'; import { countResources, expect, haveResource, haveResourceLike, not } from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as fs from 'fs'; import { Test } from 'nodeunit'; import * as path from 'path'; import * as YAML from 'yaml'; @@ -10,7 +10,7 @@ import * as eks from '../lib'; import { KubectlLayer } from '../lib/kubectl-layer'; import { testFixture, testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ const CLUSTER_VERSION = eks.KubernetesVersion.V1_16; diff --git a/packages/@aws-cdk/aws-eks/test/test.helm-chart.ts b/packages/@aws-cdk/aws-eks/test/test.helm-chart.ts index 5041cc6a17701..a0340ff817ed6 100644 --- a/packages/@aws-cdk/aws-eks/test/test.helm-chart.ts +++ b/packages/@aws-cdk/aws-eks/test/test.helm-chart.ts @@ -4,7 +4,7 @@ import { Test } from 'nodeunit'; import * as eks from '../lib'; import { testFixtureCluster } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'add Helm chart': { diff --git a/packages/@aws-cdk/aws-eks/test/test.manifest.ts b/packages/@aws-cdk/aws-eks/test/test.manifest.ts index 565cf28aaffbf..567a3d50abcde 100644 --- a/packages/@aws-cdk/aws-eks/test/test.manifest.ts +++ b/packages/@aws-cdk/aws-eks/test/test.manifest.ts @@ -3,7 +3,7 @@ import { Test } from 'nodeunit'; import { Cluster, KubernetesResource, KubernetesVersion } from '../lib'; import { testFixtureNoVpc } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ const CLUSTER_VERSION = KubernetesVersion.V1_16; diff --git a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts index 226fd09bc30e9..16c81f6567cbc 100644 --- a/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts +++ b/packages/@aws-cdk/aws-eks/test/test.nodegroup.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import * as eks from '../lib'; import { testFixture } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ const CLUSTER_VERSION = eks.KubernetesVersion.V1_16; diff --git a/packages/@aws-cdk/aws-eks/test/test.service-account.ts b/packages/@aws-cdk/aws-eks/test/test.service-account.ts index 8c83c62da2810..06c17a6bdd1a0 100644 --- a/packages/@aws-cdk/aws-eks/test/test.service-account.ts +++ b/packages/@aws-cdk/aws-eks/test/test.service-account.ts @@ -4,7 +4,7 @@ import { Test } from 'nodeunit'; import * as eks from '../lib'; import { testFixtureCluster } from './util'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'add Service Account': { diff --git a/packages/@aws-cdk/aws-eks/test/test.user-data.ts b/packages/@aws-cdk/aws-eks/test/test.user-data.ts index 021cad8f16d3b..69a3bde80a1cb 100644 --- a/packages/@aws-cdk/aws-eks/test/test.user-data.ts +++ b/packages/@aws-cdk/aws-eks/test/test.user-data.ts @@ -4,7 +4,7 @@ import { App, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { renderAmazonLinuxUserData } from '../lib/user-data'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ export = { 'default user data'(test: Test) { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts index 6809b777a9343..7897f5582eb0a 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts @@ -308,7 +308,7 @@ export class ApplicationListener extends BaseListener implements IApplicationLis */ public addTargets(id: string, props: AddApplicationTargetsProps): ApplicationTargetGroup { if (!this.loadBalancer.vpc) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error('Can only call addTargets() when using a constructed Load Balancer or an imported Load Balancer with specified vpc; construct a new TargetGroup and use addTargetGroup'); } @@ -594,7 +594,7 @@ class ImportedApplicationListener extends Resource implements IApplicationListen * @returns The newly created target group */ public addTargets(_id: string, _props: AddApplicationTargetsProps): ApplicationTargetGroup { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error('Can only call addTargets() when using a constructed ApplicationListener; construct a new TargetGroup and use addTargetGroup.'); } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts index bbf91ed8834e4..a9e469394b8c3 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts @@ -561,13 +561,13 @@ class ImportedApplicationLoadBalancer extends Resource implements IApplicationLo public get loadBalancerCanonicalHostedZoneId(): string { if (this.props.loadBalancerCanonicalHostedZoneId) { return this.props.loadBalancerCanonicalHostedZoneId; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`'loadBalancerCanonicalHostedZoneId' was not provided when constructing Application Load Balancer ${this.node.path} from attributes`); } public get loadBalancerDnsName(): string { if (this.props.loadBalancerDnsName) { return this.props.loadBalancerDnsName; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`'loadBalancerDnsName' was not provided when constructing Application Load Balancer ${this.node.path} from attributes`); } } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index 691d2b100a64e..4a4d66a952abb 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -181,7 +181,7 @@ export class NetworkListener extends BaseListener implements INetworkListener { */ public addTargets(id: string, props: AddNetworkTargetsProps): NetworkTargetGroup { if (!this.loadBalancer.vpc) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error('Can only call addTargets() when using a constructed Load Balancer or imported Load Balancer with specified VPC; construct a new TargetGroup and use addTargetGroup'); } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts index cf7ccbf04b1ed..28e23cc56a257 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts @@ -69,13 +69,13 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa public get loadBalancerCanonicalHostedZoneId(): string { if (attrs.loadBalancerCanonicalHostedZoneId) { return attrs.loadBalancerCanonicalHostedZoneId; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`'loadBalancerCanonicalHostedZoneId' was not provided when constructing Network Load Balancer ${this.node.path} from attributes`); } public get loadBalancerDnsName(): string { if (attrs.loadBalancerDnsName) { return attrs.loadBalancerDnsName; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`'loadBalancerDnsName' was not provided when constructing Network Load Balancer ${this.node.path} from attributes`); } } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts index 12e5ea3dd715f..36a30433361de 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts @@ -151,7 +151,6 @@ export class NetworkTargetGroup extends TargetGroupBase implements INetworkTarge /** * A network target group */ -// tslint:disable-next-line:no-empty-interface export interface INetworkTargetGroup extends ITargetGroup { /** * Register a listener that is load balancing to this target group. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts index 3281aa8deb02f..2776d533faefa 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts @@ -50,7 +50,7 @@ export function defaultProtocolForPort(port: number): ApplicationProtocol { /** * Given a protocol and a port, try to guess the other one if it's undefined */ -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export function determineProtocolAndPort(protocol: ApplicationProtocol | undefined, port: number | undefined): [ApplicationProtocol | undefined, number | undefined] { if (protocol === undefined && port === undefined) { return [undefined, undefined]; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.target-group.ts index 72c4132d6e218..d4ae698b3a258 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.target-group.ts @@ -84,16 +84,16 @@ export = { // THEN expect(stack).to(haveResource('AWS::ElasticLoadBalancingV2::TargetGroup', { - HealthCheckEnabled : true, - HealthCheckIntervalSeconds : 255, - HealthCheckPath : '/arbitrary', - HealthCheckTimeoutSeconds : 192, - HealthyThresholdCount : 29, - Matcher : { - HttpCode : '255', + HealthCheckEnabled: true, + HealthCheckIntervalSeconds: 255, + HealthCheckPath: '/arbitrary', + HealthCheckTimeoutSeconds: 192, + HealthyThresholdCount: 29, + Matcher: { + HttpCode: '255', }, Port: 80, - UnhealthyThresholdCount : 27, + UnhealthyThresholdCount: 27, })); test.done(); diff --git a/packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts b/packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts index 3d8a4aceffebf..88158298e2e7c 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts +++ b/packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ // eslint-disable-next-line import/no-extraneous-dependencies import * as AWS from 'aws-sdk'; import { AwsApiInput } from '../aws-api'; diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/aws-api-handler.test.ts b/packages/@aws-cdk/aws-events-targets/test/aws-api/aws-api-handler.test.ts index 6697ce91dd77a..bfe355090fe3e 100644 --- a/packages/@aws-cdk/aws-events-targets/test/aws-api/aws-api-handler.test.ts +++ b/packages/@aws-cdk/aws-events-targets/test/aws-api/aws-api-handler.test.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ import * as SDK from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { AwsApiProps } from '../../lib'; diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts b/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts index 9dc135dfef993..cc1b49612b04e 100644 --- a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts +++ b/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as events from '@aws-cdk/aws-events'; import * as cdk from '@aws-cdk/core'; import * as targets from '../../lib'; diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts b/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts index d42173c6fc188..17d17a291e244 100644 --- a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts +++ b/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts @@ -25,7 +25,7 @@ timer2.addTarget(new targets.LambdaFunction(fn)); app.synth(); -// tslint:disable:no-console +/* eslint-disable no-console */ function handler(event: any, _context: any, callback: any) { console.log(JSON.stringify(event, undefined, 2)); return callback(); diff --git a/packages/@aws-cdk/aws-events/test/test.rule.ts b/packages/@aws-cdk/aws-events/test/test.rule.ts index 304bf91ed4dcb..2b669e92491d9 100644 --- a/packages/@aws-cdk/aws-events/test/test.rule.ts +++ b/packages/@aws-cdk/aws-events/test/test.rule.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import { EventBus, EventField, IRule, IRuleTarget, RuleTargetConfig, RuleTargetInput, Schedule } from '../lib'; import { Rule } from '../lib/rule'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default rule'(test: Test) { diff --git a/packages/@aws-cdk/aws-globalaccelerator/lib/endpoint-group.ts b/packages/@aws-cdk/aws-globalaccelerator/lib/endpoint-group.ts index cc81779c7131c..b26b2bf5a8625 100644 --- a/packages/@aws-cdk/aws-globalaccelerator/lib/endpoint-group.ts +++ b/packages/@aws-cdk/aws-globalaccelerator/lib/endpoint-group.ts @@ -130,7 +130,7 @@ export class EndpointConfiguration extends cdk.Construct { return { clientIpPreservationEnabled: this.props.clientIpReservation, endpointId: this.props.endpointId, - weight: this.props.weight, + weight: this.props.weight, }; } } diff --git a/packages/@aws-cdk/aws-glue/test/test.schema.ts b/packages/@aws-cdk/aws-glue/test/test.schema.ts index a78f056c0214c..22246b5015723 100644 --- a/packages/@aws-cdk/aws-glue/test/test.schema.ts +++ b/packages/@aws-cdk/aws-glue/test/test.schema.ts @@ -267,7 +267,7 @@ export = { test.equals(type.isPrimitive, false); test.equals( type.inputString, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'struct,map:map,nested_struct:struct>'); test.done(); }, diff --git a/packages/@aws-cdk/aws-iam/lib/grant.ts b/packages/@aws-cdk/aws-iam/lib/grant.ts index 0f882c4a73d00..c0cb065f7ee2c 100644 --- a/packages/@aws-cdk/aws-iam/lib/grant.ts +++ b/packages/@aws-cdk/aws-iam/lib/grant.ts @@ -255,7 +255,7 @@ export class Grant implements cdk.IDependable { */ public assertSuccess(): void { if (!this.success) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`${describeGrant(this.options)} could not be added on either identity or resource policy.`); } } diff --git a/packages/@aws-cdk/aws-iam/lib/lazy-role.ts b/packages/@aws-cdk/aws-iam/lib/lazy-role.ts index bfc83817ad0f8..febb6372d25e6 100644 --- a/packages/@aws-cdk/aws-iam/lib/lazy-role.ts +++ b/packages/@aws-cdk/aws-iam/lib/lazy-role.ts @@ -9,7 +9,6 @@ import { IRole, Role, RoleProps } from './role'; /** * Properties for defining a LazyRole */ -// tslint:disable-next-line:no-empty-interface export interface LazyRoleProps extends RoleProps { } diff --git a/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts b/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts index 06fe2395f687f..b8345827699d1 100644 --- a/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts +++ b/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts @@ -1,5 +1,5 @@ -import { Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, IResource, Resource, Stack, Token } from '@aws-cdk/core'; import * as path from 'path'; +import { Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, IResource, Resource, Stack, Token } from '@aws-cdk/core'; const RESOURCE_TYPE = 'Custom::AWSCDKOpenIdConnectProvider'; diff --git a/packages/@aws-cdk/aws-iam/lib/oidc-provider/external.ts b/packages/@aws-cdk/aws-iam/lib/oidc-provider/external.ts index 43512b4bc7a4e..d926caf405e22 100644 --- a/packages/@aws-cdk/aws-iam/lib/oidc-provider/external.ts +++ b/packages/@aws-cdk/aws-iam/lib/oidc-provider/external.ts @@ -1,9 +1,9 @@ /* istanbul ignore file */ -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; import * as tls from 'tls'; import * as url from 'url'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; let client: aws.IAM; @@ -13,7 +13,7 @@ function iam() { } function defaultLogger(fmt: string, ...args: any[]) { - // tslint:disable-next-line: no-console + // eslint-disable-next-line no-console console.log(fmt, ...args); } @@ -41,7 +41,7 @@ async function downloadThumbprint(issuerUrl: string) { } // allows unit test to replace with mocks -// tslint:disable:max-line-length +/* eslint-disable max-len */ export const external = { downloadThumbprint, log: defaultLogger, diff --git a/packages/@aws-cdk/aws-iam/test/escape-hatch.test.ts b/packages/@aws-cdk/aws-iam/test/escape-hatch.test.ts index 95498d8fcb926..4aa2ce2e9ddb8 100644 --- a/packages/@aws-cdk/aws-iam/test/escape-hatch.test.ts +++ b/packages/@aws-cdk/aws-iam/test/escape-hatch.test.ts @@ -5,7 +5,7 @@ import '@aws-cdk/assert/jest'; import { Stack } from '@aws-cdk/core'; import * as iam from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('IAM escape hatches', () => { test('addPropertyOverride should allow overriding supported properties', () => { diff --git a/packages/@aws-cdk/aws-iam/test/immutable-role.test.ts b/packages/@aws-cdk/aws-iam/test/immutable-role.test.ts index 51bb0d2496c0f..0a14afee947a5 100644 --- a/packages/@aws-cdk/aws-iam/test/immutable-role.test.ts +++ b/packages/@aws-cdk/aws-iam/test/immutable-role.test.ts @@ -2,7 +2,7 @@ import '@aws-cdk/assert/jest'; import { Construct, Stack } from '@aws-cdk/core'; import * as iam from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('ImmutableRole', () => { let stack: Stack; diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts b/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts index 576f6bd835083..3a8efb6f1ecb5 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import { App, CfnJson, CfnParameter, Construct, Stack } from '@aws-cdk/core'; import { AccountRootPrincipal, Role } from '../lib'; diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts b/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts index 33a241251f4bf..d428ff1204e54 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import { App, Stack } from '@aws-cdk/core'; import * as iam from '../lib'; @@ -21,4 +22,4 @@ new iam.OpenIdConnectProvider(stack, 'Thumbprints', { ], }); -app.synth(); \ No newline at end of file +app.synth(); diff --git a/packages/@aws-cdk/aws-iam/test/policy-statement.test.ts b/packages/@aws-cdk/aws-iam/test/policy-statement.test.ts index e5dd73e49c684..0712e982bc0e8 100644 --- a/packages/@aws-cdk/aws-iam/test/policy-statement.test.ts +++ b/packages/@aws-cdk/aws-iam/test/policy-statement.test.ts @@ -129,32 +129,32 @@ describe('IAM policy statement', () => { /* tslint:disable */ const policyDocument = { - 'Version': '2012-10-17', - 'Statement': [ + Version: '2012-10-17', + Statement: [ { - 'Sid': 'FirstStatement', - 'Effect': 'Allow', - 'Action': 'iam:ChangePassword', - 'Resource': '*', + Sid: 'FirstStatement', + Effect: 'Allow', + Action: 'iam:ChangePassword', + Resource: '*', }, { - 'Sid': 'SecondStatement', - 'Effect': 'Allow', - 'Action': 's3:ListAllMyBuckets', - 'Resource': '*', + Sid: 'SecondStatement', + Effect: 'Allow', + Action: 's3:ListAllMyBuckets', + Resource: '*', }, { - 'Sid': 'ThirdStatement', - 'Effect': 'Allow', - 'Action': [ + Sid: 'ThirdStatement', + Effect: 'Allow', + Action: [ 's3:List*', 's3:Get*', ], - 'Resource': [ + Resource: [ 'arn:aws:s3:::confidential-data', 'arn:aws:s3:::confidential-data/*', ], - 'Condition': {'Bool': {'aws:MultiFactorAuthPresent': 'true'}}, + Condition: {Bool: {'aws:MultiFactorAuthPresent': 'true'}}, }, ], }; diff --git a/packages/@aws-cdk/aws-iam/test/policy.test.ts b/packages/@aws-cdk/aws-iam/test/policy.test.ts index 2ca1e54b7154c..479476854b6c3 100644 --- a/packages/@aws-cdk/aws-iam/test/policy.test.ts +++ b/packages/@aws-cdk/aws-iam/test/policy.test.ts @@ -3,7 +3,7 @@ import '@aws-cdk/assert/jest'; import { App, CfnResource, Stack } from '@aws-cdk/core'; import { AnyPrincipal, CfnPolicy, Group, Policy, PolicyStatement, Role, ServicePrincipal, User } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('IAM policy', () => { let app: App; diff --git a/packages/@aws-cdk/aws-iam/test/role.from-role-arn.test.ts b/packages/@aws-cdk/aws-iam/test/role.from-role-arn.test.ts index 528cacee14faa..295cae174fe6a 100644 --- a/packages/@aws-cdk/aws-iam/test/role.from-role-arn.test.ts +++ b/packages/@aws-cdk/aws-iam/test/role.from-role-arn.test.ts @@ -2,7 +2,7 @@ import '@aws-cdk/assert/jest'; import { App, CfnElement, Lazy, Stack } from '@aws-cdk/core'; import { AnyPrincipal, ArnPrincipal, IRole, Policy, PolicyStatement, Role } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ const roleAccount = '123456789012'; const notRoleAccount = '012345678901'; @@ -292,7 +292,7 @@ describe('IAM Role.fromRoleArn', () => { describe('that belongs to a stack with account equal to the account in the imported role ARN', () => { beforeEach(() => { - policyStack = new Stack(app, 'PolicyStack', { env: { account : roleAccount } }); + policyStack = new Stack(app, 'PolicyStack', { env: { account: roleAccount } }); importedRole.attachInlinePolicy(somePolicy(policyStack, 'MyPolicy')); }); diff --git a/packages/@aws-cdk/aws-kinesis/test/stream.test.ts b/packages/@aws-cdk/aws-kinesis/test/stream.test.ts index 40bbe5ea8097b..b9a5216e1b6a6 100644 --- a/packages/@aws-cdk/aws-kinesis/test/stream.test.ts +++ b/packages/@aws-cdk/aws-kinesis/test/stream.test.ts @@ -4,7 +4,7 @@ import * as kms from '@aws-cdk/aws-kms'; import { App, Duration, Stack } from '@aws-cdk/core'; import { Stream, StreamEncryption } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('Kinesis data streams', () => { diff --git a/packages/@aws-cdk/aws-kms/lib/alias.ts b/packages/@aws-cdk/aws-kms/lib/alias.ts index 2ba88fdb650ce..b91a7b1187a89 100644 --- a/packages/@aws-cdk/aws-kms/lib/alias.ts +++ b/packages/@aws-cdk/aws-kms/lib/alias.ts @@ -129,7 +129,6 @@ export class Alias extends AliasBase { * @param attrs the properties of the referenced KMS Alias */ public static fromAliasAttributes(scope: Construct, id: string, attrs: AliasAttributes): IAlias { - // tslint:disable-next-line: class-name class _Alias extends AliasBase { public get aliasName() { return attrs.aliasName; } public get aliasTargetKey() { return attrs.aliasTargetKey; } diff --git a/packages/@aws-cdk/aws-kms/test/test.alias.ts b/packages/@aws-cdk/aws-kms/test/test.alias.ts index 33df260bbf8e2..dc931220febaa 100644 --- a/packages/@aws-cdk/aws-kms/test/test.alias.ts +++ b/packages/@aws-cdk/aws-kms/test/test.alias.ts @@ -4,7 +4,7 @@ import { Test } from 'nodeunit'; import { Alias } from '../lib/alias'; import { IKey, Key } from '../lib/key'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default alias'(test: Test) { diff --git a/packages/@aws-cdk/aws-kms/test/test.key.ts b/packages/@aws-cdk/aws-kms/test/test.key.ts index 7adfd1d052d5c..05ff62d596a67 100644 --- a/packages/@aws-cdk/aws-kms/test/test.key.ts +++ b/packages/@aws-cdk/aws-kms/test/test.key.ts @@ -12,7 +12,7 @@ import { App, CfnOutput, RemovalPolicy, Stack, Tag } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { Key } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ const ACTIONS: string[] = [ 'kms:Create*', 'kms:Describe*', diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.expected.json b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.expected.json index 135d1ca0514a2..0e57bd7dc85d1 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.expected.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.expected.json @@ -91,7 +91,7 @@ "Type": "AWS::Lambda::Function", "Properties": { "Code": { - "ZipFile": "exports.handler = async function handler(event) {\n // tslint:disable-next-line:no-console\n console.log('event:', JSON.stringify(event, undefined, 2));\n throw new Error();\n}" + "ZipFile": "exports.handler = async function handler(event) {\n // eslint-disable-next-line no-console\n console.log('event:', JSON.stringify(event, undefined, 2));\n throw new Error();\n}" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts index 6a9f0f621d1b5..73ed35b217b81 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts @@ -12,7 +12,7 @@ import { KinesisEventSource, SqsDlq } from '../lib'; */ async function handler(event: any) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log('event:', JSON.stringify(event, undefined, 2)); throw new Error(); } diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json index bfcb316461be5..a59e90cbe486d 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json @@ -176,7 +176,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // tslint:disable-next-line:max-line-length\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" + "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // eslint-disable-next-line max-len\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test-function.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test-function.ts index 1328875986981..ab686f17a1185 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test-function.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test-function.ts @@ -11,7 +11,7 @@ export class TestFunction extends lambda.Function { } } -// tslint:disable:no-console +/* eslint-disable no-console */ async function handler(event: any) { console.log('event:', JSON.stringify(event, undefined, 2)); return { event }; diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test.dynamo.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test.dynamo.ts index 008a820f295cf..745b016109d30 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test.dynamo.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test.dynamo.ts @@ -7,7 +7,7 @@ import { Test } from 'nodeunit'; import * as sources from '../lib'; import { TestFunction } from './test-function'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'sufficiently complex example'(test: Test) { @@ -66,7 +66,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'BatchSize': 100, @@ -102,7 +102,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'BatchSize': 50, @@ -200,7 +200,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'MaximumBatchingWindowInSeconds': 120, @@ -300,7 +300,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'MaximumRetryAttempts': 10, @@ -380,7 +380,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'BisectBatchOnFunctionError': true, @@ -416,7 +416,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'ParallelizationFactor': 5, @@ -496,7 +496,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'MaximumRecordAgeInSeconds': 100, @@ -577,7 +577,7 @@ export = { 'StreamArn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'DestinationConfig': { diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test.kinesis.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test.kinesis.ts index 8a7a69c255567..9ee1a1d9c25e0 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test.kinesis.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test.kinesis.ts @@ -6,7 +6,7 @@ import { Test } from 'nodeunit'; import * as sources from '../lib'; import { TestFunction } from './test-function'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'sufficiently complex example'(test: Test) { @@ -66,7 +66,7 @@ export = { 'Arn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'BatchSize': 100, @@ -96,7 +96,7 @@ export = { 'Arn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'BatchSize': 50, @@ -156,7 +156,7 @@ export = { 'Arn', ], }, - 'FunctionName': { + 'FunctionName': { 'Ref': 'Fn9270CBC0', }, 'MaximumBatchingWindowInSeconds': 120, diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test.s3.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test.s3.ts index 321502a62df92..bb7111b0d3a7b 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test.s3.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test.s3.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import * as sources from '../lib'; import { TestFunction } from './test-function'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'sufficiently complex example'(test: Test) { diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test.sns.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test.sns.ts index 4a83b510d2bf1..12224e95b6040 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test.sns.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test.sns.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import * as sources from '../lib'; import { TestFunction } from './test-function'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'sufficiently complex example'(test: Test) { diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/test.sqs.ts b/packages/@aws-cdk/aws-lambda-event-sources/test/test.sqs.ts index 22abb1243dc33..c2fcf18239b64 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/test.sqs.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/test.sqs.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import * as sources from '../lib'; import { TestFunction } from './test-function'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'defaults'(test: Test) { diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts b/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts index 31abbb04b4cfe..3cadcf1746f65 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ import { S3 } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies import * as delay from 'delay'; diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts b/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts index 5bfa54ae0f09f..94da6641cb2bd 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts @@ -1,5 +1,5 @@ import { mult } from './util'; export async function handler(): Promise { - console.log(mult(3, 4)); // tslint:disable-line no-console + console.log(mult(3, 4)); // eslint-disable-line no-console } diff --git a/packages/@aws-cdk/aws-lambda/lib/function-base.ts b/packages/@aws-cdk/aws-lambda/lib/function-base.ts index b9a2e6b4ef166..39ad7d665fcb7 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function-base.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function-base.ts @@ -237,7 +237,7 @@ export abstract class FunctionBase extends Resource implements IFunction { */ public get connections(): ec2.Connections { if (!this._connections) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error('Only VPC-associated Lambda Functions have security groups to manage. Supply the "vpc" parameter when creating the Lambda, or "securityGroupId" when importing it.'); } return this._connections; diff --git a/packages/@aws-cdk/aws-lambda/lib/function-hash.ts b/packages/@aws-cdk/aws-lambda/lib/function-hash.ts index f37364c054e8b..fcc7cb4b75e2f 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function-hash.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function-hash.ts @@ -1,5 +1,5 @@ -import { CfnResource, Stack } from '@aws-cdk/core'; import * as crypto from 'crypto'; +import { CfnResource, Stack } from '@aws-cdk/core'; import { Function as LambdaFunction } from './function'; export function calculateFunctionHash(fn: LambdaFunction) { diff --git a/packages/@aws-cdk/aws-lambda/lib/log-retention-provider/index.ts b/packages/@aws-cdk/aws-lambda/lib/log-retention-provider/index.ts index 16d44a5fd83de..f32a6e426aea6 100644 --- a/packages/@aws-cdk/aws-lambda/lib/log-retention-provider/index.ts +++ b/packages/@aws-cdk/aws-lambda/lib/log-retention-provider/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ // eslint-disable-next-line import/no-extraneous-dependencies import * as AWS from 'aws-sdk'; diff --git a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts b/packages/@aws-cdk/aws-lambda/lib/log-retention.ts index 6c5fec2da7cd9..8e64262143a10 100644 --- a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts +++ b/packages/@aws-cdk/aws-lambda/lib/log-retention.ts @@ -1,7 +1,7 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as logs from '@aws-cdk/aws-logs'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import { Code } from './code'; import { Runtime } from './runtime'; import { SingletonFunction } from './singleton-lambda'; diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts index d8dba4b219acd..284be833fc02d 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; import * as path from 'path'; +import * as cdk from '@aws-cdk/core'; import * as lambda from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts index 5a4f23fd980fb..5efcc22f635fa 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; import * as path from 'path'; +import * as cdk from '@aws-cdk/core'; import * as lambda from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts b/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts index 6c1715bd05747..200ca72f204b6 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, Construct, Stack, StackProps } from '@aws-cdk/core'; import * as path from 'path'; +import { App, CfnOutput, Construct, Stack, StackProps } from '@aws-cdk/core'; import * as lambda from '../lib'; /** diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts b/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts index 672664da22390..a6f4e4dae32c0 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts @@ -1,5 +1,5 @@ -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; import * as path from 'path'; +import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; import * as lambda from '../lib'; class TestStack extends Stack { diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts index 81de040df8f53..d26722365c72e 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; import * as path from 'path'; +import * as cdk from '@aws-cdk/core'; import * as lambda from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts b/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts index fdfe73de0dd9f..7b4901f651252 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as logs from '@aws-cdk/aws-logs'; import * as cdk from '@aws-cdk/core'; import * as lambda from '../lib'; diff --git a/packages/@aws-cdk/aws-lambda/test/test.code.ts b/packages/@aws-cdk/aws-lambda/test/test.code.ts index 98ac8e0364cac..354771c697a0c 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.code.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.code.ts @@ -1,11 +1,11 @@ +import * as path from 'path'; import { expect, haveResource, haveResourceLike, ResourcePart } from '@aws-cdk/assert'; import * as cdk from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; import { Test } from 'nodeunit'; -import * as path from 'path'; import * as lambda from '../lib'; -// tslint:disable:no-string-literal +/* eslint-disable dot-notation */ export = { 'lambda.Code.fromInline': { diff --git a/packages/@aws-cdk/aws-lambda/test/test.function-hash.ts b/packages/@aws-cdk/aws-lambda/test/test.function-hash.ts index 4e51df039be96..b17050d43c8d0 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.function-hash.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.function-hash.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import { CfnOutput, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; -import * as path from 'path'; import * as lambda from '../lib'; import { calculateFunctionHash, trimFromStart } from '../lib/function-hash'; diff --git a/packages/@aws-cdk/aws-lambda/test/test.function.ts b/packages/@aws-cdk/aws-lambda/test/test.function.ts index ee4a003b7ad5b..d527b30d647e5 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.function.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.function.ts @@ -1,3 +1,4 @@ +import * as path from 'path'; import { expect, haveOutput, haveResource } from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as efs from '@aws-cdk/aws-efs'; @@ -7,9 +8,10 @@ import * as sqs from '@aws-cdk/aws-sqs'; import * as cdk from '@aws-cdk/core'; import * as _ from 'lodash'; import {Test, testCase} from 'nodeunit'; -import * as path from 'path'; import * as lambda from '../lib'; +/* eslint-disable quote-props */ + export = testCase({ 'add incompatible layer'(test: Test) { // GIVEN @@ -163,7 +165,6 @@ export = testCase({ logRetention: logs.RetentionDays.FIVE_DAYS, }); - // tslint:disable:no-unused-expression // Call logGroup a few times. If more than one instance of LogRetention was created, // the second call will fail on duplicate constructs. fn.logGroup; @@ -185,7 +186,6 @@ export = testCase({ }, 'currentVersion': { - // see test.function-hash.ts for more coverage for this 'logical id of version is based on the function hash'(test: Test) { // GIVEN diff --git a/packages/@aws-cdk/aws-lambda/test/test.lambda-version.ts b/packages/@aws-cdk/aws-lambda/test/test.lambda-version.ts index b442ad67b4cdf..69e0f62e9c668 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.lambda-version.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.lambda-version.ts @@ -3,7 +3,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as lambda from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'can import a Lambda version by ARN'(test: Test) { diff --git a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts index 6a697833e4700..2cecb63d05c08 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts @@ -1,3 +1,4 @@ +import * as path from 'path'; import { expect, haveResource, MatchStyle, ResourcePart } from '@aws-cdk/assert'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; @@ -5,10 +6,9 @@ import * as logs from '@aws-cdk/aws-logs'; import * as sqs from '@aws-cdk/aws-sqs'; import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; -import * as path from 'path'; import * as lambda from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default function'(test: Test) { @@ -40,7 +40,7 @@ export = { }, ManagedPolicyArns: // arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], }, }, @@ -88,7 +88,7 @@ export = { Version: '2012-10-17', }, ManagedPolicyArns: - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], }, }, @@ -171,7 +171,7 @@ export = { 'Version': '2012-10-17', }, 'ManagedPolicyArns': - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], }, }, @@ -1305,7 +1305,7 @@ export = { }, ManagedPolicyArns: // arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], }, }, diff --git a/packages/@aws-cdk/aws-lambda/test/test.layers.ts b/packages/@aws-cdk/aws-lambda/test/test.layers.ts index d5d76901152f8..9a1b2664aa268 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.layers.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.layers.ts @@ -1,9 +1,9 @@ +import * as path from 'path'; import { canonicalizeTemplate, expect, haveResource, ResourcePart, SynthUtils } from '@aws-cdk/assert'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; import { Test, testCase } from 'nodeunit'; -import * as path from 'path'; import * as lambda from '../lib'; export = testCase({ diff --git a/packages/@aws-cdk/aws-lambda/test/test.log-retention.ts b/packages/@aws-cdk/aws-lambda/test/test.log-retention.ts index 4374c95518968..b06c6089982ba 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.log-retention.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.log-retention.ts @@ -5,7 +5,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { LogRetention } from '../lib/log-retention'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'log retention construct'(test: Test) { diff --git a/packages/@aws-cdk/aws-rds/lib/instance.ts b/packages/@aws-cdk/aws-rds/lib/instance.ts index e28cf6e65771d..29b4187a1a4e4 100644 --- a/packages/@aws-cdk/aws-rds/lib/instance.ts +++ b/packages/@aws-cdk/aws-rds/lib/instance.ts @@ -439,7 +439,6 @@ export interface DatabaseInstanceNewProps { */ readonly autoMinorVersionUpgrade?: boolean; - // tslint:disable:max-line-length /** * The weekly time range (in UTC) during which system maintenance can occur. * diff --git a/packages/@aws-cdk/aws-rds/lib/parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/parameter-group.ts index 4d2899119ae63..be42fc1cbff13 100644 --- a/packages/@aws-cdk/aws-rds/lib/parameter-group.ts +++ b/packages/@aws-cdk/aws-rds/lib/parameter-group.ts @@ -119,7 +119,6 @@ export class ParameterGroup extends ParameterGroupBase { /** * Construction properties for a ClusterParameterGroup */ -// tslint:disable-next-line:no-empty-interface export interface ClusterParameterGroupProps extends ParameterGroupProps { } diff --git a/packages/@aws-cdk/aws-rds/lib/props.ts b/packages/@aws-cdk/aws-rds/lib/props.ts index 0d49713ab6933..c600c79de7037 100644 --- a/packages/@aws-cdk/aws-rds/lib/props.ts +++ b/packages/@aws-cdk/aws-rds/lib/props.ts @@ -2,7 +2,7 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as kms from '@aws-cdk/aws-kms'; import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; import { Duration, SecretValue } from '@aws-cdk/core'; -import { IParameterGroup} from './parameter-group'; +import { IParameterGroup } from './parameter-group'; /** * Instance properties for database instances diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts index 8014bbc581200..e7ec585de679b 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts +++ b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as targets from '@aws-cdk/aws-events-targets'; diff --git a/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts b/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts index dfab6894a56e4..42d5084c8079e 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts +++ b/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts @@ -17,7 +17,7 @@ test('use CloudFront as record target', () => { s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], }); diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts b/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts index a2735b0b1b6c2..6e5d8902f207d 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts +++ b/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts @@ -20,7 +20,7 @@ const distribution = new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribu s3OriginSource: { s3BucketSource: sourceBucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], }); diff --git a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts b/packages/@aws-cdk/aws-s3-assets/lib/asset.ts index 307575cf561ae..e457de127d442 100644 --- a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts +++ b/packages/@aws-cdk/aws-s3-assets/lib/asset.ts @@ -1,11 +1,11 @@ +import * as fs from 'fs'; +import * as path from 'path'; import * as assets from '@aws-cdk/assets'; import * as iam from '@aws-cdk/aws-iam'; import * as kms from '@aws-cdk/aws-kms'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; -import * as fs from 'fs'; -import * as path from 'path'; import { toSymlinkFollow } from './compat'; const ARCHIVE_EXTENSIONS = [ '.zip', '.jar' ]; diff --git a/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts b/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts index 4f0f8b9ab4519..d08005a39f692 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts @@ -143,7 +143,7 @@ test('"grantRead" also gives KMS permissions when using the new bootstrap stack' Statement: arrayWith({ Action: ['kms:Decrypt', 'kms:DescribeKey'], Effect: 'Allow', - Resource: { 'Fn::ImportValue': 'CdkBootstrap-hnb659fds-FileAssetKeyArn' }, + Resource: { 'Fn::ImportValue': 'CdkBootstrap-hnb659fds-FileAssetKeyArn' }, }), }, }); diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts index b1b144f2de275..1ba1ad26deee2 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import { App, BundlingDockerImage, Construct, Stack, StackProps } from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends Stack { diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts index 07dfe9a1c0d53..e0470ea814e92 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts index ef85353769745..7e9c8544bac21 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts index c764f97980d15..3432cf744fbb0 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts index 2f8fded27f124..df5e43865e307 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts index 2024db70d9463..c16f8da96fb00 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts +++ b/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as assets from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts index c564b2da9d6c4..0fdd4fb18da23 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts @@ -1,11 +1,11 @@ +import * as crypto from 'crypto'; +import * as fs from 'fs'; +import * as path from 'path'; import * as cloudfront from '@aws-cdk/aws-cloudfront'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import * as crypto from 'crypto'; -import * as fs from 'fs'; -import * as path from 'path'; import { ISource, SourceConfig } from './source'; const now = Date.now(); diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts index ce64692d9a9ef..0859347c66c5f 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts @@ -7,8 +7,7 @@ import * as cdk from '@aws-cdk/core'; import * as path from 'path'; import * as s3deploy from '../lib'; -// tslint:disable:max-line-length -// tslint:disable:object-literal-key-quotes +/* eslint-disable max-len */ test('deploy from local directory asset', () => { // GIVEN @@ -23,16 +22,16 @@ test('deploy from local directory asset', () => { // THEN expect(stack).toHaveResource('Custom::CDKBucketDeployment', { - 'ServiceToken': { + ServiceToken: { 'Fn::GetAtt': [ 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536', 'Arn', ], }, - 'SourceBucketNames': [{ - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3Bucket9CD8B20A', + SourceBucketNames: [{ + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3Bucket9CD8B20A', }], - 'SourceObjectKeys': [{ + SourceObjectKeys: [{ 'Fn::Join': [ '', [ @@ -43,7 +42,7 @@ test('deploy from local directory asset', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', }, ], }, @@ -56,7 +55,7 @@ test('deploy from local directory asset', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', }, ], }, @@ -65,8 +64,8 @@ test('deploy from local directory asset', () => { ], ], }], - 'DestinationBucketName': { - 'Ref': 'DestC383B82A', + DestinationBucketName: { + Ref: 'DestC383B82A', }, }); }); @@ -87,21 +86,21 @@ test('deploy from local directory assets', () => { // THEN expect(stack).toHaveResource('Custom::CDKBucketDeployment', { - 'ServiceToken': { + ServiceToken: { 'Fn::GetAtt': [ 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536', 'Arn', ], }, - 'SourceBucketNames': [ + SourceBucketNames: [ { - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3Bucket9CD8B20A', + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3Bucket9CD8B20A', }, { - 'Ref': 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3Bucket99793559', + Ref: 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3Bucket99793559', }, ], - 'SourceObjectKeys': [ + SourceObjectKeys: [ { 'Fn::Join': [ '', @@ -113,7 +112,7 @@ test('deploy from local directory assets', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', }, ], }, @@ -126,7 +125,7 @@ test('deploy from local directory assets', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', + Ref: 'AssetParametersfc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222eS3VersionKeyA58D380C', }, ], }, @@ -146,7 +145,7 @@ test('deploy from local directory assets', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3VersionKeyD9ACE665', + Ref: 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3VersionKeyD9ACE665', }, ], }, @@ -159,7 +158,7 @@ test('deploy from local directory assets', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3VersionKeyD9ACE665', + Ref: 'AssetParametersa94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cbS3VersionKeyD9ACE665', }, ], }, @@ -169,8 +168,8 @@ test('deploy from local directory assets', () => { ], }, ], - 'DestinationBucketName': { - 'Ref': 'DestC383B82A', + DestinationBucketName: { + Ref: 'DestC383B82A', }, }); }); @@ -215,16 +214,16 @@ test('honors passed asset options', () => { // THEN expect(stack).toHaveResource('Custom::CDKBucketDeployment', { - 'ServiceToken': { + ServiceToken: { 'Fn::GetAtt': [ 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536', 'Arn', ], }, - 'SourceBucketNames': [{ - 'Ref': 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3BucketB41AE64D', + SourceBucketNames: [{ + Ref: 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3BucketB41AE64D', }], - 'SourceObjectKeys': [{ + SourceObjectKeys: [{ 'Fn::Join': [ '', [ @@ -235,7 +234,7 @@ test('honors passed asset options', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3VersionKeyF3CBA38F', + Ref: 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3VersionKeyF3CBA38F', }, ], }, @@ -248,7 +247,7 @@ test('honors passed asset options', () => { 'Fn::Split': [ '||', { - 'Ref': 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3VersionKeyF3CBA38F', + Ref: 'AssetParameters86f8bca4f28a0bcafef0a98fe4cea25c0071aca27401e35cfaecd06313373bcaS3VersionKeyF3CBA38F', }, ], }, @@ -257,8 +256,8 @@ test('honors passed asset options', () => { ], ], }], - 'DestinationBucketName': { - 'Ref': 'DestC383B82A', + DestinationBucketName: { + Ref: 'DestC383B82A', }, }); }); @@ -400,7 +399,7 @@ test('distribution can be used to provide a CloudFront distribution for invalida expect(stack).toHaveResource('Custom::CDKBucketDeployment', { DistributionId: { - 'Ref': 'DistributionCFDistribution882A7313', + Ref: 'DistributionCFDistribution882A7313', }, DistributionPaths: ['/images/*'], }); @@ -430,7 +429,7 @@ test('invalidation can happen without distributionPaths provided', () => { expect(stack).toHaveResource('Custom::CDKBucketDeployment', { DistributionId: { - 'Ref': 'DistributionCFDistribution882A7313', + Ref: 'DistributionCFDistribution882A7313', }, }); @@ -464,16 +463,16 @@ test('lambda execution role gets permissions to read from the source bucket and // THEN expect(stack).toHaveResource('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ + PolicyDocument: { + Statement: [ { - 'Action': [ + Action: [ 's3:GetObject*', 's3:GetBucket*', 's3:List*', ], - 'Effect': 'Allow', - 'Resource': [ + Effect: 'Allow', + Resource: [ { 'Fn::GetAtt': [ 'Source71E471F1', @@ -497,7 +496,7 @@ test('lambda execution role gets permissions to read from the source bucket and ], }, { - 'Action': [ + Action: [ 's3:GetObject*', 's3:GetBucket*', 's3:List*', @@ -505,8 +504,8 @@ test('lambda execution role gets permissions to read from the source bucket and 's3:PutObject*', 's3:Abort*', ], - 'Effect': 'Allow', - 'Resource': [ + Effect: 'Allow', + Resource: [ { 'Fn::GetAtt': [ 'DestC383B82A', @@ -530,12 +529,12 @@ test('lambda execution role gets permissions to read from the source bucket and ], }, ], - 'Version': '2012-10-17', + Version: '2012-10-17', }, - 'PolicyName': 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF', - 'Roles': [ + PolicyName: 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF', + Roles: [ { - 'Ref': 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265', + Ref: 'CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265', }, ], }); @@ -597,7 +596,7 @@ test('deployment allows custom role to be supplied', () => { expect(stack).toCountResources('AWS::IAM::Role', 1); expect(stack).toCountResources('AWS::Lambda::Function', 1); expect(stack).toHaveResource('AWS::Lambda::Function', { - 'Role': { + Role: { 'Fn::GetAtt': [ 'Role1ABCC5F0', 'Arn', @@ -620,7 +619,7 @@ test('deploy without deleting missing files from destination', () => { }); expect(stack).toHaveResourceLike('Custom::CDKBucketDeployment', { - 'Prune': false, + Prune: false, }); }); @@ -643,7 +642,7 @@ test('Deployment role gets KMS permissions when using assets from new style synt Statement: arrayWith({ Action: ['kms:Decrypt', 'kms:DescribeKey'], Effect: 'Allow', - Resource: { 'Fn::ImportValue': 'CdkBootstrap-hnb659fds-FileAssetKeyArn' }, + Resource: { 'Fn::ImportValue': 'CdkBootstrap-hnb659fds-FileAssetKeyArn' }, }), }, }); diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts index fb6e77dc9ed8e..e97b3f9d7f878 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts +++ b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts @@ -1,7 +1,7 @@ +import * as path from 'path'; import * as cloudfront from '@aws-cdk/aws-cloudfront'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as s3deploy from '../lib'; class TestBucketDeployment extends cdk.Stack { @@ -17,7 +17,7 @@ class TestBucketDeployment extends cdk.Stack { s3OriginSource: { s3BucketSource: bucket, }, - behaviors : [ {isDefaultBehavior: true}], + behaviors: [ {isDefaultBehavior: true}], }, ], }); diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts index ee9918709b0b5..b2b1754083bd7 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; -import * as path from 'path'; import * as s3deploy from '../lib'; class TestBucketDeployment extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json index 96f176b1abbaa..e28b703234d0d 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json @@ -211,7 +211,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // tslint:disable-next-line:max-line-length\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" + "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // eslint-disable-next-line max-len\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json index 907ce064e3618..bb0b743ab2fdb 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json @@ -235,7 +235,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // tslint:disable-next-line:max-line-length\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" + "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // eslint-disable-next-line max-len\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts index 3c47bf21d5a30..c237b24e896e3 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts +++ b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts @@ -26,7 +26,7 @@ bucketB.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.LambdaDestinat app.synth(); -// tslint:disable:no-console +/* eslint-disable no-console */ function handler(event: any, _context: any, callback: any) { console.log(JSON.stringify(event, undefined, 2)); return callback(null, event); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts b/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts index 2dff3ba044311..7a5a3cf25b96d 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts +++ b/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts @@ -5,8 +5,8 @@ import * as sns from '@aws-cdk/aws-sns'; import * as cdk from '@aws-cdk/core'; import * as s3n from '../lib'; -// tslint:disable:object-literal-key-quotes -// tslint:disable:max-line-length +/* eslint-disable max-len */ +/* eslint-disable quote-props */ test('bucket without notifications', () => { const stack = new cdk.Stack(); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json index 5d9f5d8eb4787..3ee1f5979fbdf 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json @@ -194,7 +194,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // tslint:disable-next-line:max-line-length\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" + "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // eslint-disable-next-line max-len\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json index 88e05950c5c56..b4d969a3c6d42 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json @@ -181,7 +181,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // tslint:disable-next-line:max-line-length\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" + "ZipFile": "exports.handler = (event, context) => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies\n const s3 = new (require('aws-sdk').S3)();\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const https = require('https');\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const url = require('url');\n log(JSON.stringify(event, undefined, 2));\n const props = event.ResourceProperties;\n if (event.RequestType === 'Delete') {\n props.NotificationConfiguration = {}; // this is how you clean out notifications\n }\n const req = {\n Bucket: props.BucketName,\n NotificationConfiguration: props.NotificationConfiguration,\n };\n return s3.putBucketNotificationConfiguration(req, (err, data) => {\n log({ err, data });\n if (err) {\n return submitResponse('FAILED', err.message + `\\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);\n }\n else {\n return submitResponse('SUCCESS');\n }\n });\n function log(obj) {\n console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);\n }\n // eslint-disable-next-line max-len\n // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule\n // to allow sending an error messge as a reason.\n function submitResponse(responseStatus, reason) {\n const responseBody = JSON.stringify({\n Status: responseStatus,\n Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,\n PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,\n StackId: event.StackId,\n RequestId: event.RequestId,\n LogicalResourceId: event.LogicalResourceId,\n NoEcho: false,\n });\n log({ responseBody });\n const parsedUrl = url.parse(event.ResponseURL);\n const options = {\n hostname: parsedUrl.hostname,\n port: 443,\n path: parsedUrl.path,\n method: 'PUT',\n headers: {\n 'content-type': '',\n 'content-length': responseBody.length,\n },\n };\n const request = https.request(options, (r) => {\n log({ statusCode: r.statusCode, statusMessage: r.statusMessage });\n context.done();\n });\n request.on('error', (error) => {\n log({ sendError: error });\n context.done();\n });\n request.write(responseBody);\n request.end();\n }\n};" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/@aws-cdk/aws-s3/lib/bucket.ts index ddc2b8939913c..03bf119e35574 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket.ts @@ -1304,7 +1304,7 @@ export class Bucket extends BucketBase { const enabled = rule.enabled !== undefined ? rule.enabled : true; const x: CfnBucket.RuleProperty = { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len abortIncompleteMultipartUpload: rule.abortIncompleteMultipartUploadAfter !== undefined ? { daysAfterInitiation: rule.abortIncompleteMultipartUploadAfter.toDays() } : undefined, expirationDate: rule.expirationDate, expirationInDays: rule.expiration && rule.expiration.toDays(), diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts index 6d4c78682e699..4ceced2e93e2d 100644 --- a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts +++ b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts @@ -89,7 +89,7 @@ export class NotificationsResourceHandler extends cdk.Construct { } } -// tslint:disable:no-console +/* eslint-disable no-console */ /** * Lambda event handler for the custom resource. Bear in mind that we are going @@ -132,7 +132,7 @@ const handler = (event: any, context: any) => { console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj); } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len // adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule // to allow sending an error messge as a reason. function submitResponse(responseStatus: string, reason?: string) { diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket-policy.ts b/packages/@aws-cdk/aws-s3/test/test.bucket-policy.ts index 17121d3d6c31a..d09b566e56905 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket-policy.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket-policy.ts @@ -5,7 +5,7 @@ import { Test } from 'nodeunit'; import * as s3 from '../lib'; // to make it easy to copy & paste from output: -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default properties'(test: Test) { diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index 92440f7d05586..89bcd0cbdc426 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -7,7 +7,7 @@ import { EOL } from 'os'; import * as s3 from '../lib'; // to make it easy to copy & paste from output: -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default bucket'(test: Test) { @@ -127,7 +127,6 @@ export = { test.throws(() => new s3.Bucket(stack, 'MyBucket', { bucketName: bucket, - // tslint:disable-next-line:only-arrow-functions }), function(err: Error) { return expectedErrors === err.message; }); diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts index 99d6714dba64b..a59913200224a 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts @@ -4,7 +4,6 @@ import { NamespaceType } from './namespace'; import { IService } from './service'; import { CfnInstance } from './servicediscovery.generated'; -// tslint:disable-next-line:no-empty-interface export interface NonIpInstanceBaseProps extends BaseInstanceProps { } diff --git a/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts b/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts index 46c2cebf0e8d8..543a60c15e698 100644 --- a/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts +++ b/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts @@ -27,9 +27,8 @@ export class AddHeader implements ses.IReceiptRuleAction { constructor(props: AddHeaderProps) { if (!/^[a-zA-Z0-9-]{1,50}$/.test(props.name)) { - // tslint:disable:max-line-length + // eslint-disable-next-line max-len throw new Error('Header `name` must be between 1 and 50 characters, inclusive, and consist of alphanumeric (a-z, A-Z, 0-9) characters and dashes only.'); - // tslint:enable:max-line-length } if (!/^[^\n\r]{0,2047}$/.test(props.value)) { diff --git a/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts b/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts index c345a3615d03a..3fa7d418e2ac4 100644 --- a/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts +++ b/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts @@ -70,7 +70,7 @@ export class Lambda implements ses.IReceiptRuleAction { if (permission) { // The Lambda could be imported rule.node.addDependency(permission); } else { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len rule.node.addWarning('This rule is using a Lambda action with an imported function. Ensure permission is given to SES to invoke that function.'); } diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts b/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts index 55bf25bb3983a..34ec0735865ca 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts +++ b/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts @@ -154,7 +154,6 @@ export class ReceiptRule extends Resource implements IReceiptRule { } } -// tslint:disable-next-line:no-empty-interface export interface DropSpamReceiptRuleProps extends ReceiptRuleProps { } @@ -201,7 +200,7 @@ export class DropSpamReceiptRule extends Construct { } // Adapted from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html -// tslint:disable:no-console +/* eslint-disable no-console */ function dropSpamCode(event: any, _: any, callback: any) { console.log('Spam filter'); @@ -216,7 +215,7 @@ function dropSpamCode(event: any, _: any, callback: any) { console.log('Dropping spam'); // Stop processing rule set, dropping message - callback(null, { disposition : 'STOP_RULE_SET' }); + callback(null, { disposition: 'STOP_RULE_SET' }); } else { callback(null, null); } diff --git a/packages/@aws-cdk/aws-ses/test/test.receipt-filter.ts b/packages/@aws-cdk/aws-ses/test/test.receipt-filter.ts index 37b73be9b4ad4..d380d535ad506 100644 --- a/packages/@aws-cdk/aws-ses/test/test.receipt-filter.ts +++ b/packages/@aws-cdk/aws-ses/test/test.receipt-filter.ts @@ -3,7 +3,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { ReceiptFilter, ReceiptFilterPolicy, WhiteListReceiptFilter } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'can create a receipt filter'(test: Test) { diff --git a/packages/@aws-cdk/aws-ses/test/test.receipt-rule-set.ts b/packages/@aws-cdk/aws-ses/test/test.receipt-rule-set.ts index 6e514fe9687e8..4d308d2f53561 100644 --- a/packages/@aws-cdk/aws-ses/test/test.receipt-rule-set.ts +++ b/packages/@aws-cdk/aws-ses/test/test.receipt-rule-set.ts @@ -3,7 +3,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { ReceiptRuleSet } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'can create a receipt rule set'(test: Test) { diff --git a/packages/@aws-cdk/aws-ses/test/test.receipt-rule.ts b/packages/@aws-cdk/aws-ses/test/test.receipt-rule.ts index 42502ba8398f1..f719e61d3ce87 100644 --- a/packages/@aws-cdk/aws-ses/test/test.receipt-rule.ts +++ b/packages/@aws-cdk/aws-ses/test/test.receipt-rule.ts @@ -3,7 +3,7 @@ import { Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import { ReceiptRule, ReceiptRuleSet, TlsPolicy } from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'can create receipt rules with second after first'(test: Test) { diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.expected.json b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.expected.json index 79897aec43ee0..38367e9204de2 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.expected.json +++ b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.expected.json @@ -38,7 +38,7 @@ "Type": "AWS::Lambda::Function", "Properties": { "Code": { - "ZipFile": "exports.handler = function handler(event, _context, callback) {\n // tslint:disable:no-console\n console.log('====================================================');\n console.log(JSON.stringify(event, undefined, 2));\n console.log('====================================================');\n return callback(undefined, event);\n}" + "ZipFile": "exports.handler = function handler(event, _context, callback) {\n /* eslint-disable no-console */\n console.log('====================================================');\n console.log(JSON.stringify(event, undefined, 2));\n console.log('====================================================');\n return callback(undefined, event);\n}" }, "Handler": "index.handler", "Role": { @@ -93,9 +93,7 @@ } }, "DeadLetterQueue9F481546": { - "Type": "AWS::SQS::Queue", - "Properties": { - } + "Type": "AWS::SQS::Queue" }, "DeadLetterQueuePolicyB1FB890C": { "Type": "AWS::SQS::QueuePolicy", @@ -167,7 +165,7 @@ "Type": "AWS::Lambda::Function", "Properties": { "Code": { - "ZipFile": "exports.handler = function handler(event, _context, callback) {\n // tslint:disable:no-console\n console.log('====================================================');\n console.log(JSON.stringify(event, undefined, 2));\n console.log('====================================================');\n return callback(undefined, event);\n}" + "ZipFile": "exports.handler = function handler(event, _context, callback) {\n /* eslint-disable no-console */\n console.log('====================================================');\n console.log(JSON.stringify(event, undefined, 2));\n console.log('====================================================');\n return callback(undefined, event);\n}" }, "Handler": "index.handler", "Role": { diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts index eb2e9fbc9a057..166fa8b982ba2 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts +++ b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts @@ -50,7 +50,7 @@ new SnsToLambda(app, 'aws-cdk-sns-lambda'); app.synth(); function handler(event: any, _context: any, callback: any) { - // tslint:disable:no-console + /* eslint-disable no-console */ console.log('===================================================='); console.log(JSON.stringify(event, undefined, 2)); console.log('===================================================='); diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts b/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts index 241c1dfdb1491..77c38a5259061 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts +++ b/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts @@ -5,7 +5,7 @@ import * as sqs from '@aws-cdk/aws-sqs'; import { CfnParameter, Duration, Stack, Token } from '@aws-cdk/core'; import * as subs from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ let stack: Stack; let topic: sns.Topic; @@ -154,7 +154,7 @@ test('url subscription (with raw delivery)', () => { }); test('url subscription (unresolved url with protocol)', () => { - const urlToken = Token.asString({ Ref : 'my-url-1' }); + const urlToken = Token.asString({ Ref: 'my-url-1' }); topic.addSubscription(new subs.UrlSubscription(urlToken, {protocol: sns.SubscriptionProtocol.HTTPS})); expect(stack).toMatchTemplate({ @@ -181,8 +181,8 @@ test('url subscription (unresolved url with protocol)', () => { }); test('url subscription (double unresolved url with protocol)', () => { - const urlToken1 = Token.asString({ Ref : 'my-url-1' }); - const urlToken2 = Token.asString({ Ref : 'my-url-2' }); + const urlToken1 = Token.asString({ Ref: 'my-url-1' }); + const urlToken2 = Token.asString({ Ref: 'my-url-2' }); topic.addSubscription(new subs.UrlSubscription(urlToken1, {protocol: sns.SubscriptionProtocol.HTTPS})); topic.addSubscription(new subs.UrlSubscription(urlToken2, {protocol: sns.SubscriptionProtocol.HTTPS})); @@ -200,7 +200,7 @@ test('url subscription (double unresolved url with protocol)', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-url-1', + 'Ref': 'my-url-1', }, 'Protocol': 'https', 'TopicArn': { 'Ref': 'MyTopic86869434' }, @@ -210,7 +210,7 @@ test('url subscription (double unresolved url with protocol)', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-url-2', + 'Ref': 'my-url-2', }, 'Protocol': 'https', 'TopicArn': { 'Ref': 'MyTopic86869434' }, @@ -226,7 +226,7 @@ test('url subscription (unknown protocol)', () => { }); test('url subscription (unresolved url without protocol)', () => { - const urlToken = Token.asString({ Ref : 'my-url-1' }); + const urlToken = Token.asString({ Ref: 'my-url-1' }); expect(() => topic.addSubscription(new subs.UrlSubscription(urlToken))) .toThrowError(/Must provide protocol if url is unresolved/); @@ -580,7 +580,7 @@ test('email subscription', () => { }); test('email subscription with unresolved', () => { - const emailToken = Token.asString({ Ref : 'my-email-1' }); + const emailToken = Token.asString({ Ref: 'my-email-1' }); topic.addSubscription(new subs.EmailSubscription(emailToken)); expect(stack).toMatchTemplate({ @@ -596,7 +596,7 @@ test('email subscription with unresolved', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-1', + 'Ref': 'my-email-1', }, 'Protocol': 'email', 'TopicArn': { @@ -609,8 +609,8 @@ test('email subscription with unresolved', () => { }); test('email and url subscriptions with unresolved', () => { - const emailToken = Token.asString({ Ref : 'my-email-1' }); - const urlToken = Token.asString({ Ref : 'my-url-1' }); + const emailToken = Token.asString({ Ref: 'my-email-1' }); + const urlToken = Token.asString({ Ref: 'my-url-1' }); topic.addSubscription(new subs.EmailSubscription(emailToken)); topic.addSubscription(new subs.UrlSubscription(urlToken, {protocol: sns.SubscriptionProtocol.HTTPS})); @@ -627,7 +627,7 @@ test('email and url subscriptions with unresolved', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-1', + 'Ref': 'my-email-1', }, 'Protocol': 'email', 'TopicArn': { @@ -639,7 +639,7 @@ test('email and url subscriptions with unresolved', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-url-1', + 'Ref': 'my-url-1', }, 'Protocol': 'https', 'TopicArn': { @@ -652,10 +652,10 @@ test('email and url subscriptions with unresolved', () => { }); test('email and url subscriptions with unresolved - four subscriptions', () => { - const emailToken1 = Token.asString({ Ref : 'my-email-1' }); - const emailToken2 = Token.asString({ Ref : 'my-email-2' }); - const emailToken3 = Token.asString({ Ref : 'my-email-3' }); - const emailToken4 = Token.asString({ Ref : 'my-email-4' }); + const emailToken1 = Token.asString({ Ref: 'my-email-1' }); + const emailToken2 = Token.asString({ Ref: 'my-email-2' }); + const emailToken3 = Token.asString({ Ref: 'my-email-3' }); + const emailToken4 = Token.asString({ Ref: 'my-email-4' }); topic.addSubscription(new subs.EmailSubscription(emailToken1)); topic.addSubscription(new subs.EmailSubscription(emailToken2)); @@ -675,7 +675,7 @@ test('email and url subscriptions with unresolved - four subscriptions', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-1', + 'Ref': 'my-email-1', }, 'Protocol': 'email', 'TopicArn': { @@ -687,7 +687,7 @@ test('email and url subscriptions with unresolved - four subscriptions', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-2', + 'Ref': 'my-email-2', }, 'Protocol': 'email', 'TopicArn': { @@ -699,7 +699,7 @@ test('email and url subscriptions with unresolved - four subscriptions', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-3', + 'Ref': 'my-email-3', }, 'Protocol': 'email', 'TopicArn': { @@ -711,7 +711,7 @@ test('email and url subscriptions with unresolved - four subscriptions', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-email-4', + 'Ref': 'my-email-4', }, 'Protocol': 'email', 'TopicArn': { @@ -1026,7 +1026,7 @@ test('sms subscription', () => { }); test('sms subscription with unresolved', () => { - const smsToken = Token.asString({ Ref : 'my-sms-1' }); + const smsToken = Token.asString({ Ref: 'my-sms-1' }); topic.addSubscription(new subs.SmsSubscription(smsToken)); expect(stack).toMatchTemplate({ @@ -1042,7 +1042,7 @@ test('sms subscription with unresolved', () => { 'Type': 'AWS::SNS::Subscription', 'Properties': { 'Endpoint': { - 'Ref' : 'my-sms-1', + 'Ref': 'my-sms-1', }, 'Protocol': 'sms', 'TopicArn': { diff --git a/packages/@aws-cdk/aws-sns/test/test.sns.ts b/packages/@aws-cdk/aws-sns/test/test.sns.ts index ad86fa6aaf2c7..87d1b899559e0 100644 --- a/packages/@aws-cdk/aws-sns/test/test.sns.ts +++ b/packages/@aws-cdk/aws-sns/test/test.sns.ts @@ -5,7 +5,7 @@ import * as cdk from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as sns from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'topic tests': { diff --git a/packages/@aws-cdk/aws-sqs/test/test.sqs.ts b/packages/@aws-cdk/aws-sqs/test/test.sqs.ts index 15a67e269bf3a..4e2d09fea3594 100644 --- a/packages/@aws-cdk/aws-sqs/test/test.sqs.ts +++ b/packages/@aws-cdk/aws-sqs/test/test.sqs.ts @@ -5,7 +5,7 @@ import { CfnParameter, Duration, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as sqs from '../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'default properties'(test: Test) { diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts b/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts index 7d4076ac1006f..358d92abbce25 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts +++ b/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-line-length +/* eslint-disable max-len */ import { App, CfnOutput, CfnParameter, Stack } from '@aws-cdk/core'; import * as ssm from '../lib'; diff --git a/packages/@aws-cdk/aws-ssm/test/test.parameter.ts b/packages/@aws-cdk/aws-ssm/test/test.parameter.ts index 4f899048ccd62..ed7cde4d9a8ce 100644 --- a/packages/@aws-cdk/aws-ssm/test/test.parameter.ts +++ b/packages/@aws-cdk/aws-ssm/test/test.parameter.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-line-length +/* eslint-disable max-len */ import { expect, haveResource } from '@aws-cdk/assert'; import * as iam from '@aws-cdk/aws-iam'; @@ -540,7 +540,7 @@ export = { test.done(); }, - 'valueForStringParameter': { + valueForStringParameter: { 'returns a token that represents the SSM parameter value'(test: Test) { // GIVEN diff --git a/packages/@aws-cdk/aws-ssm/test/test.util.ts b/packages/@aws-cdk/aws-ssm/test/test.util.ts index 0b65991441398..884f05b26d7e0 100644 --- a/packages/@aws-cdk/aws-ssm/test/test.util.ts +++ b/packages/@aws-cdk/aws-ssm/test/test.util.ts @@ -1,4 +1,4 @@ -// tslint:disable: max-line-length +/* eslint-disable max-len */ import { Stack, Token } from '@aws-cdk/core'; import { Test } from 'nodeunit'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts index faeb7009b18eb..80c4eb28140be 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts @@ -214,7 +214,6 @@ export class RunBatchJob implements sfn.IStepFunctionsTask { }); // validate timeout - // tslint:disable-next-line:no-unused-expression props.timeout !== undefined && withResolved(props.timeout.toSeconds(), (timeout) => { if (timeout < 60) { throw new Error(`timeout must be greater than 60 seconds. Received ${timeout} seconds.`); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts index c376a4ce91d26..8c5ef74bb5d9a 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts @@ -191,7 +191,6 @@ export class BatchSubmitJob extends sfn.TaskStateBase { }); // validate timeout - // tslint:disable-next-line:no-unused-expression props.timeout !== undefined && withResolved(props.timeout.toSeconds(), (timeout) => { if (timeout < 60) { throw new Error(`attempt duration must be greater than 60 seconds. Received ${timeout} seconds.`); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs10.x-handler/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs10.x-handler/index.ts index 166ac3a6df520..4bd79ff06fa27 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs10.x-handler/index.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs10.x-handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console no-eval +/* eslint-disable no-console */ import { Event } from '../evaluate-expression'; export async function handler(event: Event): Promise { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts index 2991c762c025d..f5e5d7c76bd2a 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts @@ -98,7 +98,7 @@ test('supports tokens', () => { }, End: true, Parameters: { - // tslint:disable:object-literal-key-quotes + /* eslint-disable quote-props */ Key: { SOME_KEY: { 'S.$': '$.partitionKey' }, OTHER_KEY: { 'N.$': '$.sortKey' }, diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts index d124b1ac9c6ee..a60a993967bee 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts @@ -9,7 +9,7 @@ let stack: Stack; let vpc: ec2.Vpc; let cluster: ecs.Cluster; -// tslint:disable: object-literal-key-quotes +/* eslint-disable quote-props */ beforeEach(() => { // GIVEN diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts index 8034635352b32..905ce9d65bfe3 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts @@ -1,3 +1,4 @@ +/// !cdk-integ pragma:ignore-assets import * as sfn from '@aws-cdk/aws-stepfunctions'; import * as cdk from '@aws-cdk/core'; import * as tasks from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts index 5bb39f17385ff..0919ddfae535a 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts @@ -4,7 +4,7 @@ import * as sfn from '@aws-cdk/aws-stepfunctions'; import { Stack } from '@aws-cdk/core'; import { LambdaInvocationType, LambdaInvoke } from '../../lib'; -// tslint:disable: object-literal-key-quotes +/* eslint-disable quote-props */ describe('LambdaInvoke', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts index 8d82eecd398d7..d586a3e472d98 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts @@ -215,7 +215,7 @@ export abstract class State extends cdk.Construct implements IChainable { if (this.containingGraph === graph) { return; } if (this.containingGraph) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Trying to use state '${this.stateId}' in ${graph}, but is already in ${this.containingGraph}. Every state can only be used in one graph.`); } diff --git a/packages/@aws-cdk/cdk-assets-schema/lib/index.ts b/packages/@aws-cdk/cdk-assets-schema/lib/index.ts index c90b194d4e271..d016a0a03cf7d 100644 --- a/packages/@aws-cdk/cdk-assets-schema/lib/index.ts +++ b/packages/@aws-cdk/cdk-assets-schema/lib/index.ts @@ -1,4 +1,4 @@ -// tslint:disable-next-line: no-console +/* eslint-disable no-console */ console.error('error: @aws-cdk/cdk-assets-schema has been merged into @aws-cdk/cloud-assembly-schema'); export { }; diff --git a/packages/@aws-cdk/cfnspec/build-tools/build.ts b/packages/@aws-cdk/cfnspec/build-tools/build.ts index 5b2910f12d7c4..941d8e95d8915 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/build.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/build.ts @@ -5,10 +5,10 @@ * document at `spec/specification.json`. */ +import * as path from 'path'; import * as fastJsonPatch from 'fast-json-patch'; import * as fs from 'fs-extra'; import * as md5 from 'md5'; -import * as path from 'path'; import { schema } from '../lib'; import { detectScrutinyTypes } from './scrutiny'; @@ -71,7 +71,7 @@ function replaceIncompleteTypes(spec: schema.Specification) { && !schema.isCollectionProperty(definition) && !schema.isScalarProperty(definition) && !schema.isPrimitiveProperty(definition)) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log(`[${name}] Incomplete type, adding empty "Properties" field`); (definition as unknown as schema.RecordProperty).Properties = {}; @@ -103,11 +103,11 @@ function merge(spec: any, fragment: any, jsonPath: string[]) { const specVal = spec[key]; const fragVal = fragment[key]; if (typeof specVal !== typeof fragVal) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Attempted to merge ${JSON.stringify(fragVal)} into incompatible ${JSON.stringify(specVal)} at path ${jsonPath.join('/')}/${key}`); } if (typeof specVal !== 'object') { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Conflict when attempting to merge ${JSON.stringify(fragVal)} into ${JSON.stringify(specVal)} at path ${jsonPath.join('/')}/${key}`); } merge(specVal, fragVal, [...jsonPath, key]); @@ -120,7 +120,7 @@ function merge(spec: any, fragment: any, jsonPath: string[]) { function patch(spec: any, fragment: any) { if (!fragment) { return; } if ('patch' in fragment) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log(`Applying patch: ${fragment.patch.description}`); fastJsonPatch.applyPatch(spec, fragment.patch.operations); } else { @@ -155,7 +155,7 @@ function normalize(spec: schema.Specification): schema.Specification { main() .catch(e => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(e.stack); process.exit(-1); }); diff --git a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts index 8dc5687b5dba2..cb11c69d5725e 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts @@ -5,13 +5,13 @@ * have an AWS construct library. */ -import * as fs from 'fs-extra'; import * as path from 'path'; +import * as fs from 'fs-extra'; import * as cfnspec from '../lib'; // don't be a prude: -// tslint:disable:no-console -// tslint:disable:object-literal-key-quotes +/* eslint-disable no-console */ +/* eslint-disable quote-props */ async function main() { const root = path.join(__dirname, '..', '..'); diff --git a/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts b/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts index 539daba733844..889e631eacf27 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts @@ -1,8 +1,7 @@ -import * as fs from 'fs-extra'; import * as util from 'util'; +import * as fs from 'fs-extra'; /* eslint-disable @typescript-eslint/no-require-imports */ -// tslint:disable-next-line:no-var-requires const jsonDiff = require('json-diff').diff; /* eslint-enable */ diff --git a/packages/@aws-cdk/cfnspec/package.json b/packages/@aws-cdk/cfnspec/package.json index dc442ba4f5d9e..42a75db2906aa 100644 --- a/packages/@aws-cdk/cfnspec/package.json +++ b/packages/@aws-cdk/cfnspec/package.json @@ -6,6 +6,7 @@ "update": "cdk-build && /bin/bash build-tools/update.sh", "build": "cdk-build && node build-tools/build", "watch": "cdk-watch", + "lint": "cdk-lint", "pkglint": "pkglint -f", "test": "cdk-test", "package": "cdk-package", diff --git a/packages/@aws-cdk/cfnspec/test/test.augmentation.ts b/packages/@aws-cdk/cfnspec/test/test.augmentation.ts index 2c65016a4e037..34222c197d867 100644 --- a/packages/@aws-cdk/cfnspec/test/test.augmentation.ts +++ b/packages/@aws-cdk/cfnspec/test/test.augmentation.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as path from 'path'; +import { Test } from 'nodeunit'; import * as cfnspec from '../lib'; import { MetricType } from '../lib/schema'; diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts index 66275b88e312b..4c7c5229f0fc0 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts @@ -4,27 +4,23 @@ import * as semver from 'semver'; import * as assets from './assets'; import * as assembly from './cloud-assembly'; +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ + // this prefix is used by the CLI to identify this specific error. // in which case we want to instruct the user to upgrade his CLI. // see exec.ts#createAssembly export const VERSION_MISMATCH: string = 'Cloud assembly schema version mismatch'; -// tslint:disable: no-var-requires - -// eslint-disable-next-line @typescript-eslint/no-require-imports const ASSETS_SCHEMA = require('../schema/assets.schema.json'); -// eslint-disable-next-line @typescript-eslint/no-require-imports const ASSEMBLY_SCHEMA = require('../schema/cloud-assembly.schema.json'); /** * Version is shared for both manifests */ -// eslint-disable-next-line @typescript-eslint/no-require-imports const SCHEMA_VERSION = require('../schema/cloud-assembly.version.json').version; -// tslint:enable: no-var-requires - /** * Protocol utility class. */ diff --git a/packages/@aws-cdk/cloud-assembly-schema/scripts/update-schema.ts b/packages/@aws-cdk/cloud-assembly-schema/scripts/update-schema.ts index 2c8ac1c50f236..350a26e51f9fe 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/scripts/update-schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/scripts/update-schema.ts @@ -5,7 +5,7 @@ import * as semver from 'semver'; import * as tjs from 'typescript-json-schema'; function log(message: string) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log(message); } diff --git a/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts b/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts index 1fb9d025cff20..4f75a233e6a74 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/diff/types.ts @@ -1,5 +1,5 @@ -import * as cfnspec from '@aws-cdk/cfnspec'; import { AssertionError } from 'assert'; +import * as cfnspec from '@aws-cdk/cfnspec'; import { IamChanges } from '../iam/iam-changes'; import { SecurityGroupChanges } from '../network/security-group-changes'; import { deepEqual } from './util'; diff --git a/packages/@aws-cdk/cloudformation-diff/lib/format.ts b/packages/@aws-cdk/cloudformation-diff/lib/format.ts index 8a5cd4bd260eb..53e7177ad914f 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/format.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/format.ts @@ -1,5 +1,5 @@ -import * as colors from 'colors/safe'; import { format } from 'util'; +import * as colors from 'colors/safe'; import { Difference, isPropertyDifference, ResourceDifference, ResourceImpact } from './diff-template'; import { DifferenceCollection, TemplateDiff } from './diff/types'; import { deepEqual } from './diff/util'; @@ -11,7 +11,6 @@ import { SecurityGroupChanges } from './network/security-group-changes'; const PATH_METADATA_KEY = 'aws:cdk:path'; /* eslint-disable @typescript-eslint/no-require-imports */ -// tslint:disable-next-line:no-var-requires const { structuredPatch } = require('diff'); /* eslint-enable */ @@ -159,7 +158,7 @@ class Formatter { const resourceType = diff.isRemoval ? diff.oldResourceType : diff.newResourceType; - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len this.print(`${this.formatPrefix(diff)} ${this.formatValue(resourceType, colors.cyan)} ${this.formatLogicalId(logicalId)} ${this.formatImpact(diff.changeImpact)}`); if (diff.isUpdate) { diff --git a/packages/@aws-cdk/cloudformation-diff/test/network/rule.test.ts b/packages/@aws-cdk/cloudformation-diff/test/network/rule.test.ts index 49220f961a0fa..e790deb4ed7ad 100644 --- a/packages/@aws-cdk/cloudformation-diff/test/network/rule.test.ts +++ b/packages/@aws-cdk/cloudformation-diff/test/network/rule.test.ts @@ -88,7 +88,7 @@ const twoArbitraryRules = fc.record({ rule2: arbitraryRule, copyIp: fc.boolean(), copyFromPort: fc.boolean(), - copyToPort : fc.boolean(), + copyToPort: fc.boolean(), copyCidrIp: fc.boolean(), copySecurityGroupId: fc.boolean(), copyPrefixListId: fc.boolean(), diff --git a/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts b/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts index 57e6d0470dcb9..cfb69bb33f7c0 100644 --- a/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts +++ b/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts @@ -7,7 +7,7 @@ import * as path from 'path'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ /* eslint-disable quotes */ describe('CDK Include', () => { diff --git a/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts b/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts index 19b7551c50876..9f0fdc4834828 100644 --- a/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts +++ b/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ /* eslint-disable quotes */ describe('CDK Include', () => { diff --git a/packages/@aws-cdk/core/lib/asset-staging.ts b/packages/@aws-cdk/core/lib/asset-staging.ts index d99c5a9e11590..92a2b6b9bdf97 100644 --- a/packages/@aws-cdk/core/lib/asset-staging.ts +++ b/packages/@aws-cdk/core/lib/asset-staging.ts @@ -1,8 +1,8 @@ -import * as cxapi from '@aws-cdk/cx-api'; import * as crypto from 'crypto'; -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; +import * as cxapi from '@aws-cdk/cx-api'; +import * as fs from 'fs-extra'; import { AssetHashType, AssetOptions } from './assets'; import { BundlingOptions } from './bundling'; import { Construct, ISynthesisSession } from './construct-compat'; @@ -171,7 +171,8 @@ export class AssetStaging extends Construct { ]; try { - console.error(`Bundling asset ${this.node.path}...`); // tslint:disable-line no-console + // eslint-disable-next-line no-console + console.error(`Bundling asset ${this.node.path}...`); options.image._run({ command: options.command, user, diff --git a/packages/@aws-cdk/core/lib/cfn-fn.ts b/packages/@aws-cdk/core/lib/cfn-fn.ts index 73d0f61c03236..df5c31794fc4c 100644 --- a/packages/@aws-cdk/core/lib/cfn-fn.ts +++ b/packages/@aws-cdk/core/lib/cfn-fn.ts @@ -6,7 +6,7 @@ import { IResolvable, IResolveContext } from './resolvable'; import { captureStackTrace } from './stack-trace'; import { Token } from './token'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ /** * CloudFormation intrinsic functions. diff --git a/packages/@aws-cdk/core/lib/cfn-resource.ts b/packages/@aws-cdk/core/lib/cfn-resource.ts index deeb92e0e2456..68c34c52bce1d 100644 --- a/packages/@aws-cdk/core/lib/cfn-resource.ts +++ b/packages/@aws-cdk/core/lib/cfn-resource.ts @@ -1,7 +1,7 @@ import * as cxapi from '@aws-cdk/cx-api'; import { CfnCondition } from './cfn-condition'; // import required to be here, otherwise causes a cycle when running the generated JavaScript -// tslint:disable-next-line:ordered-imports +/* eslint-disable import/order */ import { CfnRefElement } from './cfn-element'; import { CfnCreationPolicy, CfnDeletionPolicy, CfnUpdatePolicy } from './cfn-resource-policy'; import { Construct, IConstruct } from './construct-compat'; @@ -273,7 +273,7 @@ export class CfnResource extends CfnRefElement { Type: this.cfnResourceType, Properties: ignoreEmpty(this.cfnProperties), DependsOn: ignoreEmpty(renderDependsOn(this.dependsOn)), - CreationPolicy: capitalizePropertyNames(this, renderCreationPolicy(this.cfnOptions.creationPolicy)), + CreationPolicy: capitalizePropertyNames(this, renderCreationPolicy(this.cfnOptions.creationPolicy)), UpdatePolicy: capitalizePropertyNames(this, this.cfnOptions.updatePolicy), UpdateReplacePolicy: capitalizePropertyNames(this, this.cfnOptions.updateReplacePolicy), DeletionPolicy: capitalizePropertyNames(this, this.cfnOptions.deletionPolicy), diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts b/packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts index c90bf96e684cf..e720e225787eb 100644 --- a/packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts +++ b/packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts @@ -134,6 +134,6 @@ async function defaultSendHttpRequest(options: https.RequestOptions, responseBod } function defaultLog(fmt: string, ...params: any[]) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log(fmt, ...params); } diff --git a/packages/@aws-cdk/core/lib/deps.ts b/packages/@aws-cdk/core/lib/deps.ts index c34f11ef2c5a7..e0ef970b6e359 100644 --- a/packages/@aws-cdk/core/lib/deps.ts +++ b/packages/@aws-cdk/core/lib/deps.ts @@ -35,6 +35,7 @@ export function addDependency(source: T, target: T, reason?: const sourceStage = Stage.of(sourceStack); const targetStage = Stage.of(targetStack); if (sourceStage !== targetStage) { + // eslint-disable-next-line max-len throw new Error(`You cannot add a dependency from '${source.node.path}' (in ${describeStage(sourceStage)}) to '${target.node.path}' (in ${describeStage(targetStage)}): dependency cannot cross stage boundaries`); } diff --git a/packages/@aws-cdk/core/lib/fs/fingerprint.ts b/packages/@aws-cdk/core/lib/fs/fingerprint.ts index 80f133d4b5f51..ca7da486a5d03 100644 --- a/packages/@aws-cdk/core/lib/fs/fingerprint.ts +++ b/packages/@aws-cdk/core/lib/fs/fingerprint.ts @@ -69,11 +69,10 @@ export function fingerprint(fileOrDirectory: string, options: FingerprintOptions function _contentFingerprint(file: string, stat: fs.Stats): string { const hash = crypto.createHash('sha256'); const buffer = Buffer.alloc(BUFFER_SIZE); - // tslint:disable-next-line: no-bitwise + // eslint-disable-next-line no-bitwise const fd = fs.openSync(file, fs.constants.O_DSYNC | fs.constants.O_RDONLY | fs.constants.O_SYNC); try { let read = 0; - // tslint:disable-next-line: no-conditional-assignment while ((read = fs.readSync(fd, buffer, 0, BUFFER_SIZE, null)) !== 0) { hash.update(buffer.slice(0, read)); } diff --git a/packages/@aws-cdk/core/lib/fs/utils.ts b/packages/@aws-cdk/core/lib/fs/utils.ts index 5624c3448f5ef..84c520f0f14f9 100644 --- a/packages/@aws-cdk/core/lib/fs/utils.ts +++ b/packages/@aws-cdk/core/lib/fs/utils.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import * as minimatch from 'minimatch'; import * as path from 'path'; +import * as minimatch from 'minimatch'; import { SymlinkFollowMode } from './options'; /** diff --git a/packages/@aws-cdk/core/lib/private/cfn-reference.ts b/packages/@aws-cdk/core/lib/private/cfn-reference.ts index 5aaf870b3ec1a..cd28a221958c5 100644 --- a/packages/@aws-cdk/core/lib/private/cfn-reference.ts +++ b/packages/@aws-cdk/core/lib/private/cfn-reference.ts @@ -96,7 +96,7 @@ export class CfnReference extends Reference { const token = this.replacementTokens.get(consumingStack); // if (!token && this.isCrossStackReference(consumingStack) && !context.preparing) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len // throw new Error(`Cross-stack reference (${context.scope.node.path} -> ${this.target.node.path}) has not been assigned a value--call prepare() first`); // } diff --git a/packages/@aws-cdk/core/lib/private/encoding.ts b/packages/@aws-cdk/core/lib/private/encoding.ts index 89b33308b65ab..e9fc0156c69d2 100644 --- a/packages/@aws-cdk/core/lib/private/encoding.ts +++ b/packages/@aws-cdk/core/lib/private/encoding.ts @@ -138,7 +138,7 @@ export function unresolved(obj: any): boolean { * * Currently not supporting BE architectures. */ -// tslint:disable-next-line:no-bitwise +// eslint-disable-next-line no-bitwise const DOUBLE_TOKEN_MARKER_BITS = 0xFBFF << 16; /** @@ -172,13 +172,13 @@ export function createTokenDouble(x: number) { const buf = new ArrayBuffer(8); const ints = new Uint32Array(buf); - // tslint:disable:no-bitwise + /* eslint-disable no-bitwise */ ints[0] = x & 0x0000FFFFFFFF; // Bottom 32 bits of number // This needs an "x >> 32" but that will make it a 32-bit number instead // of a 64-bit number. ints[1] = (shr32(x) & 0xFFFF) | DOUBLE_TOKEN_MARKER_BITS; // Top 16 bits of number and the mask - // tslint:enable:no-bitwise + /* eslint-enable no-bitwise */ return (new Float64Array(buf))[0]; } @@ -208,7 +208,7 @@ export function extractTokenDouble(encoded: number): number | undefined { const ints = new Uint32Array(buf); - // tslint:disable:no-bitwise + /* eslint-disable no-bitwise */ if ((ints[1] & 0xFFFF0000) !== DOUBLE_TOKEN_MARKER_BITS) { return undefined; } @@ -216,5 +216,5 @@ export function extractTokenDouble(encoded: number): number | undefined { // Must use + instead of | here (bitwise operations // will force 32-bits integer arithmetic, + will not). return ints[0] + shl32(ints[1] & 0xFFFF); - // tslint:enable:no-bitwise + /* eslint-enable no-bitwise */ } diff --git a/packages/@aws-cdk/core/lib/private/logical-id.ts b/packages/@aws-cdk/core/lib/private/logical-id.ts index 34044ad3db667..70b92c4a6e6ac 100644 --- a/packages/@aws-cdk/core/lib/private/logical-id.ts +++ b/packages/@aws-cdk/core/lib/private/logical-id.ts @@ -40,7 +40,7 @@ export class LogicalIDs { // If this newId has already been used, it must have been with the same oldId if (newId in this.reverse && this.reverse[newId] !== oldId) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Two objects have been assigned the same Logical ID: '${this.reverse[newId]}' and '${oldId}' are now both named '${newId}'.`); } this.reverse[newId] = oldId; diff --git a/packages/@aws-cdk/core/lib/private/resolve.ts b/packages/@aws-cdk/core/lib/private/resolve.ts index 11cd65cc332b3..19be4917b5e5f 100644 --- a/packages/@aws-cdk/core/lib/private/resolve.ts +++ b/packages/@aws-cdk/core/lib/private/resolve.ts @@ -148,6 +148,7 @@ export function resolve(obj: any, options: IResolveOptions): any { for (const key of Object.keys(obj)) { const resolvedKey = makeContext()[0].resolve(key); if (typeof(resolvedKey) !== 'string') { + // eslint-disable-next-line max-len throw new Error(`"${key}" is used as the key in a map so must resolve to a string, but it resolves to: ${JSON.stringify(resolvedKey)}. Consider using "CfnJson" to delay resolution to deployment-time`); } diff --git a/packages/@aws-cdk/core/lib/private/runtime-info.ts b/packages/@aws-cdk/core/lib/private/runtime-info.ts index 182776f205c48..7edf871a5f183 100644 --- a/packages/@aws-cdk/core/lib/private/runtime-info.ts +++ b/packages/@aws-cdk/core/lib/private/runtime-info.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { basename, dirname } from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { major as nodeMajorVersion } from './node-version'; // list of NPM scopes included in version reporting e.g. @aws-cdk and @aws-solutions-konstruk diff --git a/packages/@aws-cdk/core/lib/private/uniqueid.ts b/packages/@aws-cdk/core/lib/private/uniqueid.ts index ea6c2a142563d..c9d1d333891db 100644 --- a/packages/@aws-cdk/core/lib/private/uniqueid.ts +++ b/packages/@aws-cdk/core/lib/private/uniqueid.ts @@ -1,4 +1,3 @@ -// tslint:disable-next-line:no-var-requires import * as crypto from 'crypto'; import { unresolved } from './encoding'; diff --git a/packages/@aws-cdk/core/lib/runtime.ts b/packages/@aws-cdk/core/lib/runtime.ts index b475679338129..390708db3eccb 100644 --- a/packages/@aws-cdk/core/lib/runtime.ts +++ b/packages/@aws-cdk/core/lib/runtime.ts @@ -31,7 +31,7 @@ export function dateToCloudFormation(x?: Date): any { return undefined; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len return `${x.getUTCFullYear()}-${pad(x.getUTCMonth() + 1)}-${pad(x.getUTCDate())}T${pad(x.getUTCHours())}:${pad(x.getUTCMinutes())}:${pad(x.getUTCSeconds())}`; } diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts index 280a3f72d1079..5a57c423779df 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as crypto from 'crypto'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { ConstructNode, IConstruct, ISynthesisSession } from '../construct-compat'; import { Stack } from '../stack'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts index 98111a43e0e42..5a373cd3ed061 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetPackaging, FileAssetSource } from '../assets'; import { Fn } from '../cfn-fn'; import { ISynthesisSession } from '../construct-compat'; @@ -12,6 +12,8 @@ import { IStackSynthesizer } from './types'; export const BOOTSTRAP_QUALIFIER_CONTEXT = '@aws-cdk/core:bootstrapQualifier'; +/* eslint-disable max-len */ + /** * The minimum bootstrap stack version required by this app. */ @@ -222,7 +224,7 @@ export class DefaultStackSynthesizer implements IStackSynthesizer { }); }; - // tslint:disable:max-line-length + /* eslint-disable max-len */ this.bucketName = specialize(this.props.fileAssetsBucketName ?? DefaultStackSynthesizer.DEFAULT_FILE_ASSETS_BUCKET_NAME); this.repositoryName = specialize(this.props.imageAssetsRepositoryName ?? DefaultStackSynthesizer.DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME); this._deployRoleArn = specialize(this.props.deployRoleArn ?? DefaultStackSynthesizer.DEFAULT_DEPLOY_ROLE_ARN); @@ -230,7 +232,7 @@ export class DefaultStackSynthesizer implements IStackSynthesizer { this.fileAssetPublishingRoleArn = specialize(this.props.fileAssetPublishingRoleArn ?? DefaultStackSynthesizer.DEFAULT_FILE_ASSET_PUBLISHING_ROLE_ARN); this.imageAssetPublishingRoleArn = specialize(this.props.imageAssetPublishingRoleArn ?? DefaultStackSynthesizer.DEFAULT_IMAGE_ASSET_PUBLISHING_ROLE_ARN); this._kmsKeyArnExportName = specialize(this.props.fileAssetKeyArnExportName ?? DefaultStackSynthesizer.DEFAULT_FILE_ASSET_KEY_ARN_EXPORT_NAME); - // tslint:enable:max-line-length + /* eslint-enable max-len */ } public addFileAsset(asset: FileAssetSource): FileAssetLocation { diff --git a/packages/@aws-cdk/core/lib/stack-trace.ts b/packages/@aws-cdk/core/lib/stack-trace.ts index 47caefa22f4a8..8337434fd3c6a 100644 --- a/packages/@aws-cdk/core/lib/stack-trace.ts +++ b/packages/@aws-cdk/core/lib/stack-trace.ts @@ -1,4 +1,3 @@ -// tslint:disable-next-line:ban-types export function captureStackTrace(below?: Function): string[] { if (process.env.CDK_DISABLE_STACK_TRACE) { return [ 'stack traces disabled' ]; diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/@aws-cdk/core/lib/stack.ts index eeb65562837ec..6af8d3b075150 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/@aws-cdk/core/lib/stack.ts @@ -1,8 +1,13 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; +import { Arn, ArnComponents } from './arn'; import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource } from './assets'; +import { CfnElement } from './cfn-element'; +import { Fn } from './cfn-fn'; +import { Aws, ScopedAws } from './cfn-pseudo'; +import { CfnResource, TagType } from './cfn-resource'; import { Construct, IConstruct, ISynthesisSession } from './construct-compat'; import { ContextProvider } from './context-provider'; import { Environment } from './environment'; @@ -338,7 +343,7 @@ export class Stack extends Construct implements ITaggable { // // Also use the new behavior if we are using the new CI/CD-ready synthesizer; that way // people only have to flip one flag. - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len this.artifactId = this.node.tryGetContext(cxapi.ENABLE_STACK_NAME_DUPLICATES_CONTEXT) || this.node.tryGetContext(cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT) ? this.generateStackArtifactId() : this.stackName; @@ -662,7 +667,7 @@ export class Stack extends Construct implements ITaggable { reason = reason || 'dependency added using stack.addDependency()'; const cycle = target.stackDependencyReasons(this); if (cycle !== undefined) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`'${target.node.path}' depends on '${this.node.path}' (${cycle.join(', ')}). Adding this dependency (${reason}) would create a cyclic reference.`); } @@ -677,7 +682,7 @@ export class Stack extends Construct implements ITaggable { dep.reasons.push(reason); if (process.env.CDK_DEBUG_DEPS) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(`[CDK_DEBUG_DEPS] stack "${this.node.path}" depends on "${target.node.path}" because: ${reason}`); } } @@ -775,7 +780,7 @@ export class Stack extends Construct implements ITaggable { let transform: string | string[] | undefined; if (this.templateOptions.transform) { - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len this.node.addWarning('This stack is using the deprecated `templateOptions.transform` property. Consider switching to `addTransform()`.'); this.addTransform(this.templateOptions.transform); } @@ -1058,11 +1063,6 @@ function makeStackName(components: string[]) { } // These imports have to be at the end to prevent circular imports -import { Arn, ArnComponents } from './arn'; -import { CfnElement } from './cfn-element'; -import { Fn } from './cfn-fn'; -import { Aws, ScopedAws } from './cfn-pseudo'; -import { CfnResource, TagType } from './cfn-resource'; import { addDependency } from './deps'; import { Reference } from './reference'; import { IResolvable } from './resolvable'; diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts b/packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts index 5a372f057593e..b83a9218a3e58 100644 --- a/packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts +++ b/packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable no-console */ export function handler(event: any) { console.log('I am a custom resource'); diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/test.custom-resource-provider.ts b/packages/@aws-cdk/core/test/custom-resource-provider/test.custom-resource-provider.ts index 76ed2a2b1b1ed..ca3d8e4839241 100644 --- a/packages/@aws-cdk/core/test/custom-resource-provider/test.custom-resource-provider.ts +++ b/packages/@aws-cdk/core/test/custom-resource-provider/test.custom-resource-provider.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as path from 'path'; +import { Test } from 'nodeunit'; import { AssetStaging, CustomResourceProvider, CustomResourceProviderRuntime, Duration, Size, Stack } from '../../lib'; import { toCloudFormation } from '../util'; diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/test.nodejs-entrypoint.ts b/packages/@aws-cdk/core/test/custom-resource-provider/test.nodejs-entrypoint.ts index 87935b7d93599..40f3fdea54c8e 100644 --- a/packages/@aws-cdk/core/test/custom-resource-provider/test.nodejs-entrypoint.ts +++ b/packages/@aws-cdk/core/test/custom-resource-provider/test.nodejs-entrypoint.ts @@ -1,10 +1,10 @@ import * as assert from 'assert'; import * as fs from 'fs'; import * as https from 'https'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; import * as url from 'url'; +import { Test } from 'nodeunit'; import * as entrypoint from '../../lib/custom-resource-provider/nodejs-entrypoint'; export = { diff --git a/packages/@aws-cdk/core/test/fs/test.fs-copy.ts b/packages/@aws-cdk/core/test/fs/test.fs-copy.ts index 47b55842a90c4..840bc94a97087 100644 --- a/packages/@aws-cdk/core/test/fs/test.fs-copy.ts +++ b/packages/@aws-cdk/core/test/fs/test.fs-copy.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; +import { Test } from 'nodeunit'; import { FileSystem, SymlinkFollowMode } from '../../lib/fs'; export = { diff --git a/packages/@aws-cdk/core/test/fs/test.fs-fingerprint.ts b/packages/@aws-cdk/core/test/fs/test.fs-fingerprint.ts index 414386a649523..3605a334f142c 100644 --- a/packages/@aws-cdk/core/test/fs/test.fs-fingerprint.ts +++ b/packages/@aws-cdk/core/test/fs/test.fs-fingerprint.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; +import { Test } from 'nodeunit'; import { FileSystem, SymlinkFollowMode } from '../../lib/fs'; export = { diff --git a/packages/@aws-cdk/core/test/fs/test.fs.ts b/packages/@aws-cdk/core/test/fs/test.fs.ts index cc6d4898c922e..11a03a653eaf5 100644 --- a/packages/@aws-cdk/core/test/fs/test.fs.ts +++ b/packages/@aws-cdk/core/test/fs/test.fs.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; +import { Test } from 'nodeunit'; import * as sinon from 'sinon'; import { FileSystem } from '../../lib/fs'; diff --git a/packages/@aws-cdk/core/test/fs/test.utils.ts b/packages/@aws-cdk/core/test/fs/test.utils.ts index c8962c7f4022f..2e43d125d597b 100644 --- a/packages/@aws-cdk/core/test/fs/test.utils.ts +++ b/packages/@aws-cdk/core/test/fs/test.utils.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as path from 'path'; +import { Test } from 'nodeunit'; import { ImportMock } from 'ts-mock-imports'; import { SymlinkFollowMode } from '../../lib/fs'; import * as util from '../../lib/fs/utils'; diff --git a/packages/@aws-cdk/core/test/private/test.tree-metadata.ts b/packages/@aws-cdk/core/test/private/test.tree-metadata.ts index a99090cc0b892..3ef3966b2fd95 100644 --- a/packages/@aws-cdk/core/test/private/test.tree-metadata.ts +++ b/packages/@aws-cdk/core/test/private/test.tree-metadata.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import { Test } from 'nodeunit'; import { App, CfnParameter, CfnResource, Construct, Lazy, Stack, TreeInspector } from '../../lib/index'; abstract class AbstractCfnResource extends CfnResource { diff --git a/packages/@aws-cdk/core/test/stack-synthesis/test.new-style-synthesis.ts b/packages/@aws-cdk/core/test/stack-synthesis/test.new-style-synthesis.ts index 32af9084a26d1..b64f84be913da 100644 --- a/packages/@aws-cdk/core/test/stack-synthesis/test.new-style-synthesis.ts +++ b/packages/@aws-cdk/core/test/stack-synthesis/test.new-style-synthesis.ts @@ -1,6 +1,6 @@ +import * as fs from 'fs'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; -import * as fs from 'fs'; import { Test } from 'nodeunit'; import { App, CfnResource, DefaultStackSynthesizer, FileAssetPackaging, Stack } from '../../lib'; import { evaluateCFN } from '../evaluate-cfn'; diff --git a/packages/@aws-cdk/core/test/test.arn.ts b/packages/@aws-cdk/core/test/test.arn.ts index 86210ed856bcf..0fd85741508e7 100644 --- a/packages/@aws-cdk/core/test/test.arn.ts +++ b/packages/@aws-cdk/core/test/test.arn.ts @@ -99,7 +99,7 @@ export = { 'Arn.parse(s)': { - 'fails': { + fails: { 'if doesn\'t start with "arn:"'(test: Test) { const stack = new Stack(); test.throws(() => stack.parseArn('barn:foo:x:a:1:2'), /ARNs must start with "arn:": barn:foo/); @@ -203,9 +203,9 @@ export = { test.equal(parsed.sep, '/'); - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len test.deepEqual(stack.resolve(parsed.resource), { 'Fn::Select': [ 0, { 'Fn::Split': [ '/', { 'Fn::Select': [ 5, { 'Fn::Split': [ ':', theToken ]} ]} ]} ]}); - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len test.deepEqual(stack.resolve(parsed.resourceName), { 'Fn::Select': [ 1, { 'Fn::Split': [ '/', { 'Fn::Select': [ 5, { 'Fn::Split': [ ':', theToken ]} ]} ]} ]}); test.done(); diff --git a/packages/@aws-cdk/core/test/test.construct.ts b/packages/@aws-cdk/core/test/test.construct.ts index 56ef04e1d1d5e..4e99c21d6f1ea 100644 --- a/packages/@aws-cdk/core/test/test.construct.ts +++ b/packages/@aws-cdk/core/test/test.construct.ts @@ -3,7 +3,7 @@ import { Test } from 'nodeunit'; import { App as Root, Aws, Construct, ConstructNode, ConstructOrder, IConstruct, Lazy, ValidationError } from '../lib'; import { reEnableStackTraceCollection, restoreStackTraceColection } from './util'; -// tslint:disable:variable-name +/* eslint-disable @typescript-eslint/naming-convention */ export = { 'the "Root" construct is a special construct which can be used as the root of the tree'(test: Test) { @@ -158,7 +158,7 @@ export = { test.done(); }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'construct.setContext(k,v) sets context at some level and construct.getContext(key) will return the lowermost value defined in the stack'(test: Test) { const root = new Root(); const highChild = new Construct(root, 'highChild'); @@ -333,7 +333,7 @@ export = { test.done(); }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'construct.validate() can be implemented to perform validation, ConstructNode.validate(construct.node) will return all errors from the subtree (DFS)'(test: Test) { class MyConstruct extends Construct { @@ -455,7 +455,7 @@ export = { test.done(); }, - 'defaultChild': { + defaultChild: { 'returns the child with id "Resource"'(test: Test) { const root = new Root(); new Construct(root, 'child1'); diff --git a/packages/@aws-cdk/core/test/test.cross-environment-token.ts b/packages/@aws-cdk/core/test/test.cross-environment-token.ts index 8ff06c04e8d81..cd97e4661162e 100644 --- a/packages/@aws-cdk/core/test/test.cross-environment-token.ts +++ b/packages/@aws-cdk/core/test/test.cross-environment-token.ts @@ -2,7 +2,7 @@ import { Test } from 'nodeunit'; import { App, CfnOutput, CfnResource, Construct, PhysicalName, Resource, Stack } from '../lib'; import { toCloudFormation } from './util'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ export = { 'CrossEnvironmentToken': { @@ -254,7 +254,7 @@ class MyResource extends Resource { this.arn = this.getResourceArnAttribute('simple-arn', { region: '', account: '', - resource: 'my-resource', + resource: 'my-resource', resourceName: this.physicalName, service: 'myservice', }); diff --git a/packages/@aws-cdk/core/test/test.resource.ts b/packages/@aws-cdk/core/test/test.resource.ts index 38c88d26deabb..34f07c02ab56a 100644 --- a/packages/@aws-cdk/core/test/test.resource.ts +++ b/packages/@aws-cdk/core/test/test.resource.ts @@ -205,7 +205,7 @@ export = { const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); r1.cfnOptions.creationPolicy = { autoScalingCreationPolicy: { minSuccessfulInstancesPercent: 10 } }; - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len r1.cfnOptions.updatePolicy = { autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: false }, autoScalingReplacingUpdate: { willReplace: true }, @@ -382,7 +382,7 @@ export = { test.done(); }, - 'overrides': { + overrides: { 'addOverride(p, v) allows assigning arbitrary values to synthesized resource definitions'(test: Test) { // GIVEN const stack = new Stack(); @@ -707,7 +707,6 @@ export = { }; interface CounterProps { - // tslint:disable-next-line:variable-name Count: number; } diff --git a/packages/@aws-cdk/core/test/test.runtime-info.ts b/packages/@aws-cdk/core/test/test.runtime-info.ts index e307633628c37..8f619ce9f991d 100644 --- a/packages/@aws-cdk/core/test/test.runtime-info.ts +++ b/packages/@aws-cdk/core/test/test.runtime-info.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; +import { Test } from 'nodeunit'; import { collectRuntimeInformation } from '../lib/private/runtime-info'; export = { diff --git a/packages/@aws-cdk/core/test/test.stack.ts b/packages/@aws-cdk/core/test/test.stack.ts index 7f8e625ee4428..f60ec0d8a2513 100644 --- a/packages/@aws-cdk/core/test/test.stack.ts +++ b/packages/@aws-cdk/core/test/test.stack.ts @@ -525,7 +525,7 @@ export = { test.throws(() => { ConstructNode.prepare(app.node); - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len }, "'Stack2' depends on 'Stack1' (Stack2/SomeParameter -> Stack1.AWS::AccountId). Adding this dependency (Stack1/SomeParameter -> Stack2.AWS::AccountId) would create a cyclic reference."); test.done(); diff --git a/packages/@aws-cdk/core/test/test.staging.ts b/packages/@aws-cdk/core/test/test.staging.ts index 8de8d292477ae..bff677342bf7f 100644 --- a/packages/@aws-cdk/core/test/test.staging.ts +++ b/packages/@aws-cdk/core/test/test.staging.ts @@ -1,8 +1,8 @@ +import * as os from 'os'; +import * as path from 'path'; import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; import { Test } from 'nodeunit'; -import * as os from 'os'; -import * as path from 'path'; import * as sinon from 'sinon'; import { App, AssetHashType, AssetStaging, BundlingDockerImage, Stack } from '../lib'; diff --git a/packages/@aws-cdk/core/test/test.synthesis.ts b/packages/@aws-cdk/core/test/test.synthesis.ts index c0d598c0ee9b9..d83ba978bdaa3 100644 --- a/packages/@aws-cdk/core/test/test.synthesis.ts +++ b/packages/@aws-cdk/core/test/test.synthesis.ts @@ -1,9 +1,9 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs'; -import { Test } from 'nodeunit'; import * as os from 'os'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; +import { Test } from 'nodeunit'; import * as cdk from '../lib'; function createModernApp() { diff --git a/packages/@aws-cdk/core/test/test.tag-manager.ts b/packages/@aws-cdk/core/test/test.tag-manager.ts index 1ba8484fffb4f..dcde516f048e2 100644 --- a/packages/@aws-cdk/core/test/test.tag-manager.ts +++ b/packages/@aws-cdk/core/test/test.tag-manager.ts @@ -80,8 +80,8 @@ export = { {key: 'foo', value: 'bar', propagateAtLaunch: true}, ]); test.deepEqual(keyValue.renderTags(), [ - { Key: 'asg', Value : 'only' }, - { Key: 'foo', Value : 'bar' }, + { Key: 'asg', Value: 'only' }, + { Key: 'foo', Value: 'bar' }, ]); test.deepEqual(mapper.renderTags(), { foo: 'bar', diff --git a/packages/@aws-cdk/core/test/test.tokens.ts b/packages/@aws-cdk/core/test/test.tokens.ts index 3dfe56ff07c8d..e889be85e5add 100644 --- a/packages/@aws-cdk/core/test/test.tokens.ts +++ b/packages/@aws-cdk/core/test/test.tokens.ts @@ -121,7 +121,7 @@ export = { test.done(); }, - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'if a resolvable object inherits from a class that is also resolvable, the "constructor" function will not get in the way (uses Object.keys instead of "for in")'(test: Test) { test.deepEqual(resolve({ prop: new DataType() }), { prop: { foo: 12, goo: 'hello' } }); test.done(); diff --git a/packages/@aws-cdk/core/test/test.util.ts b/packages/@aws-cdk/core/test/test.util.ts index b9821868df432..010f6ef33dc5b 100644 --- a/packages/@aws-cdk/core/test/test.util.ts +++ b/packages/@aws-cdk/core/test/test.util.ts @@ -28,7 +28,7 @@ export = testCase({ test.done(); }, - 'ignoreEmpty': { + ignoreEmpty: { '[]'(test: Test) { const stack = new Stack(); @@ -73,7 +73,7 @@ export = testCase({ }, }, - 'filterUnderined': { + filterUnderined: { 'is null-safe (aka treats null and undefined the same)'(test: Test) { test.deepEqual(filterUndefined({ 'a null': null, 'a not null': true }), { 'a not null': true }); test.done(); diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts index 8c56de166305e..633d5d2d2e8f2 100644 --- a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts +++ b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts @@ -1,9 +1,9 @@ +import * as fs from 'fs'; +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as logs from '@aws-cdk/aws-logs'; import * as cdk from '@aws-cdk/core'; -import * as fs from 'fs'; -import * as path from 'path'; // don't use "require" since the typescript compiler emits errors since this // file is not listed in tsconfig.json. diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts index c0a6954f8c6f8..b26226b4783e1 100644 --- a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts +++ b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +/* eslint-disable no-console */ import { execSync } from 'child_process'; import { AwsSdkCall } from '../aws-custom-resource'; @@ -53,6 +53,10 @@ function filterKeys(object: object, pred: (key: string) => boolean) { let latestSdkInstalled = false; +export function forceSdkInstallation() { + latestSdkInstalled = false; +} + /** * Installs latest AWS SDK v2 */ @@ -60,6 +64,7 @@ function installLatestSdk(): void { console.log('Installing latest AWS SDK v2'); // Both HOME and --prefix are needed here because /tmp is the only writable location execSync('HOME=/tmp npm install aws-sdk@2 --production --no-package-lock --no-save --prefix /tmp'); + execSync('tree /tmp/node_modules'); latestSdkInstalled = true; } diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts index e420c5c6e8c38..a632f75c15d22 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts @@ -1,7 +1,7 @@ +import * as path from 'path'; import * as cfn from '@aws-cdk/aws-cloudformation'; import * as lambda from '@aws-cdk/aws-lambda'; import { Construct, Duration } from '@aws-cdk/core'; -import * as path from 'path'; import * as consts from './runtime/consts'; import { calculateRetryPolicy } from './util'; import { WaiterStateMachine } from './waiter-state-machine'; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts index 9e6daa4c6dcf9..ec6ec576aeffa 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts @@ -1,5 +1,5 @@ -// tslint:disable: max-line-length -// tslint:disable: no-console +/* eslint-disable max-len */ +/* eslint-disable no-console */ import * as url from 'url'; import { httpRequest } from './outbound'; import { log } from './util'; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts index 7777bfcb2b70d..f05708b8c6a7d 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts @@ -1,5 +1,5 @@ -// tslint:disable: no-console -// tslint:disable: max-line-length +/* eslint-disable max-len */ +/* eslint-disable no-console */ import { IsCompleteResponse, OnEventResponse } from '../types'; import * as cfnResponse from './cfn-response'; import * as consts from './consts'; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts index 682632fd1a40a..f3cb16ebd6f05 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts @@ -1,9 +1,9 @@ /* istanbul ignore file */ +import * as https from 'https'; // eslint-disable-next-line import/no-extraneous-dependencies import * as AWS from 'aws-sdk'; // eslint-disable-next-line import/no-extraneous-dependencies import { ConfigurationOptions } from 'aws-sdk/lib/config'; -import * as https from 'https'; const FRAMEWORK_HANDLER_TIMEOUT = 900000; // 15 minutes diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts index 062be15eb1741..be2c17118fbc9 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable no-console */ export function getEnv(name: string): string { const value = process.env[name]; diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts index 4126fb06a15f2..336d0103d8bbe 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts +++ b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts @@ -4,11 +4,13 @@ import * as fs from 'fs-extra'; import * as nock from 'nock'; import * as sinon from 'sinon'; import { AwsSdkCall, PhysicalResourceId } from '../../lib'; -import { flatten, handler } from '../../lib/aws-custom-resource/runtime'; +import { flatten, handler, forceSdkInstallation } from '../../lib/aws-custom-resource/runtime'; + +/* eslint-disable no-console */ AWS.setSDK(require.resolve('aws-sdk')); -console.log = jest.fn(); // tslint:disable-line no-console +console.log = jest.fn(); const eventCommon = { ServiceToken: 'token', @@ -415,7 +417,7 @@ test('flatten correctly flattens a nested object', () => { test('installs the latest SDK', async () => { const tmpPath = '/tmp/node_modules/aws-sdk'; - fs.remove(tmpPath); + await fs.remove(tmpPath); const publishFake = sinon.fake.resolves({}); @@ -442,6 +444,8 @@ test('installs the latest SDK', async () => { body.Status === 'SUCCESS', ); + // Reset to 'false' so that the next run will reinstall aws-sdk + forceSdkInstallation(); await handler(event, {} as AWSLambda.Context); expect(request.isDone()).toBeTruthy(); diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts index 52f00d489a764..f24f04131828b 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts +++ b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts @@ -4,7 +4,7 @@ import * as logs from '@aws-cdk/aws-logs'; import * as cdk from '@aws-cdk/core'; import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../lib'; -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ test('aws sdk js custom resource with onCreate and onDelete', () => { // GIVEN diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts index 7d39277c0a569..3b241031e04c1 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts +++ b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts @@ -1,4 +1,5 @@ #!/usr/bin/env node +/// !cdk-integ pragma:ignore-assets import * as sns from '@aws-cdk/aws-sns'; import * as ssm from '@aws-cdk/aws-ssm'; import * as cdk from '@aws-cdk/core'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts index e628938673c2c..01ccd37e89d89 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts @@ -1,5 +1,4 @@ -/// !cdk-integ * - +/// !cdk-integ * pragma:ignore-assets import * as s3 from '@aws-cdk/aws-s3'; import { App, CfnOutput, Construct, Stack } from '@aws-cdk/core'; import { S3Assert } from './integration-test-fixtures/s3-assert'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts index 06a5181053007..0823d21e05e51 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts @@ -1,8 +1,8 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as s3 from '@aws-cdk/aws-s3'; import { Construct, CustomResource, Duration, Stack } from '@aws-cdk/core'; -import * as path from 'path'; import * as cr from '../../../lib'; export interface S3AssertProps { diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts index b21fbdcf1a05f..7495b72cbd157 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable no-console */ import * as AWS from 'aws-sdk'; import * as api from './api'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts index a2764f97541ef..234ec567cbdbb 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts @@ -1,8 +1,8 @@ +import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as s3 from '@aws-cdk/aws-s3'; import { Construct, CustomResource, Stack } from '@aws-cdk/core'; -import * as path from 'path'; import * as cr from '../../../lib'; import * as api from './s3-file-handler/api'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts index 7831d74fe11ce..5ba782a14c992 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts @@ -1,6 +1,6 @@ +import * as path from 'path'; import * as lambda from '@aws-cdk/aws-lambda'; import { Duration, Stack } from '@aws-cdk/core'; -import * as path from 'path'; import * as cr from '../../lib'; import * as util from '../../lib/provider-framework/util'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts index 911d51f234666..45cc13a460959 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts +++ b/packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts @@ -1,11 +1,10 @@ -// tslint:disable: no-console -// tslint:disable: max-line-length +/* eslint-disable max-len */ +/* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-require-imports */ import cfnResponse = require('../../lib/provider-framework/runtime/cfn-response'); import framework = require('../../lib/provider-framework/runtime/framework'); import outbound = require('../../lib/provider-framework/runtime/outbound'); import mocks = require('./mocks'); -/* eslint-enable */ console.log = jest.fn(); diff --git a/packages/@aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts b/packages/@aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts index 07414bafe4249..8d79c92e89bb9 100644 --- a/packages/@aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts +++ b/packages/@aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudArtifact } from '../cloud-artifact'; import { CloudAssembly } from '../cloud-assembly'; diff --git a/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts b/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts index e22bc5764a798..66a39b250ca1c 100644 --- a/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts +++ b/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts @@ -1,6 +1,6 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudArtifact } from '../cloud-artifact'; import { CloudAssembly } from '../cloud-assembly'; import { Environment, EnvironmentUtils } from '../environment'; diff --git a/packages/@aws-cdk/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts b/packages/@aws-cdk/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts index bf3e378774d96..3aa57577851b0 100644 --- a/packages/@aws-cdk/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts +++ b/packages/@aws-cdk/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudArtifact } from '../cloud-artifact'; import { CloudAssembly } from '../cloud-assembly'; diff --git a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts index b12c8a52ccdb6..c94b83d97f9e4 100644 --- a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts +++ b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudFormationStackArtifact } from './artifacts/cloudformation-artifact'; import { NestedCloudAssemblyArtifact } from './artifacts/nested-cloud-assembly-artifact'; import { TreeCloudArtifact } from './artifacts/tree-cloud-artifact'; @@ -85,6 +85,7 @@ export class CloudAssembly { } if (artifacts.length > 1) { + // eslint-disable-next-line max-len throw new Error(`There are multiple stacks with the stack name "${stackName}" (${artifacts.map(a => a.id).join(',')}). Use "getStackArtifact(id)" instead`); } diff --git a/packages/@aws-cdk/cx-api/test/cloud-assembly-builder.test.ts b/packages/@aws-cdk/cx-api/test/cloud-assembly-builder.test.ts index c3ae0aa6609ea..fd908ebcd389f 100644 --- a/packages/@aws-cdk/cx-api/test/cloud-assembly-builder.test.ts +++ b/packages/@aws-cdk/cx-api/test/cloud-assembly-builder.test.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '../lib'; test('cloud assembly builder', () => { diff --git a/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts b/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts index f3ee5f817caa6..81164d16484c9 100644 --- a/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts +++ b/packages/@aws-cdk/cx-api/test/cloud-assembly.test.ts @@ -118,6 +118,7 @@ test('stack artifacts can specify an explicit stack name that is different from test('getStackByName fails if there are multiple stacks with the same name', () => { const assembly = new CloudAssembly(path.join(FIXTURES, 'multiple-stacks-same-name')); + // eslint-disable-next-line max-len expect(() => assembly.getStackByName('the-physical-name-of-the-stack')).toThrow(/There are multiple stacks with the stack name \"the-physical-name-of-the-stack\" \(stack1\,stack2\)\. Use \"getStackArtifact\(id\)\" instead/); }); diff --git a/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts b/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts index 5dcab5f1a8288..4d73c8be33973 100644 --- a/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts +++ b/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts @@ -19,7 +19,7 @@ import * as core from '@aws-cdk/core'; import * as er from '../lib'; /* We allow quotes in the object keys used for CloudFormation template assertions */ -// tslint:disable:object-literal-key-quotes +/* eslint-disable quote-props */ describe('Example Resource', () => { let stack: core.Stack; diff --git a/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts b/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts index fedc5e8ad7583..96afb6660dd73 100644 --- a/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts +++ b/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts @@ -1,5 +1,5 @@ -import * as fs from 'fs-extra'; import * as path from 'path'; +import * as fs from 'fs-extra'; import { Default } from '../lib/default'; import { AWS_REGIONS, AWS_SERVICES } from './aws-entities'; @@ -7,8 +7,8 @@ async function main(): Promise { const lines = [ "import { Fact, FactName } from './fact';", '', - '// tslint:disable:object-literal-key-quotes', - '// tslint:disable:max-line-length', + '/* eslint-disable quote-props */', + '/* eslint-disable max-len */', '', '/**', ' * Built-in regional information, re-generated by `npm run build`.', @@ -145,7 +145,7 @@ async function main(): Promise { } main().catch(e => { - // tslint:disable-next-line: no-console + // eslint-disable-next-line no-console console.error(e); process.exit(-1); }); diff --git a/packages/@monocdk-experiment/rewrite-imports/bin/rewrite-imports.ts b/packages/@monocdk-experiment/rewrite-imports/bin/rewrite-imports.ts index 6193a04f5715e..fe70da35a582b 100644 --- a/packages/@monocdk-experiment/rewrite-imports/bin/rewrite-imports.ts +++ b/packages/@monocdk-experiment/rewrite-imports/bin/rewrite-imports.ts @@ -1,4 +1,4 @@ -// tslint:disable: no-console +/* eslint-disable no-console */ import * as fs from 'fs'; import * as _glob from 'glob'; diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index 79b90682dc5c4..463e1cc59b6ed 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -19,7 +19,9 @@ import { serializeStructure } from '../lib/serialize'; import { Configuration, Settings } from '../lib/settings'; import * as version from '../lib/version'; -// tslint:disable:no-shadowed-variable max-line-length +/* eslint-disable max-len */ +/* eslint-disable no-shadow */ // yargs + async function parseCommandLineArguments() { // Use the following configuration for array arguments: // diff --git a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts index 12ca6896ea4c5..75082b9953966 100644 --- a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts +++ b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts @@ -1,5 +1,5 @@ -import * as fs from 'fs-extra'; import * as path from 'path'; +import * as fs from 'fs-extra'; import { debug } from '../../logging'; import { cdkCacheDir } from '../../util/directories'; import { Account } from './sdk-provider'; diff --git a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts b/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts index dc1c5df8c8ce8..0baeaa323f81e 100644 --- a/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts +++ b/packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts @@ -1,9 +1,9 @@ -import * as AWS from 'aws-sdk'; import * as child_process from 'child_process'; -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; import * as util from 'util'; +import * as AWS from 'aws-sdk'; +import * as fs from 'fs-extra'; import { debug } from '../../logging'; import { SharedIniFile } from './sdk_ini_file'; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts b/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts index 499a5af46beb0..8822c2603a237 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts @@ -1,10 +1,10 @@ +import * as https from 'https'; +import * as os from 'os'; +import * as path from 'path'; import * as cxapi from '@aws-cdk/cx-api'; import * as AWS from 'aws-sdk'; import { ConfigurationOptions } from 'aws-sdk/lib/config'; import * as fs from 'fs-extra'; -import * as https from 'https'; -import * as os from 'os'; -import * as path from 'path'; import { debug } from '../../logging'; import { cached } from '../../util/functions'; import { CredentialPlugins } from '../aws-auth/credential-plugins'; diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk_ini_file.ts b/packages/aws-cdk/lib/api/aws-auth/sdk_ini_file.ts index ef49fce2b789b..91c50e87c0a97 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk_ini_file.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk_ini_file.ts @@ -5,10 +5,10 @@ * region at runtime, but unfortunately it is private upstream. */ -import * as AWS from 'aws-sdk'; -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; +import * as AWS from 'aws-sdk'; +import * as fs from 'fs-extra'; export interface SharedIniFileOptions { isConfig?: boolean; diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts index 71e85d77e9d69..ff23e8be8a79c 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts @@ -1,5 +1,5 @@ -import * as cxapi from '@aws-cdk/cx-api'; import * as path from 'path'; +import * as cxapi from '@aws-cdk/cx-api'; import { loadStructuredFile } from '../../serialize'; import { SdkProvider } from '../aws-auth'; import { DeployStackResult } from '../deploy-stack'; @@ -7,7 +7,7 @@ import { BootstrapEnvironmentOptions } from './bootstrap-props'; import { deployBootstrapStack } from './deploy-bootstrap'; import { legacyBootstrapTemplate } from './legacy-template'; -// tslint:disable:max-line-length +/* eslint-disable max-len */ /** * Deploy legacy bootstrap stack diff --git a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts index 3ced4622c74b7..f078ec5ca279b 100644 --- a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts +++ b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts @@ -1,8 +1,8 @@ +import * as os from 'os'; +import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; -import * as os from 'os'; -import * as path from 'path'; import { Mode, SdkProvider } from '../aws-auth'; import { deployStack, DeployStackResult } from '../deploy-stack'; import { DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo } from '../toolkit-info'; diff --git a/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts b/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts index 0b98ea3a3fbe2..2ba916f192aeb 100644 --- a/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts +++ b/packages/aws-cdk/lib/api/bootstrap/legacy-template.ts @@ -5,7 +5,7 @@ export function legacyBootstrapTemplate(params: BootstrappingParameters): any { Description: 'The CDK Toolkit Stack. It was created by `cdk bootstrap` and manages resources necessary for managing your Cloud Applications with AWS CDK.', Conditions: { UsePublicAccessBlockConfiguration: { - 'Fn::Equals' : [ + 'Fn::Equals': [ params.publicAccessBlockConfiguration || params.publicAccessBlockConfiguration === undefined ? 'true' : 'false', 'true', ]}, @@ -25,7 +25,7 @@ export function legacyBootstrapTemplate(params: BootstrappingParameters): any { }], }, PublicAccessBlockConfiguration: { - 'Fn::If' : [ + 'Fn::If': [ 'UsePublicAccessBlockConfiguration', { BlockPublicAcls: true, diff --git a/packages/aws-cdk/lib/api/cxapp/environments.ts b/packages/aws-cdk/lib/api/cxapp/environments.ts index d95d44b3ea38e..f79d6de2847ad 100644 --- a/packages/aws-cdk/lib/api/cxapp/environments.ts +++ b/packages/aws-cdk/lib/api/cxapp/environments.ts @@ -7,7 +7,7 @@ export function looksLikeGlob(environment: string) { return environment.indexOf('*') > -1; } -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export async function globEnvironmentsFromStacks(stacks: StackCollection, environmentGlobs: string[], sdk: SdkProvider): Promise { if (environmentGlobs.length === 0) { return []; } diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index 93ddb1264f2ff..c3b4f998617b6 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -1,8 +1,8 @@ +import * as childProcess from 'child_process'; +import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; -import * as childProcess from 'child_process'; import * as fs from 'fs-extra'; -import * as path from 'path'; import { debug } from '../../logging'; import { Configuration, PROJECT_CONFIG, USER_DEFAULTS } from '../../settings'; import { versionNumber } from '../../version'; @@ -191,7 +191,7 @@ async function guessExecutable(commandLine: string[]) { return commandLine; } - // tslint:disable-next-line:no-bitwise + // eslint-disable-next-line no-bitwise const isExecutable = (fstat.mode & fs.constants.X_OK) !== 0; const isWindows = process.platform === 'win32'; diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index bf9267986bdea..b5f10b226f7e2 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -20,7 +20,6 @@ import { StackActivityMonitor } from './util/cloudformation/stack-activity-monit // refactor that away. /* eslint-disable @typescript-eslint/no-require-imports */ -// tslint:disable-next-line: no-var-requires const regionUtil = require('aws-sdk/lib/region_config'); /* eslint-enable @typescript-eslint/no-require-imports */ @@ -258,7 +257,7 @@ export async function deployStack(options: DeployStackOptions): Promise(valueProvider: () => Promise, ti * * @returns the CloudFormation description of the ChangeSet */ -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export async function waitForChangeSet(cfn: CloudFormation, stackName: string, changeSetName: string): Promise { debug('Waiting for changeset %s on stack %s to finish creating...', changeSetName, stackName); const ret = await waitFor(async () => { @@ -216,7 +216,7 @@ export async function waitForChangeSet(cfn: CloudFormation, stackName: string, c return description; } - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Failed to create ChangeSet ${changeSetName} on ${stackName}: ${description.Status || 'NO_STATUS'}, ${description.StatusReason || 'no reason provided'}`); }); diff --git a/packages/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts b/packages/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts index 7df4680c7fb3c..49025b9c8df60 100644 --- a/packages/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts +++ b/packages/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts @@ -1,8 +1,8 @@ +import * as util from 'util'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as aws from 'aws-sdk'; import * as colors from 'colors/safe'; -import * as util from 'util'; import { error, logLevel, LogLevel, setLogLevel } from '../../../logging'; import { RewritableBlock } from '../display'; diff --git a/packages/aws-cdk/lib/assets.ts b/packages/aws-cdk/lib/assets.ts index dec8d01f52ba0..b6a8b6b0dfeb8 100644 --- a/packages/aws-cdk/lib/assets.ts +++ b/packages/aws-cdk/lib/assets.ts @@ -1,8 +1,8 @@ -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len +import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as colors from 'colors'; -import * as path from 'path'; import { ToolkitInfo } from './api/toolkit-info'; import { debug } from './logging'; import { AssetManifestBuilder } from './util/asset-manifest-builder'; @@ -13,7 +13,7 @@ import { AssetManifestBuilder } from './util/asset-manifest-builder'; * Returns the CloudFormation parameters that need to be sent to the template to * pass Asset coordinates. */ -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len export async function addMetadataAssetsToManifest(stack: cxapi.CloudFormationStackArtifact, assetManifest: AssetManifestBuilder, toolkitInfo?: ToolkitInfo, reuse?: string[]): Promise> { reuse = reuse || []; const assets = stack.assets; @@ -23,7 +23,7 @@ export async function addMetadataAssetsToManifest(stack: cxapi.CloudFormationSta } if (!toolkitInfo) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${colors.blue('cdk bootstrap ' + stack.environment!.name)}")`); } @@ -50,7 +50,7 @@ export async function addMetadataAssetsToManifest(stack: cxapi.CloudFormationSta return params; } -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len async function prepareAsset(asset: cxschema.AssetMetadataEntry, assetManifest: AssetManifestBuilder, toolkitInfo: ToolkitInfo): Promise> { switch (asset.packaging) { case 'zip': @@ -63,7 +63,7 @@ async function prepareAsset(asset: cxschema.AssetMetadataEntry, assetManifest: A case 'container-image': return await prepareDockerImageAsset(asset, assetManifest, toolkitInfo); default: - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Unsupported packaging type: ${(asset as any).packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`); } } diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index eaf5f3be69e6a..3ff6046e9bcee 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -1,10 +1,10 @@ +import * as path from 'path'; +import { format } from 'util'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as colors from 'colors/safe'; import * as fs from 'fs-extra'; -import * as path from 'path'; import * as promptly from 'promptly'; -import { format } from 'util'; import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../lib/api/cxapp/environments'; import { bootstrapEnvironment } from './api'; import { SdkProvider } from './api/aws-auth'; @@ -134,7 +134,7 @@ export class CdkToolkit { for (const stack of stacks.stackArtifacts) { if (stacks.stackCount !== 1) { highlight(stack.displayName); } if (!stack.environment) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Stack ${stack.displayName} does not define an environment, and AWS credentials could not be obtained from standard locations or no region was configured.`); } @@ -237,7 +237,7 @@ export class CdkToolkit { stacks = stacks.reversed(); if (!options.force) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len const confirmed = await promptly.confirm(`Are you sure you want to delete: ${colors.blue(stacks.stackArtifacts.map(s => s.id).join(', '))} (y/n)?`); if (!confirmed) { return; diff --git a/packages/aws-cdk/lib/commands/context.ts b/packages/aws-cdk/lib/commands/context.ts index c0cca57745fb1..748e72ba4aabe 100644 --- a/packages/aws-cdk/lib/commands/context.ts +++ b/packages/aws-cdk/lib/commands/context.ts @@ -74,7 +74,7 @@ function listContext(context: any) { print(renderTable(data, process.stdout.columns)); - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len print(`Run ${colors.blue('cdk context --reset KEY_OR_NUMBER')} to remove a context key. It will be refreshed on the next CDK synthesis run.`); } diff --git a/packages/aws-cdk/lib/commands/docs.ts b/packages/aws-cdk/lib/commands/docs.ts index d5767031377b0..ea5c34287e51d 100644 --- a/packages/aws-cdk/lib/commands/docs.ts +++ b/packages/aws-cdk/lib/commands/docs.ts @@ -1,6 +1,6 @@ import * as childProcess from 'child_process'; -import * as colors from 'colors/safe'; import * as process from 'process'; +import * as colors from 'colors/safe'; import * as yargs from 'yargs'; import { debug, print, warning } from '../../lib/logging'; import { CommandOptions } from '../command-api'; diff --git a/packages/aws-cdk/lib/commands/doctor.ts b/packages/aws-cdk/lib/commands/doctor.ts index 1c86b8dc7c33b..02a2bfcebacd0 100644 --- a/packages/aws-cdk/lib/commands/doctor.ts +++ b/packages/aws-cdk/lib/commands/doctor.ts @@ -1,6 +1,6 @@ +import * as process from 'process'; import * as cxapi from '@aws-cdk/cx-api'; import * as colors from 'colors/safe'; -import * as process from 'process'; import * as yargs from 'yargs'; import { print } from '../../lib/logging'; import * as version from '../../lib/version'; diff --git a/packages/aws-cdk/lib/context-providers/index.ts b/packages/aws-cdk/lib/context-providers/index.ts index b46717918308e..5390a210668d1 100644 --- a/packages/aws-cdk/lib/context-providers/index.ts +++ b/packages/aws-cdk/lib/context-providers/index.ts @@ -26,7 +26,7 @@ export async function provideContextValues( const key = missingContext.key; const constructor = availableContextProviders[missingContext.provider]; if (!constructor) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Unrecognized context provider name: ${missingContext.provider}. You might need to update the toolkit to match the version of the construct library.`); } diff --git a/packages/aws-cdk/lib/context-providers/vpcs.ts b/packages/aws-cdk/lib/context-providers/vpcs.ts index a2b3dec92eedf..f91e829b4147c 100644 --- a/packages/aws-cdk/lib/context-providers/vpcs.ts +++ b/packages/aws-cdk/lib/context-providers/vpcs.ts @@ -70,7 +70,7 @@ export class VpcNetworkContextProviderPlugin implements ContextProviderPlugin { if (type === undefined) { type = SubnetType.Private; } if (!isValidSubnetType(type)) { - // tslint:disable-next-line: max-line-length + // eslint-disable-next-line max-len throw new Error(`Subnet ${subnet.SubnetArn} has invalid subnet type ${type} (must be ${SubnetType.Public}, ${SubnetType.Private} or ${SubnetType.Isolated})`); } diff --git a/packages/aws-cdk/lib/diff.ts b/packages/aws-cdk/lib/diff.ts index 866f691c203a7..0913e2bab5edd 100644 --- a/packages/aws-cdk/lib/diff.ts +++ b/packages/aws-cdk/lib/diff.ts @@ -59,7 +59,7 @@ export function printSecurityDiff(oldTemplate: any, newTemplate: cxapi.CloudForm const diff = cfnDiff.diffTemplate(oldTemplate, newTemplate.template); if (difRequiresApproval(diff, requireApproval)) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len warning(`This deployment will make potentially sensitive changes according to your current security approval level (--require-approval ${requireApproval}).`); warning('Please confirm you intend to make the following modifications:\n'); diff --git a/packages/aws-cdk/lib/init.ts b/packages/aws-cdk/lib/init.ts index cff039fbb9cee..c2027e596fddf 100644 --- a/packages/aws-cdk/lib/init.ts +++ b/packages/aws-cdk/lib/init.ts @@ -1,19 +1,18 @@ -import * as cxapi from '@aws-cdk/cx-api'; import * as childProcess from 'child_process'; +import * as path from 'path'; +import * as cxapi from '@aws-cdk/cx-api'; import * as colors from 'colors/safe'; import * as fs from 'fs-extra'; -import * as path from 'path'; import { error, print, warning } from './logging'; import { cdkHomeDir } from './util/directories'; export type InvokeHook = (targetDirectory: string) => Promise; -// tslint:disable:no-var-requires those libraries don't have up-to-date @types modules +/* eslint-disable @typescript-eslint/no-var-requires */ // Packages don't have @types module // eslint-disable-next-line @typescript-eslint/no-require-imports const camelCase = require('camelcase'); // eslint-disable-next-line @typescript-eslint/no-require-imports const decamelize = require('decamelize'); -// tslint:enable:no-var-requires const TEMPLATES_DIR = path.join(__dirname, 'init-templates'); diff --git a/packages/aws-cdk/lib/logging.ts b/packages/aws-cdk/lib/logging.ts index b85881886a84f..a2bb647adddef 100644 --- a/packages/aws-cdk/lib/logging.ts +++ b/packages/aws-cdk/lib/logging.ts @@ -1,6 +1,6 @@ -import * as colors from 'colors/safe'; import { Writable } from 'stream'; import * as util from 'util'; +import * as colors from 'colors/safe'; type StyleFn = (str: string) => string; const { stdout, stderr } = process; diff --git a/packages/aws-cdk/lib/plugin.ts b/packages/aws-cdk/lib/plugin.ts index be71bbdbc1004..4b4ad7956edc3 100644 --- a/packages/aws-cdk/lib/plugin.ts +++ b/packages/aws-cdk/lib/plugin.ts @@ -63,7 +63,6 @@ export class PluginHost { public load(moduleSpec: string) { try { /* eslint-disable @typescript-eslint/no-require-imports */ - // tslint:disable-next-line:no-var-requires const plugin = require(moduleSpec); /* eslint-enable */ if (!isPlugin(plugin)) { diff --git a/packages/aws-cdk/lib/serialize.ts b/packages/aws-cdk/lib/serialize.ts index dc759db0ca567..638c4f6314d9a 100644 --- a/packages/aws-cdk/lib/serialize.ts +++ b/packages/aws-cdk/lib/serialize.ts @@ -2,7 +2,6 @@ import * as fs from 'fs-extra'; import * as YAML from 'yaml'; /* eslint-disable @typescript-eslint/no-require-imports */ -// tslint:disable-next-line: no-var-requires const yamlTypes = require('yaml/types'); /* eslint-enable */ diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts index 93e37e9d3eab3..e1db3969d0a69 100644 --- a/packages/aws-cdk/lib/settings.ts +++ b/packages/aws-cdk/lib/settings.ts @@ -1,6 +1,6 @@ -import * as fs from 'fs-extra'; import * as os from 'os'; import * as fs_path from 'path'; +import * as fs from 'fs-extra'; import { Tag } from './cdk-toolkit'; import { debug, warning } from './logging'; import * as util from './util'; @@ -329,7 +329,7 @@ export class Settings { private prohibitContextKey(key: string, fileName: string) { if (!this.settings.context) { return; } if (key in this.settings.context) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`The 'context.${key}' key was found in ${fs_path.resolve(fileName)}, but it is no longer supported. Please remove it.`); } } @@ -338,7 +338,7 @@ export class Settings { if (!this.settings.context) { return; } for (const contextKey of Object.keys(this.settings.context)) { if (contextKey.startsWith(prefix)) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len warning(`A reserved context key ('context.${prefix}') key was found in ${fs_path.resolve(fileName)}, it might cause surprising behavior and should be removed.`); } } diff --git a/packages/aws-cdk/lib/version.ts b/packages/aws-cdk/lib/version.ts index 7c8c913ee06ba..fecbe1c0e1886 100644 --- a/packages/aws-cdk/lib/version.ts +++ b/packages/aws-cdk/lib/version.ts @@ -1,9 +1,9 @@ import { exec as _exec } from 'child_process'; +import * as path from 'path'; +import { promisify } from 'util'; import * as colors from 'colors/safe'; import * as fs from 'fs-extra'; -import * as path from 'path'; import * as semver from 'semver'; -import { promisify } from 'util'; import { debug, print } from '../lib/logging'; import { formatAsBanner } from '../lib/util/console-formatters'; import { cdkCacheDir } from './util/directories'; diff --git a/packages/aws-cdk/test/account-cache.test.ts b/packages/aws-cdk/test/account-cache.test.ts index 7238c4c3be415..c9b5682f33124 100644 --- a/packages/aws-cdk/test/account-cache.test.ts +++ b/packages/aws-cdk/test/account-cache.test.ts @@ -1,5 +1,5 @@ -import * as fs from 'fs-extra'; import * as path from 'path'; +import * as fs from 'fs-extra'; import { AccountAccessKeyCache } from '../lib/api/aws-auth/account-cache'; async function makeCache() { diff --git a/packages/aws-cdk/test/bockfs.ts b/packages/aws-cdk/test/bockfs.ts index 24e76c52c2774..47f96f3af6f33 100644 --- a/packages/aws-cdk/test/bockfs.ts +++ b/packages/aws-cdk/test/bockfs.ts @@ -8,9 +8,9 @@ // // The big downside compared to mockfs is that you need to use bockfs.path() to translate // fake paths to real paths. -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path_ from 'path'; +import * as fs from 'fs-extra'; const bockFsRoot = fs.mkdtempSync(path_.join(os.tmpdir(), 'bockfs')); let oldCwd: string | undefined; diff --git a/packages/aws-cdk/test/context.test.ts b/packages/aws-cdk/test/context.test.ts index eef3117e72e63..452a814a69324 100644 --- a/packages/aws-cdk/test/context.test.ts +++ b/packages/aws-cdk/test/context.test.ts @@ -1,6 +1,6 @@ -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; +import * as fs from 'fs-extra'; import { Configuration, TRANSIENT_CONTEXT_KEY } from '../lib/settings'; const state: { @@ -11,14 +11,14 @@ const state: { beforeAll(async done => { state.previousWorkingDir = process.cwd(); state.tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aws-cdk-test')); - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log('Temporary working directory:', state.tempDir); process.chdir(state.tempDir); done(); }); afterAll(async done => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log('Switching back to', state.previousWorkingDir, 'cleaning up', state.tempDir); process.chdir(state.previousWorkingDir!); await fs.remove(state.tempDir!); @@ -71,16 +71,16 @@ test('clear deletes from new file', async () => { test('context is preserved in the location from which it is read', async () => { // GIVEN - await fs.writeJSON('cdk.json', { context: { 'boo:boo' : 'far' } }); + await fs.writeJSON('cdk.json', { context: { 'boo:boo': 'far' } }); const config = await new Configuration().load(); // WHEN - expect(config.context.all).toEqual({ 'boo:boo' : 'far' }); + expect(config.context.all).toEqual({ 'boo:boo': 'far' }); await config.saveContext(); // THEN expect(await fs.readJSON('cdk.context.json')).toEqual({}); - expect(await fs.readJSON('cdk.json')).toEqual({ context: { 'boo:boo' : 'far' } }); + expect(await fs.readJSON('cdk.json')).toEqual({ context: { 'boo:boo': 'far' } }); }); test('surive no context in old file', async () => { diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index 2a987915cf043..6f818346d5124 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -1,6 +1,6 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { Writable } from 'stream'; import { NodeStringDecoder, StringDecoder } from 'string_decoder'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudFormationDeployments } from '../lib/api/cloudformation-deployments'; import { CdkToolkit } from '../lib/cdk-toolkit'; import { classMockOf, MockCloudExecutable } from './util'; diff --git a/packages/aws-cdk/test/init.test.ts b/packages/aws-cdk/test/init.test.ts index 0dc7bae16aec1..9e9ae78784a45 100644 --- a/packages/aws-cdk/test/init.test.ts +++ b/packages/aws-cdk/test/init.test.ts @@ -1,7 +1,7 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import * as fs from 'fs-extra'; import * as os from 'os'; import * as path from 'path'; +import * as cxapi from '@aws-cdk/cx-api'; +import * as fs from 'fs-extra'; import { availableInitTemplates, cliInit } from '../lib/init'; cliTest('create a TypeScript library project', async (workDir) => { diff --git a/packages/aws-cdk/test/integ/cli/cli.integtest.ts b/packages/aws-cdk/test/integ/cli/cli.integtest.ts index b31bbf314d60a..564b329414e7a 100644 --- a/packages/aws-cdk/test/integ/cli/cli.integtest.ts +++ b/packages/aws-cdk/test/integ/cli/cli.integtest.ts @@ -336,7 +336,6 @@ integTest('deploy with role', async () => { async function deleteRole() { try { - // tslint:disable-next-line: forin for (const policyName of (await iam('listRolePolicies', { RoleName: roleName })).PolicyNames) { await iam('deleteRolePolicy', { RoleName: roleName, diff --git a/packages/aws-cdk/test/util.ts b/packages/aws-cdk/test/util.ts index 43ab781ab273c..f6966e8737711 100644 --- a/packages/aws-cdk/test/util.ts +++ b/packages/aws-cdk/test/util.ts @@ -1,7 +1,7 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs'; import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '@aws-cdk/cx-api'; import { CloudExecutable } from '../lib/api/cxapp/cloud-executable'; import { Configuration } from '../lib/settings'; import { MockSdkProvider } from './util/mock-sdk'; diff --git a/packages/aws-cdk/test/version.test.ts b/packages/aws-cdk/test/version.test.ts index 2a48a13852e89..005ccd209e609 100644 --- a/packages/aws-cdk/test/version.test.ts +++ b/packages/aws-cdk/test/version.test.ts @@ -1,8 +1,8 @@ -import * as fs from 'fs-extra'; import * as path from 'path'; -import * as sinon from 'sinon'; import { setTimeout as _setTimeout } from 'timers'; import { promisify } from 'util'; +import * as fs from 'fs-extra'; +import * as sinon from 'sinon'; import { latestVersionIfHigher, VersionCheckTTL } from '../lib/version'; const setTimeout = promisify(_setTimeout); diff --git a/packages/aws-cdk/test/yaml.test.ts b/packages/aws-cdk/test/yaml.test.ts index b440f8e2663df..aabcd090fbfea 100644 --- a/packages/aws-cdk/test/yaml.test.ts +++ b/packages/aws-cdk/test/yaml.test.ts @@ -6,7 +6,7 @@ const q = '"'; test('quote the word "ON"', () => { // NON NEGOTIABLE! If not quoted, will be interpreted as the boolean TRUE - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console const output = toYAML({ notABoolean: 'ON', }); diff --git a/packages/awslint/.eslintrc.js b/packages/awslint/.eslintrc.js new file mode 100644 index 0000000000000..0c8afb4aeb0c3 --- /dev/null +++ b/packages/awslint/.eslintrc.js @@ -0,0 +1,3 @@ +const baseConfig = require('../../tools/cdk-build-tools/config/eslintrc'); +baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; +module.exports = baseConfig; diff --git a/packages/awslint/.gitignore b/packages/awslint/.gitignore index ca58b8b90d671..fdf7e5c6f084b 100644 --- a/packages/awslint/.gitignore +++ b/packages/awslint/.gitignore @@ -93,3 +93,6 @@ dist .LAST_BUILD *.snk nyc.config.js + +!.eslintrc.js +junit.xml \ No newline at end of file diff --git a/packages/awslint/.npmignore b/packages/awslint/.npmignore index bc9fd0e49f9a1..dd1dbf2be01be 100644 --- a/packages/awslint/.npmignore +++ b/packages/awslint/.npmignore @@ -2,4 +2,10 @@ dist .LAST_PACKAGE .LAST_BUILD -*.snk \ No newline at end of file +*.snk +# exclude cdk artifacts +**/cdk.out +*.tsbuildinfo +tsconfig.json +.eslintrc.js +junit.xml \ No newline at end of file diff --git a/packages/awslint/README.md b/packages/awslint/README.md index 585a2b79a86ed..f69074a1f0ab0 100644 --- a/packages/awslint/README.md +++ b/packages/awslint/README.md @@ -1,4 +1,14 @@ # awslint + +--- + +![cdk-constructs: Developer Preview](https://img.shields.io/badge/cdk--constructs-developer--preview-informational.svg?style=for-the-badge) + +> The APIs of higher level constructs in this module are in **developer preview** before they become stable. We will only make breaking changes to address unforeseen API issues. Therefore, these APIs are not subject to [Semantic Versioning](https://semver.org/), and breaking changes will be announced in release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package. + +--- + + A linter for the AWS Construct Library's API. It reflects a construct library's module via it's `.jsii` manifest and checks that the module adheres to the [AWS diff --git a/packages/awslint/bin/awslint.ts b/packages/awslint/bin/awslint.ts index a009da634a7c9..6b315611919e2 100644 --- a/packages/awslint/bin/awslint.ts +++ b/packages/awslint/bin/awslint.ts @@ -1,4 +1,5 @@ -// tslint:disable:max-line-length +/* eslint-disable max-len */ +/* eslint-disable no-console */ import * as child_process from 'child_process'; import * as colors from 'colors'; import * as fs from 'fs-extra'; @@ -196,7 +197,7 @@ async function main() { // we don't have a .jsii file, and --no-compile is explicily set, then it's an error if (args.compile === false) { - throw new Error(`No .jsii file and --no-compile is set`); + throw new Error('No .jsii file and --no-compile is set'); } // compile! @@ -219,7 +220,7 @@ async function loadModule(dir: string) { // We run 'awslint' during build time, assemblies are guaranteed to be ok. if (ts.roots.length !== 1) { - throw new Error(`Expecting only a single root assembly`); + throw new Error('Expecting only a single root assembly'); } return ts.roots[0]; diff --git a/packages/awslint/lib/linter.ts b/packages/awslint/lib/linter.ts index a8b3da0b4bb0e..369902e5560ce 100644 --- a/packages/awslint/lib/linter.ts +++ b/packages/awslint/lib/linter.ts @@ -1,5 +1,5 @@ -import * as reflect from 'jsii-reflect'; import { PrimitiveType } from '@jsii/spec'; +import * as reflect from 'jsii-reflect'; import * as util from 'util'; export interface LinterOptions { diff --git a/packages/awslint/lib/rules/api.ts b/packages/awslint/lib/rules/api.ts index 0453c021a5ddb..2a1c6d96420cf 100644 --- a/packages/awslint/lib/rules/api.ts +++ b/packages/awslint/lib/rules/api.ts @@ -141,5 +141,5 @@ apiLinter.add({ throw new Error(`invalid type reference: ${type.toString()}`); } - } + }, }); diff --git a/packages/awslint/lib/rules/attributes.ts b/packages/awslint/lib/rules/attributes.ts index bd47ded6eb9d8..3fbe132da90fa 100644 --- a/packages/awslint/lib/rules/attributes.ts +++ b/packages/awslint/lib/rules/attributes.ts @@ -24,7 +24,7 @@ attributesLinter.add({ message: 'attribute property must be readonly', eval: e => { e.assert(e.ctx.attr.property.immutable, e.ctx.fqn); - } + }, }); attributesLinter.add({ @@ -33,5 +33,5 @@ attributesLinter.add({ eval: e => { const tag = e.ctx.attr.property.docs.customTag('attribute'); e.assert(tag, e.ctx.fqn, `${e.ctx.attr.property.parentType.fqn}.${e.ctx.attr.property.name}`); - } + }, }); diff --git a/packages/awslint/lib/rules/cfn-resource.ts b/packages/awslint/lib/rules/cfn-resource.ts index 318d86dab9ab4..536d53cb4c766 100644 --- a/packages/awslint/lib/rules/cfn-resource.ts +++ b/packages/awslint/lib/rules/cfn-resource.ts @@ -10,12 +10,12 @@ export const cfnResourceLinter = new Linter(a => CfnResourceReflection.findAll(a cfnResourceLinter.add({ code: 'resource-class', - message: `every resource must have a resource class (L2), add '@resource %s' to its docstring`, + message: 'every resource must have a resource class (L2), add \'@resource %s\' to its docstring', warning: true, eval: e => { const l2 = ResourceReflection.findAll(e.ctx.classType.assembly).find(r => r.cfn.fullname === e.ctx.fullname); e.assert(l2, e.ctx.fullname, e.ctx.fullname); - } + }, }); export class CfnResourceReflection { diff --git a/packages/awslint/lib/rules/cloudwatch-events.ts b/packages/awslint/lib/rules/cloudwatch-events.ts index 5557d4851f350..c6f3909c7354d 100644 --- a/packages/awslint/lib/rules/cloudwatch-events.ts +++ b/packages/awslint/lib/rules/cloudwatch-events.ts @@ -22,33 +22,33 @@ const EVENT_RULE_FQN = '@aws-cdk/aws-events.Rule'; eventsLinter.add({ code: 'events-in-interface', - message: `'onXxx()' methods should also be defined on construct interface`, + message: '\'onXxx()\' methods should also be defined on construct interface', eval: e => { for (const method of e.ctx.directEventMethods.concat(e.ctx.cloudTrailEventMethods)) { e.assert(!e.ctx.interfaceType || e.ctx.interfaceType.allMethods.filter(m => !m.protected).some(m => m.name === method.name), `${e.ctx.fqn}.${method.name}`); } - } + }, }); eventsLinter.add({ code: 'events-generic', - message: `if there are specific 'onXxx()' methods, there should also be a generic 'onEvent()' method`, + message: 'if there are specific \'onXxx()\' methods, there should also be a generic \'onEvent()\' method', eval: e => { e.assert(e.ctx.directEventMethods.length === 0 || e.ctx.classType.allMethods.some(m => m.name === 'onEvent'), e.ctx.fqn); - } + }, }); eventsLinter.add({ code: 'events-generic-cloudtrail', - message: `if there are specific 'onCloudTrailXxx()' methods, there should also be a generic 'onCloudTrailEvent()' method`, + message: 'if there are specific \'onCloudTrailXxx()\' methods, there should also be a generic \'onCloudTrailEvent()\' method', eval: e => { e.assert(e.ctx.cloudTrailEventMethods.length === 0 || e.ctx.classType.allMethods.some(m => m.name === 'onCloudTrailEvent'), e.ctx.fqn); - } + }, }); eventsLinter.add({ code: 'events-method-signature', - message: `all 'onXxx()' methods should have the CloudWatch Events signature (id: string, options: events.OnEventOptions = {}) => events.Rule`, + message: 'all \'onXxx()\' methods should have the CloudWatch Events signature (id: string, options: events.OnEventOptions = {}) => events.Rule', eval: e => { for (const method of e.ctx.directEventMethods) { // give slack to protected methods like "onSynthesize", "onPrepare", ... @@ -60,10 +60,10 @@ eventsLinter.add({ { type: 'string' }, { type: ON_EVENT_OPTIONS_FQN, subtypeAllowed: true, optional: true }, ], - returns: EVENT_RULE_FQN + returns: EVENT_RULE_FQN, }); } - } + }, }); function isDirectEventMethod(m: reflect.Method) { diff --git a/packages/awslint/lib/rules/construct.ts b/packages/awslint/lib/rules/construct.ts index 9ec81754cfd0a..ae922413828a4 100644 --- a/packages/awslint/lib/rules/construct.ts +++ b/packages/awslint/lib/rules/construct.ts @@ -95,12 +95,12 @@ constructLinter.add({ expectedParams.push({ name: 'scope', - type: e.ctx.core.constructClass.fqn + type: e.ctx.core.constructClass.fqn, }); expectedParams.push({ name: 'id', - type: 'string' + type: 'string', }); // it's okay for a construct not to have a "props" argument so we only @@ -112,9 +112,9 @@ constructLinter.add({ } e.assertSignature(initializer, { - parameters: expectedParams + parameters: expectedParams, }); - } + }, }); constructLinter.add({ @@ -131,7 +131,7 @@ constructLinter.add({ } e.assert(e.ctx.propsType, e.ctx.interfaceFqn); - } + }, }); constructLinter.add({ @@ -145,7 +145,7 @@ constructLinter.add({ e.ctx.initializer.parameters[2].type.type === e.ctx.propsType, e.ctx.fqn, e.ctx.propsFqn); - } + }, }); constructLinter.add({ @@ -163,7 +163,7 @@ constructLinter.add({ } e.assert(e.ctx.initializer.parameters[2].optional, e.ctx.fqn); - } + }, }); constructLinter.add({ @@ -173,7 +173,7 @@ constructLinter.add({ if (!e.ctx.interfaceType) { return; } const interfaceBase = e.ctx.sys.findInterface(e.ctx.core.constructInterface.fqn); e.assert(e.ctx.interfaceType.extends(interfaceBase), e.ctx.interfaceType.fqn); - } + }, }); constructLinter.add({ @@ -184,7 +184,7 @@ constructLinter.add({ if (!e.ctx.interfaceType) { return; } const baseFqn = `${e.ctx.classType.fqn}Base`; e.assert(!e.ctx.sys.tryFindFqn(baseFqn), baseFqn); - } + }, }); constructLinter.add({ @@ -200,7 +200,7 @@ constructLinter.add({ for (const property of e.ctx.propsType.ownProperties) { e.assert(!property.type.unionOfTypes, `${e.ctx.propsFqn}.${property.name}`); } - } + }, }); constructLinter.add({ @@ -216,7 +216,7 @@ constructLinter.add({ for (const property of e.ctx.propsType.ownProperties) { e.assert(!property.name.toLowerCase().endsWith('arn'), `${e.ctx.propsFqn}.${property.name}`); } - } + }, }); constructLinter.add({ @@ -237,7 +237,7 @@ constructLinter.add({ e.assert(!(fqn === e.ctx.core.tokenInterface.fqn), `${e.ctx.propsFqn}.${property.name}`); } } - } + }, }); constructLinter.add({ @@ -258,7 +258,7 @@ constructLinter.add({ e.assert(!found.name.toLowerCase().startsWith('cfn'), `${e.ctx.propsFqn}.${property.name}`); } } - } + }, }); constructLinter.add({ @@ -272,7 +272,7 @@ constructLinter.add({ if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.ownProperties) { - e.assert(!property.type.isAny, `${e.ctx.propsFqn}.${property.name}`); + e.assert(!property.type.isAny, `${e.ctx.propsFqn}.${property.name}`); } - } + }, }); diff --git a/packages/awslint/lib/rules/core-types.ts b/packages/awslint/lib/rules/core-types.ts index 545d8165574b4..09be91656d446 100644 --- a/packages/awslint/lib/rules/core-types.ts +++ b/packages/awslint/lib/rules/core-types.ts @@ -1,16 +1,15 @@ import * as reflect from 'jsii-reflect'; -import { TypeSystem } from "jsii-reflect"; -import { getDocTag } from "./util"; +import { getDocTag } from './util'; -const CORE_MODULE = "@aws-cdk/core"; +const CORE_MODULE = '@aws-cdk/core'; enum CoreTypesFqn { - CfnResource = "@aws-cdk/core.CfnResource", - Construct = "@aws-cdk/core.Construct", - ConstructInterface = "@aws-cdk/core.IConstruct", - Resource = "@aws-cdk/core.Resource", - ResourceInterface = "@aws-cdk/core.IResource", - ResolvableInterface = "@aws-cdk/core.IResolvable", - PhysicalName = "@aws-cdk/core.PhysicalName" + CfnResource = '@aws-cdk/core.CfnResource', + Construct = '@aws-cdk/core.Construct', + ConstructInterface = '@aws-cdk/core.IConstruct', + Resource = '@aws-cdk/core.Resource', + ResourceInterface = '@aws-cdk/core.IResource', + ResolvableInterface = '@aws-cdk/core.IResolvable', + PhysicalName = '@aws-cdk/core.PhysicalName' } export class CoreTypes { @@ -44,7 +43,7 @@ export class CoreTypes { return false; } - if (!c.name.startsWith("Cfn")) { + if (!c.name.startsWith('Cfn')) { return false; } @@ -75,7 +74,7 @@ export class CoreTypes { */ public static isResourceClass(classType: reflect.ClassType) { const baseResource = classType.system.findClass(CoreTypesFqn.Resource); - return classType.extends(baseResource) || getDocTag(classType, "resource"); + return classType.extends(baseResource) || getDocTag(classType, 'resource'); } /** @@ -124,7 +123,7 @@ export class CoreTypes { return this.sys.findClass(CoreTypesFqn.PhysicalName); } - private readonly sys: TypeSystem; + private readonly sys: reflect.TypeSystem; constructor(sys: reflect.TypeSystem) { this.sys = sys; diff --git a/packages/awslint/lib/rules/docs.ts b/packages/awslint/lib/rules/docs.ts index 4294e2093b633..75eb40d1838cd 100644 --- a/packages/awslint/lib/rules/docs.ts +++ b/packages/awslint/lib/rules/docs.ts @@ -6,10 +6,10 @@ type DocsLinterContext = { readonly assembly: reflect.Assembly; readonly errorKey: string; } & ({ readonly kind: 'type'; documentable: reflect.Type } - | { readonly kind: 'interface-property'; containingType: reflect.InterfaceType; documentable: reflect.Property } - | { readonly kind: 'class-property'; containingType: reflect.ClassType; documentable: reflect.Property } - | { readonly kind: 'method'; containingType: reflect.ReferenceType; documentable: reflect.Method } - | { readonly kind: 'enum-member'; containingType: reflect.EnumType; documentable: reflect.EnumMember } +| { readonly kind: 'interface-property'; containingType: reflect.InterfaceType; documentable: reflect.Property } +| { readonly kind: 'class-property'; containingType: reflect.ClassType; documentable: reflect.Property } +| { readonly kind: 'method'; containingType: reflect.ReferenceType; documentable: reflect.Method } +| { readonly kind: 'enum-member'; containingType: reflect.EnumType; documentable: reflect.EnumMember } ); export const docsLinter = new Linter(assembly => { @@ -21,13 +21,13 @@ export const docsLinter = new Linter(assembly => { ]), ...flatMap(assembly.interfaces, interfaceType => [ { assembly, kind: 'type', documentable: interfaceType, errorKey: interfaceType.fqn }, - // tslint:disable-next-line:max-line-length + // tslint:disable-next-line: max-line-length | This is still being checked by tslint ...interfaceType.ownProperties.map(property => ({ assembly, kind: 'interface-property', containingType: interfaceType, documentable: property, errorKey: `${interfaceType.fqn}.${property.name}` })), ...interfaceType.ownMethods.map(method => ({ assembly, kind: 'method', containingType: interfaceType, documentable: method, errorKey: `${interfaceType.fqn}.${method.name}` })), ]), ...flatMap(assembly.enums, enumType => [ { assembly, kind: 'type', documentable: enumType, errorKey: enumType.fqn }, - ...enumType.members.map(member => ({ assembly, kind: 'enum-member', containingType: enumType, documentable: member, errorKey: `${enumType.fqn}.${member.name}` })) + ...enumType.members.map(member => ({ assembly, kind: 'enum-member', containingType: enumType, documentable: member, errorKey: `${enumType.fqn}.${member.name}` })), ]), ] as DocsLinterContext[]; }); @@ -43,7 +43,7 @@ docsLinter.add({ if (!e.ctx.documentable.docs.summary) { e.assert(e.ctx.documentable.docs.summary, e.ctx.errorKey); } - } + }, }); docsLinter.add({ @@ -57,43 +57,43 @@ docsLinter.add({ const property = e.ctx.documentable; e.assert(!property.optional || property.docs.docs.default !== undefined, e.ctx.errorKey); - } + }, }); docsLinter.add({ code: 'props-no-undefined-default', - message: `'@default undefined' is not helpful. Users will know the VALUE is literally 'undefined' if they don't specify it, but what is the BEHAVIOR if they do so?`, + message: '\'@default undefined\' is not helpful. Users will know the VALUE is literally \'undefined\' if they don\'t specify it, but what is the BEHAVIOR if they do so?', eval: e => { if (e.ctx.kind !== 'interface-property') { return; } if (!e.ctx.containingType.isDataType()) { return; } const property = e.ctx.documentable; e.assert(property.docs.docs.default !== 'undefined', e.ctx.errorKey); - } + }, }); function isPublic(ctx: DocsLinterContext) { switch (ctx.kind) { - case "class-property": - case "interface-property": - case "method": + case 'class-property': + case 'interface-property': + case 'method': return !ctx.documentable.protected; - case "enum-member": - case "type": + case 'enum-member': + case 'type': return true; } } function isCfnType(ctx: DocsLinterContext) { switch (ctx.kind) { - case "class-property": - case "interface-property": - case "method": - case "enum-member": + case 'class-property': + case 'interface-property': + case 'method': + case 'enum-member': return CoreTypes.isCfnType(ctx.containingType); - case "type": + case 'type': return CoreTypes.isCfnType(ctx.documentable); } } diff --git a/packages/awslint/lib/rules/exports.ts b/packages/awslint/lib/rules/exports.ts index 7d6bd5f350c73..6c5ef21bcf831 100644 --- a/packages/awslint/lib/rules/exports.ts +++ b/packages/awslint/lib/rules/exports.ts @@ -9,5 +9,5 @@ exportsLinter.add({ if (e.ctx.isClassType() || e.ctx.isInterfaceType()) { e.assert(!e.ctx.allMethods.some(m => m.name === 'export'), e.ctx.fqn); } - } + }, }); \ No newline at end of file diff --git a/packages/awslint/lib/rules/imports.ts b/packages/awslint/lib/rules/imports.ts index 1c60d2cc0db07..d69c5f2745d98 100644 --- a/packages/awslint/lib/rules/imports.ts +++ b/packages/awslint/lib/rules/imports.ts @@ -23,7 +23,7 @@ class ImportsReflection { this.fromAttributesMethod = classType.allMethods.find(x => x.name === this.fromAttributesMethodName); this.fromMethods = classType.allMethods.filter(x => - x.static + x.static && x.name.match(`^${this.prefix}[A-Z]`) && x.name !== this.fromAttributesMethodName); @@ -45,7 +45,7 @@ importsLinter.add({ eval: e => { const hasImport = e.ctx.resource.construct.classType.allMethods.find(x => x.static && x.name === 'import'); e.assert(!hasImport, e.ctx.resource.fqn + '.import'); - } + }, }); importsLinter.add({ @@ -58,7 +58,7 @@ importsLinter.add({ } e.assert(e.ctx.fromMethods.length > 0 || e.ctx.fromAttributesMethod, e.ctx.resource.fqn); - } + }, }); importsLinter.add({ @@ -74,12 +74,12 @@ importsLinter.add({ parameters: [ { name: 'scope', type: e.ctx.resource.construct.ROOT_CLASS }, { name: 'id', type: 'string' }, - { name: argName, type: 'string' } + { name: argName, type: 'string' }, ], - returns: e.ctx.resource.construct.interfaceType + returns: e.ctx.resource.construct.interfaceType, }); } - } + }, }); importsLinter.add({ @@ -94,10 +94,10 @@ importsLinter.add({ parameters: [ { name: 'scope', type: e.ctx.resource.construct.ROOT_CLASS }, { name: 'id', type: 'string' }, - { name: 'attrs', type: e.ctx.attributesStruct } - ] + { name: 'attrs', type: e.ctx.attributesStruct }, + ], }); - } + }, }); importsLinter.add({ @@ -109,5 +109,5 @@ importsLinter.add({ } e.assert(e.ctx.attributesStruct, e.ctx.attributesStructName); - } + }, }); diff --git a/packages/awslint/lib/rules/index.ts b/packages/awslint/lib/rules/index.ts index e3fe69364f09b..8777d5056ab8f 100644 --- a/packages/awslint/lib/rules/index.ts +++ b/packages/awslint/lib/rules/index.ts @@ -28,5 +28,5 @@ export const ALL_RULES_LINTER = new AggregateLinter( noUnusedTypeLinter, durationsLinter, publicStaticPropertiesLinter, - docsLinter + docsLinter, ); \ No newline at end of file diff --git a/packages/awslint/lib/rules/integrations.ts b/packages/awslint/lib/rules/integrations.ts index 708718b319b11..32e0b16d5d207 100644 --- a/packages/awslint/lib/rules/integrations.ts +++ b/packages/awslint/lib/rules/integrations.ts @@ -23,10 +23,10 @@ class IntegrationReflection { integrationLinter.add({ code: 'integ-return-type', - message: `'bind(...)' should return a type named 'XxxConfig'`, + message: '\'bind(...)\' should return a type named \'XxxConfig\'', eval: e => { const returnsFqn = e.ctx.bindMethod.returns.type.fqn; e.assert(returnsFqn && returnsFqn.endsWith('Config'), memberFqn(e.ctx.bindMethod)); - } + }, }); diff --git a/packages/awslint/lib/rules/module.ts b/packages/awslint/lib/rules/module.ts index f87ef3af8231c..4ce7e527b1fbe 100644 --- a/packages/awslint/lib/rules/module.ts +++ b/packages/awslint/lib/rules/module.ts @@ -15,7 +15,7 @@ export const moduleLinter = new Linter(assembly => { return [ { assembly, - namespace: cfnResources[0].namespace + namespace: cfnResources[0].namespace, } ]; }); @@ -27,7 +27,7 @@ moduleLinter.add( { if (!e.ctx.assembly) { return; } const namespace = overrideNamespace(e.ctx.namespace.toLocaleLowerCase().replace('::', '-')); e.assertEquals(e.ctx.assembly.name, `@aws-cdk/${namespace}`, e.ctx.assembly.name); - } + }, }); /** diff --git a/packages/awslint/lib/rules/no-unused-type.ts b/packages/awslint/lib/rules/no-unused-type.ts index 7cf59b8b03c7b..33978c6eea41d 100644 --- a/packages/awslint/lib/rules/no-unused-type.ts +++ b/packages/awslint/lib/rules/no-unused-type.ts @@ -20,7 +20,7 @@ noUnusedTypeLinter.add({ evaluation.assert(evaluation.ctx.usedTypes.has(evaluation.ctx.inspectedType.fqn), evaluation.ctx.inspectedType.fqn, _formatLocation(evaluation.ctx.inspectedType.locationInModule)); - } + }, }); function _collectUsedTypes(assm: Assembly): Set { diff --git a/packages/awslint/lib/rules/public-static-properties.ts b/packages/awslint/lib/rules/public-static-properties.ts index 4667a92973b7c..90385f01114dd 100644 --- a/packages/awslint/lib/rules/public-static-properties.ts +++ b/packages/awslint/lib/rules/public-static-properties.ts @@ -7,9 +7,9 @@ export const publicStaticPropertiesLinter = new Linter(assembly => { const result = new Array(); for (const c of assembly.classes) { for (const property of c.allProperties) { - if (property.const && property.static) { - result.push(property); - } + if (property.const && property.static) { + result.push(property); + } } } return result; @@ -21,5 +21,5 @@ publicStaticPropertiesLinter.add({ eval: e => { const name = e.ctx.name; e.assert(UPPER_SNAKE_CASE_ALLOWED_PATTERN.test(name), `${e.ctx.parentType.fqn}.${name}`); - } + }, }); \ No newline at end of file diff --git a/packages/awslint/lib/rules/resource.ts b/packages/awslint/lib/rules/resource.ts index 8be7a9a59767b..2873972d13df3 100644 --- a/packages/awslint/lib/rules/resource.ts +++ b/packages/awslint/lib/rules/resource.ts @@ -55,7 +55,7 @@ export class ResourceReflection { if (!cfn) { throw new Error(`Cannot find L1 class for L2 ${construct.fqn}. ` + `Is "${guessResourceName(construct.fqn)}" an actual CloudFormation resource. ` + - `If not, use the "@resource" doc tag to indicate the full resource name (e.g. "@resource AWS::Route53::HostedZone")`); + 'If not, use the "@resource" doc tag to indicate the full resource name (e.g. "@resource AWS::Route53::HostedZone")'); } this.core = new CoreTypes(this.sys); @@ -131,7 +131,7 @@ export class ResourceReflection { result.push({ site, cfnAttributeNames, - property + property, }); } @@ -156,11 +156,11 @@ function findDeclarationSite(prop: reflect.Property): reflect.Property { resourceLinter.add({ code: 'resource-class-extends-resource', - message: `resource classes must extend "cdk.Resource" directly or indirectly`, + message: 'resource classes must extend "cdk.Resource" directly or indirectly', eval: e => { const resourceBase = e.ctx.sys.findClass(e.ctx.core.resourceClass.fqn); e.assert(e.ctx.construct.classType.extends(resourceBase), e.ctx.construct.fqn); - } + }, }); resourceLinter.add({ @@ -169,7 +169,7 @@ resourceLinter.add({ message: 'every resource must have a resource interface', eval: e => { e.assert(e.ctx.construct.interfaceType, e.ctx.construct.fqn); - } + }, }); resourceLinter.add({ @@ -182,7 +182,7 @@ resourceLinter.add({ const resourceInterfaceFqn = e.ctx.core.resourceInterface.fqn; const interfaceBase = e.ctx.sys.findInterface(resourceInterfaceFqn); e.assert(resourceInterface.extends(interfaceBase), resourceInterface.fqn); - } + }, }); resourceLinter.add({ @@ -200,7 +200,7 @@ resourceLinter.add({ const found = e.ctx.attributes.find(a => a.cfnAttributeNames.includes(name)); e.assert(found, `${e.ctx.fqn}.${expected}`, expected); } - } + }, }); resourceLinter.add({ @@ -218,20 +218,20 @@ resourceLinter.add({ for (const grantMethod of grantMethods) { e.assertSignature(grantMethod, { - returns: grantResultType + returns: grantResultType, }); } - } + }, }); resourceLinter.add({ code: 'props-physical-name', - message: "Every Resource must have a single physical name construction property, " + - "with a name that is an ending substring of Name", + message: 'Every Resource must have a single physical name construction property, ' + + 'with a name that is an ending substring of Name', eval: e => { if (!e.ctx.construct.propsType) { return; } e.assert(e.ctx.physicalNameProp, e.ctx.construct.propsFqn); - } + }, }); resourceLinter.add({ @@ -241,7 +241,7 @@ resourceLinter.add({ if (!e.ctx.physicalNameProp) { return; } const prop = e.ctx.physicalNameProp; e.assertTypesEqual(e.ctx.sys, prop.type, 'string', `${e.ctx.construct.propsFqn}.${prop.name}`); - } + }, }); function tryResolveCfnResource(resourceClass: reflect.ClassType): CfnResourceReflection | undefined { diff --git a/packages/awslint/lib/rules/util.ts b/packages/awslint/lib/rules/util.ts index 1b51673bfaf00..658b286100d8b 100644 --- a/packages/awslint/lib/rules/util.ts +++ b/packages/awslint/lib/rules/util.ts @@ -25,7 +25,7 @@ export function getDocTag(documentable: reflect.Documentable, tag: string): stri for (const base of documentable.interfaces) { const baseTag = getDocTag(base, tag); if (baseTag) { - return baseTag; + return baseTag; } } } diff --git a/packages/awslint/package.json b/packages/awslint/package.json index 3dd2926d192ad..dbdd40fafe30a 100644 --- a/packages/awslint/package.json +++ b/packages/awslint/package.json @@ -9,7 +9,8 @@ "watch": "tsc -b -w", "package": "mkdir -p dist/js && mv $( npm pack ) dist/js/", "build+test+package": "npm run build+test && npm run package", - "build+test": "npm run build && npm test" + "build+test": "npm run build && npm test", + "pkglint": "pkglint -f" }, "bin": { "awslint": "bin/awslint" @@ -26,11 +27,13 @@ "@types/fs-extra": "^8.1.0", "@types/yargs": "^15.0.5", "tslint": "^5.20.1", + "pkglint": "0.0.0", "typescript": "~3.9.6" }, "repository": { "type": "git", - "url": "https://github.com/aws/aws-cdk.git" + "url": "https://github.com/aws/aws-cdk.git", + "directory": "packages/awslint" }, "homepage": "https://github.com/aws/aws-cdk", "license": "Apache-2.0", @@ -43,6 +46,8 @@ "aws", "cdk" ], + "maturity": "developer-preview", + "stability": "experimental", "engines": { "node": ">= 10.13.0 <13 || >=13.7.0" } diff --git a/packages/cdk-assets/bin/cdk-assets.ts b/packages/cdk-assets/bin/cdk-assets.ts index 902c4d65ecc41..79b9a5a066b26 100644 --- a/packages/cdk-assets/bin/cdk-assets.ts +++ b/packages/cdk-assets/bin/cdk-assets.ts @@ -61,7 +61,7 @@ function wrapHandler(handler: (x: A) => Promi } main().catch(e => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(e.stack); process.exitCode = 1; }); diff --git a/packages/cdk-assets/bin/list.ts b/packages/cdk-assets/bin/list.ts index 86acb36c3973f..e93358cd729fd 100644 --- a/packages/cdk-assets/bin/list.ts +++ b/packages/cdk-assets/bin/list.ts @@ -4,6 +4,6 @@ export async function list(args: { path: string; }) { const manifest = AssetManifest.fromPath(args.path); - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.log(manifest.list().join('\n')); } \ No newline at end of file diff --git a/packages/cdk-assets/bin/logging.ts b/packages/cdk-assets/bin/logging.ts index 8a8eea4540680..ead34deeaa70c 100644 --- a/packages/cdk-assets/bin/logging.ts +++ b/packages/cdk-assets/bin/logging.ts @@ -18,7 +18,7 @@ export function setLogThreshold(threshold: LogLevel) { export function log(level: LogLevel, message: string) { if (LOG_LEVELS[level] >= LOG_LEVELS[logThreshold]) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(`${level.padEnd(7, ' ')}: ${message}`); } } \ No newline at end of file diff --git a/packages/cdk-assets/bin/publish.ts b/packages/cdk-assets/bin/publish.ts index 9f64dc7e08ed8..001d435e383b1 100644 --- a/packages/cdk-assets/bin/publish.ts +++ b/packages/cdk-assets/bin/publish.ts @@ -1,5 +1,6 @@ import * as os from 'os'; -import { AssetManifest, AssetPublishing, ClientOptions, DestinationPattern, EventType, IAws, IPublishProgress, IPublishProgressListener } from '../lib'; +import { AssetManifest, AssetPublishing, ClientOptions, DestinationPattern, EventType, IAws, + IPublishProgress, IPublishProgressListener } from '../lib'; import { Account } from '../lib/aws'; import { log, LogLevel, VERSION } from './logging'; @@ -28,7 +29,7 @@ export async function publish(args: { if (pub.hasFailures) { for (const failure of pub.failures) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error('Failure:', failure.error.stack); } diff --git a/packages/cdk-assets/lib/asset-manifest.ts b/packages/cdk-assets/lib/asset-manifest.ts index d08c6f5daee61..ce683485e3511 100644 --- a/packages/cdk-assets/lib/asset-manifest.ts +++ b/packages/cdk-assets/lib/asset-manifest.ts @@ -1,7 +1,7 @@ -import { AssetManifest as AssetManifestSchema, DockerImageDestination, DockerImageSource, - FileDestination, FileSource, Manifest } from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; import * as path from 'path'; +import { AssetManifest as AssetManifestSchema, DockerImageDestination, DockerImageSource, + FileDestination, FileSource, Manifest } from '@aws-cdk/cloud-assembly-schema'; /** * A manifest of assets diff --git a/packages/cdk-assets/lib/private/archive.ts b/packages/cdk-assets/lib/private/archive.ts index 802a9abac90fb..ce085ec901284 100644 --- a/packages/cdk-assets/lib/private/archive.ts +++ b/packages/cdk-assets/lib/private/archive.ts @@ -1,7 +1,7 @@ -import * as archiver from 'archiver'; import { createWriteStream, promises as fs } from 'fs'; -import * as glob from 'glob'; import * as path from 'path'; +import * as archiver from 'archiver'; +import * as glob from 'glob'; export function zipDirectory(directory: string, outputFile: string): Promise { return new Promise(async (ok, fail) => { @@ -40,7 +40,7 @@ export function zipDirectory(directory: string, outputFile: string): Promise // check that mode is preserved const stat = await fs.stat(path.join(extractDir, 'executable.txt')); - // tslint:disable-next-line:no-bitwise + // eslint-disable-next-line no-bitwise const isExec = (stat.mode & constants.S_IXUSR) || (stat.mode & constants.S_IXGRP) || (stat.mode & constants.S_IXOTH); expect(isExec).toBeTruthy(); } finally { diff --git a/packages/decdk/bin/decdk-schema.ts b/packages/decdk/bin/decdk-schema.ts index 36d1340f1d2e3..4a1e66dcd3bf2 100644 --- a/packages/decdk/bin/decdk-schema.ts +++ b/packages/decdk/bin/decdk-schema.ts @@ -1,7 +1,7 @@ import { loadTypeSystem } from '../lib'; import { renderFullSchema } from '../lib/cdk-schema'; -// tslint:disable:no-console +/* eslint-disable no-console */ async function main() { const typeSystem = await loadTypeSystem(); diff --git a/packages/decdk/bin/decdk.ts b/packages/decdk/bin/decdk.ts index 676ca0ded46ff..84633a46d23e4 100644 --- a/packages/decdk/bin/decdk.ts +++ b/packages/decdk/bin/decdk.ts @@ -20,7 +20,7 @@ async function main() { } main().catch(e => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(colors.red(e)); process.exit(1); }); diff --git a/packages/decdk/lib/cdk-schema.ts b/packages/decdk/lib/cdk-schema.ts index 329fcbead9e33..c653d174d66d6 100644 --- a/packages/decdk/lib/cdk-schema.ts +++ b/packages/decdk/lib/cdk-schema.ts @@ -2,7 +2,7 @@ import * as colors from 'colors/safe'; import * as jsiiReflect from 'jsii-reflect'; import { SchemaContext, schemaForTypeReference } from '../lib/jsii2schema'; -// tslint:disable:no-console +/* eslint-disable no-console */ export interface RenderSchemaOptions { warnings?: boolean; diff --git a/packages/decdk/lib/jsii2schema.ts b/packages/decdk/lib/jsii2schema.ts index a20cb30ade966..59d33ce675f7c 100644 --- a/packages/decdk/lib/jsii2schema.ts +++ b/packages/decdk/lib/jsii2schema.ts @@ -1,7 +1,7 @@ import * as jsiiReflect from 'jsii-reflect'; import * as util from 'util'; -// tslint:disable:no-console +/* eslint-disable no-console */ export class SchemaContext { public static root(definitions?: { [fqn: string]: any }): SchemaContext { diff --git a/packages/decdk/test/schema.test.ts b/packages/decdk/test/schema.test.ts index 137cc1bb4c061..7b097dcc9fcbe 100644 --- a/packages/decdk/test/schema.test.ts +++ b/packages/decdk/test/schema.test.ts @@ -5,7 +5,7 @@ import { SchemaContext, schemaForInterface } from '../lib/jsii2schema'; const fixturedir = path.join(__dirname, 'fixture'); -// tslint:disable:no-console +/* eslint-disable no-console */ // building the decdk schema often does not complete in the default 5 second Jest timeout jest.setTimeout(60_000); diff --git a/tools/cdk-build-tools/bin/cdk-lint.ts b/tools/cdk-build-tools/bin/cdk-lint.ts index 185645175c4d9..54c1bb8100b58 100644 --- a/tools/cdk-build-tools/bin/cdk-lint.ts +++ b/tools/cdk-build-tools/bin/cdk-lint.ts @@ -15,11 +15,16 @@ async function main() { desc: 'Specify a different eslint executable', defaultDescription: 'eslint provided by node dependencies', }) + .option('fix', { + type: 'boolean', + desc: 'Fix the found issues', + default: false, + }) .argv; const options = cdkBuildOptions(); - await lintCurrentPackage(options, { eslint: args.eslint, tslint: args.tslint }); + await lintCurrentPackage(options, { eslint: args.eslint, tslint: args.tslint, fix: args.fix }); } main().catch(e => { diff --git a/tools/cdk-build-tools/config/eslintrc.js b/tools/cdk-build-tools/config/eslintrc.js index 18cb020345437..78a71bb780800 100644 --- a/tools/cdk-build-tools/config/eslintrc.js +++ b/tools/cdk-build-tools/config/eslintrc.js @@ -1,3 +1,12 @@ +/** + * JavaScript and generic rules: + * + * https://eslint.org/docs/rules/ + * + * TypeScript-specific rules (including migrations from TSlint), see here: + * + * https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md + */ module.exports = { env: { jest: true, @@ -51,6 +60,106 @@ module.exports = { ], // Require all imported libraries actually resolve (!!required for import/no-extraneous-dependencies to work!!) - 'import/no-unresolved': [ 'error' ] - } + 'import/no-unresolved': [ 'error' ], + + // Require an ordering on all imports -- unfortunately a different ordering than TSLint used to + // enforce, but there are no compatible ESLint rules as far as I can tell :( + // + // WARNING for now, otherwise this will mess up all open PRs. Make it into an error after a transitionary period. + 'import/order': ['warn', { + groups: ['builtin', 'external'], + alphabetize: { order: 'asc', caseInsensitive: true }, + }], + + // Cannot import from the same module twice + 'no-duplicate-imports': ['error'], + + // Cannot shadow names + 'no-shadow': ['error'], + + // Required spacing in property declarations (copied from TSLint, defaults are good) + 'key-spacing': ['error'], + + // Require semicolons + 'semi': ['error', 'always'], + + // Don't unnecessarily quote properties + 'quote-props': ['error', 'consistent-as-needed'], + + // No multiple empty lines + 'no-multiple-empty-lines': ['error'], + + // Max line lengths + 'max-len': ['error', { + code: 150, + ignoreUrls: true, // Most common reason to disable it + ignoreStrings: true, // These are not fantastic but necessary for error messages + ignoreTemplateLiterals: true, + ignoreComments: true, + ignoreRegExpLiterals: true, + }], + + // One of the easiest mistakes to make + '@typescript-eslint/no-floating-promises': ['error'], + + // Don't leave log statements littering the premises! + 'no-console': ['error'], + + // Useless diff results + 'no-trailing-spaces': ['error'], + + // Must use foo.bar instead of foo['bar'] if possible + 'dot-notation': ['error'], + + // Must use 'import' statements (disabled because it doesn't add a lot over no-require-imports) + // '@typescript-eslint/no-var-requires': ['error'], + + // Are you sure | is not a typo for || ? + 'no-bitwise': ['error'], + + // Oh ho ho naming. Everyone's favorite topic! + // FIXME: there's no way to do this properly. The proposed tslint replacement + // works very differently, also checking names in object literals, which we use all over the + // place for configs, mockfs, nodeunit tests, etc. + // + // The maintainer does not want to change behavior. + // https://github.com/typescript-eslint/typescript-eslint/issues/1483 + // + // There is no good replacement for tslint's name checking, currently. We will have to make do + // with jsii's validation. + /* + '@typescript-eslint/naming-convention': ['error', + + // We could maybe be more specific in a number of these but I didn't want to + // spend too much effort. Knock yourself out if you feel like it. + { selector: 'enumMember', format: ['PascalCase', 'UPPER_CASE'] }, + { selector: 'variableLike', format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow' }, + { selector: 'typeLike', format: ['PascalCase'], leadingUnderscore: 'allow' }, + { selector: 'memberLike', format: ['camelCase', 'PascalCase', 'UPPER_CASE'], leadingUnderscore: 'allow' }, + + // FIXME: there's no way to disable name checking in object literals. Maintainer won't have it + // https://github.com/typescript-eslint/typescript-eslint/issues/1483 + ], + */ + + // Member ordering + '@typescript-eslint/member-ordering': ['error', { + default: [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + + "field", + + // Constructors + "constructor", // = ["public-constructor", "protected-constructor", "private-constructor"] + + // Methods + "method", + ] + }], + }, } diff --git a/tools/cdk-build-tools/lib/lint.ts b/tools/cdk-build-tools/lib/lint.ts index b2d3e65de2bdb..e9afd90dd5304 100644 --- a/tools/cdk-build-tools/lib/lint.ts +++ b/tools/cdk-build-tools/lib/lint.ts @@ -2,20 +2,17 @@ import * as path from 'path'; import { shell } from './os'; import { CDKBuildOptions, CompilerOverrides } from './package-info'; -export async function lintCurrentPackage(options: CDKBuildOptions, compilers: CompilerOverrides = {}): Promise { +export async function lintCurrentPackage(options: CDKBuildOptions, compilers: CompilerOverrides & { fix?: boolean } = {}): Promise { if (!options.eslint?.disable) { await shell([ compilers.eslint || require.resolve('eslint/bin/eslint'), '.', '--ext=.ts', `--resolve-plugins-relative-to=${__dirname}`, + ...compilers.fix ? ['--fix'] : [], ]); } - if (!options.tslint?.disable) { - await shell([compilers.tslint || require.resolve('tslint/bin/tslint'), '--project', '.']); - } - if (!options.pkglint?.disable) { await shell(['pkglint']); } diff --git a/tools/cdk-build-tools/package.json b/tools/cdk-build-tools/package.json index 9c01a97d833e7..0e1f1dbac2f10 100644 --- a/tools/cdk-build-tools/package.json +++ b/tools/cdk-build-tools/package.json @@ -19,7 +19,7 @@ "cdk-lint": "bin/cdk-lint" }, "scripts": { - "build": "tsc -b && tslint -p . && chmod +x bin/cdk-build && chmod +x bin/cdk-test && chmod +x bin/cdk-watch && chmod +x bin/cdk-awslint && chmod +x bin/cdk-lint && pkglint && eslint . --ext=.ts", + "build": "tsc -b && chmod +x bin/cdk-build && chmod +x bin/cdk-test && chmod +x bin/cdk-watch && chmod +x bin/cdk-awslint && chmod +x bin/cdk-lint && pkglint && eslint . --ext=.ts", "watch": "tsc -b -w", "pkglint": "pkglint -f", "test": "echo success", diff --git a/tools/cdk-integ-tools/bin/cdk-integ-assert.ts b/tools/cdk-integ-tools/bin/cdk-integ-assert.ts index a58d942983ed8..758a8288fb0d6 100644 --- a/tools/cdk-integ-tools/bin/cdk-integ-assert.ts +++ b/tools/cdk-integ-tools/bin/cdk-integ-assert.ts @@ -4,7 +4,7 @@ import { canonicalizeTemplate } from '@aws-cdk/assert'; import { diffTemplate, formatDifferences } from '@aws-cdk/cloudformation-diff'; import { DEFAULT_SYNTH_OPTIONS, IntegrationTests } from '../lib/integ-helpers'; -// tslint:disable:no-console +/* eslint-disable no-console */ const IGNORE_ASSETS_PRAGMA = 'pragma:ignore-assets'; @@ -39,7 +39,7 @@ async function main() { } if (failures.length > 0) { - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len throw new Error(`Some stacks have changed. To verify that they still deploy successfully, run: 'npm run integ ${failures.join(' ')}'`); } } diff --git a/tools/cdk-integ-tools/bin/cdk-integ.ts b/tools/cdk-integ-tools/bin/cdk-integ.ts index 5003d1fc79eea..522aaf750ff67 100644 --- a/tools/cdk-integ-tools/bin/cdk-integ.ts +++ b/tools/cdk-integ-tools/bin/cdk-integ.ts @@ -3,7 +3,7 @@ import * as yargs from 'yargs'; import { DEFAULT_SYNTH_OPTIONS, IntegrationTests } from '../lib/integ-helpers'; -// tslint:disable:no-console +/* eslint-disable no-console */ async function main() { const argv = yargs diff --git a/tools/cdk-integ-tools/lib/integ-helpers.ts b/tools/cdk-integ-tools/lib/integ-helpers.ts index caf1c61dc72d7..ec20b2bbb9995 100644 --- a/tools/cdk-integ-tools/lib/integ-helpers.ts +++ b/tools/cdk-integ-tools/lib/integ-helpers.ts @@ -1,7 +1,7 @@ // Helper functions for integration tests import { spawnSync } from 'child_process'; -import * as fs from 'fs-extra'; import * as path from 'path'; +import * as fs from 'fs-extra'; import { AVAILABILITY_ZONE_FALLBACK_CONTEXT_KEY } from '../../../packages/@aws-cdk/cx-api/lib'; const CDK_OUTDIR = 'cdk-integ.out'; @@ -309,7 +309,7 @@ export const DEFAULT_SYNTH_OPTIONS = { 'ssm:account=12345678:parameterName=/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2:region=test-region': 'ami-1234', 'ssm:account=12345678:parameterName=/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2:region=test-region': 'ami-1234', 'ssm:account=12345678:parameterName=/aws/service/ecs/optimized-ami/amazon-linux/recommended:region=test-region': '{"image_id": "ami-1234"}', - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len 'ami:account=12345678:filters.image-type.0=machine:filters.name.0=amzn-ami-vpc-nat-*:filters.state.0=available:owners.0=amazon:region=test-region': 'ami-1234', 'vpc-provider:account=12345678:filter.isDefault=true:region=test-region:returnAsymmetricSubnets=true': { vpcId: 'vpc-60900905', @@ -376,7 +376,7 @@ function exec(commandLine: string[], options: { cwd?: string, json?: boolean, ve } return output; } catch (e) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error('Not JSON: ' + output); throw new Error('Command output is not JSON'); } diff --git a/tools/cfn2ts/bin/cfn2ts.ts b/tools/cfn2ts/bin/cfn2ts.ts index bc172c8952cbb..dd3daf6aee6f6 100755 --- a/tools/cfn2ts/bin/cfn2ts.ts +++ b/tools/cfn2ts/bin/cfn2ts.ts @@ -3,8 +3,8 @@ import * as fs from 'fs-extra'; import * as yargs from 'yargs'; import generate from '../lib'; -// tslint:disable:no-console -// tslint:disable:max-line-length +/* eslint-disable no-console */ +/* eslint-disable max-len */ async function main() { const argv = yargs.usage('Usage: cfn2ts') diff --git a/tools/cfn2ts/lib/augmentation-generator.ts b/tools/cfn2ts/lib/augmentation-generator.ts index 48b3b74c02861..0ac3540a103d8 100644 --- a/tools/cfn2ts/lib/augmentation-generator.ts +++ b/tools/cfn2ts/lib/augmentation-generator.ts @@ -13,7 +13,7 @@ export class AugmentationGenerator { this.code.line(`// Copyright 2012-${new Date().getFullYear()} Amazon.com, Inc. or its affiliates. All Rights Reserved.`); this.code.line(); - this.code.line('// tslint:disable:max-line-length | This is generated code - line lengths are difficult to control'); + this.code.line('/* eslint-disable max-len */ // This is generated code - line lengths are difficult to control'); } public emitCode(): boolean { diff --git a/tools/cfn2ts/lib/codegen.ts b/tools/cfn2ts/lib/codegen.ts index ff87f6a178222..a00fee69cbb8e 100644 --- a/tools/cfn2ts/lib/codegen.ts +++ b/tools/cfn2ts/lib/codegen.ts @@ -55,7 +55,7 @@ export default class CodeGenerator { this.code.line('// See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html'); this.code.line(`// @cfn2ts:meta@ ${JSON.stringify(meta)}`); this.code.line(); - this.code.line('// tslint:disable:max-line-length | This is generated code - line lengths are difficult to control'); + this.code.line('/* eslint-disable max-len */ // This is generated code - line lengths are difficult to control'); this.code.line(); this.code.line(`import * as ${CORE} from '${coreImport}';`); // explicitly import the cfn-parse.ts file from @core, which is not part of the public API of the module @@ -232,6 +232,7 @@ export default class CodeGenerator { this.code.line(' *'); this.code.line(' * @experimental'); this.code.line(' */'); + // eslint-disable-next-line max-len this.code.openBlock(`public static fromCloudFormation(scope: ${CONSTRUCT_CLASS}, id: string, resourceAttributes: any, options: ${CORE}.FromCloudFormationOptions): ` + `${resourceName.className}`); this.code.line('resourceAttributes = resourceAttributes || {};'); @@ -262,6 +263,7 @@ export default class CodeGenerator { this.code.line('// handle DependsOn'); // DependsOn can be either a single string, or an array of strings this.code.line('resourceAttributes.DependsOn = resourceAttributes.DependsOn ?? [];'); + // eslint-disable-next-line max-len this.code.line('const dependencies: string[] = Array.isArray(resourceAttributes.DependsOn) ? resourceAttributes.DependsOn : [resourceAttributes.DependsOn];'); this.code.openBlock('for (const dep of dependencies)'); this.code.line('const depResource = options.finder.findResource(dep);'); @@ -519,7 +521,7 @@ export default class CodeGenerator { const scalarValidator = `${CORE}.unionValidator(${validatorNames})`; const listValidator = `${CORE}.listValidator(${CORE}.unionValidator(${itemValidatorNames}))`; const scalarMapper = `${CORE}.unionMapper([${validatorNames}], [${types.map(type => this.visitAtom(type)).join(', ')}])`; - // tslint:disable-next-line:max-line-length + // eslint-disable-next-line max-len const listMapper = `${CORE}.listMapper(${CORE}.unionMapper([${itemValidatorNames}], [${itemTypes.map(type => this.visitAtom(type)).join(', ')}]))`; return `${CORE}.unionMapper([${scalarValidator}, ${listValidator}], [${scalarMapper}, ${listMapper}])`; @@ -789,9 +791,11 @@ export default class CodeGenerator { this.beginNamespace(typeName); this.docLink(propTypeSpec.Documentation, '@stability external'); + /* if (!propTypeSpec.Properties || Object.keys(propTypeSpec.Properties).length === 0) { - this.code.line('// tslint:disable-next-line:no-empty-interface | A genuine empty-object type'); + this.code.line('// eslint-disable-next-line somethingsomething | A genuine empty-object type'); } + */ this.code.openBlock(`export interface ${typeName.className}`); const conversionTable: Dictionary = {}; if (propTypeSpec.Properties) { diff --git a/tools/cfn2ts/lib/genspec.ts b/tools/cfn2ts/lib/genspec.ts index 63df05ef82115..696f1ebbff505 100644 --- a/tools/cfn2ts/lib/genspec.ts +++ b/tools/cfn2ts/lib/genspec.ts @@ -43,7 +43,7 @@ export class CodeName { return new CodeName('', '', primitiveName); } - // tslint:disable:no-shadowed-variable + /* eslint-disable no-shadow */ constructor( readonly packageName: string, readonly namespace: string, @@ -206,7 +206,7 @@ export function attributeDefinition(attributeName: string, spec: schema.Attribut } else if ('Type' in spec && 'PrimitiveItemType' in spec && spec.Type === 'List' && spec.PrimitiveItemType === 'String') { attrType = 'string[]'; } else { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(`WARNING: Unable to represent attribute type ${JSON.stringify(spec)} as a native type`); attrType = TOKEN_NAME.fqn; } @@ -228,6 +228,7 @@ export function cloudFormationToScriptName(name: string): string { if (name === 'VPCs') { return 'vpcs'; } const ret = codemaker.toCamelCase(name); + // eslint-disable-next-line @typescript-eslint/naming-convention const suffixes: { [key: string]: string } = { ARNs: 'Arns', MBs: 'MBs', AZs: 'AZs' }; for (const suffix of Object.keys(suffixes)) { diff --git a/tools/pkglint/bin/pkglint.ts b/tools/pkglint/bin/pkglint.ts index d6b9df4fe6441..06612ed4a7424 100644 --- a/tools/pkglint/bin/pkglint.ts +++ b/tools/pkglint/bin/pkglint.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import * as yargs from 'yargs'; import { findPackageJsons, ValidationRule } from '../lib'; -// tslint:disable:no-shadowed-variable +/* eslint-disable no-shadow */ const argv = yargs .usage('$0 [directory]') .option('fix', { type: 'boolean', alias: 'f', desc: 'Fix package.json in addition to reporting mistakes'}) @@ -35,7 +35,7 @@ async function main(): Promise { } main().catch((e) => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(e); process.exit(1); }); diff --git a/tools/pkglint/lib/rules.ts b/tools/pkglint/lib/rules.ts index 8ddba895ef102..10cd33d5d55b3 100644 --- a/tools/pkglint/lib/rules.ts +++ b/tools/pkglint/lib/rules.ts @@ -14,7 +14,6 @@ import { monoRepoRoot, } from './util'; -// tslint:disable-next-line: no-var-requires const AWS_SERVICE_NAMES = require('./aws-service-official-names.json'); /** @@ -520,6 +519,7 @@ export class CDKPackage extends ValidationRule { const merkleMarker = '.LAST_PACKAGE'; + if (!shouldUseCDKBuildTools(pkg)) { return; } expectJSON(this.name, pkg, 'scripts.package', 'cdk-package'); const outdir = 'dist'; @@ -1406,7 +1406,7 @@ function hasIntegTests(pkg: PackageJson) { function shouldUseCDKBuildTools(pkg: PackageJson) { // The packages that DON'T use CDKBuildTools are the package itself // and the packages used by it. - return pkg.packageName !== 'cdk-build-tools' && pkg.packageName !== 'merkle-build'; + return pkg.packageName !== 'cdk-build-tools' && pkg.packageName !== 'merkle-build' && pkg.packageName !== 'awslint'; } function repoRoot(dir: string) { diff --git a/tools/pkgtools/bin/find-jsii-packages.ts b/tools/pkgtools/bin/find-jsii-packages.ts index ed1249a3e3f0d..c240e59fec10f 100644 --- a/tools/pkgtools/bin/find-jsii-packages.ts +++ b/tools/pkgtools/bin/find-jsii-packages.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as yargs from 'yargs'; -// tslint:disable:no-shadowed-variable +/* eslint-disable no-shadow */ const argv = yargs .usage('$0') .option('verbose', { alias: 'v', type: 'boolean', desc: 'Turn on verbose logging' }) @@ -107,13 +107,13 @@ function enumeratePackages(root: string, pred: PackagePredicate): JSIIPackage[] * a build tool and not shipped, I'm fine with it for now. */ function findPackageFrom(packageName: string, relativeTo: string) { - // tslint:disable-next-line:variable-name + // eslint-disable-next-line @typescript-eslint/naming-convention const Module = module.constructor as any; const searchDirs: string[] = Module._nodeModulePaths(relativeTo).concat(Module.globalPaths); const ret = Module._findPath(packageName, searchDirs, false); if (ret === false) { - // tslint:disable-next-line:no-console + /* eslint-disable-next-line no-console */ console.warn(`Could not find package ${packageName} in scope of ${relativeTo}`); return undefined; } @@ -143,14 +143,14 @@ function findPackageRoot(rootFile: string) { * Returns undefined if any part of the path was unset or * not an object. */ -function deepGet(x: any, path: string[]): any { - path = path.slice(); +function deepGet(x: any, keyPath: string[]): any { + keyPath = keyPath.slice(); - while (path.length > 0 && typeof x === 'object' && x !== null) { - const key = path.shift()!; + while (keyPath.length > 0 && typeof x === 'object' && x !== null) { + const key = keyPath.shift()!; x = x[key]; } - return path.length === 0 ? x : undefined; + return keyPath.length === 0 ? x : undefined; } function debug(s: string) { diff --git a/tools/yarn-cling/bin/yarn-cling.ts b/tools/yarn-cling/bin/yarn-cling.ts index 844c852b15ebe..78d0777a0384b 100644 --- a/tools/yarn-cling/bin/yarn-cling.ts +++ b/tools/yarn-cling/bin/yarn-cling.ts @@ -7,12 +7,12 @@ async function main() { outputFile: 'npm-shrinkwrap.json', }); - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error('Generated npm-shrinkwrap.json'); } main().catch(e => { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console console.error(e); process.exitCode = 1; }); \ No newline at end of file diff --git a/tools/yarn-cling/lib/index.ts b/tools/yarn-cling/lib/index.ts index eabbf390c5207..44a09a09fcb8d 100644 --- a/tools/yarn-cling/lib/index.ts +++ b/tools/yarn-cling/lib/index.ts @@ -58,7 +58,7 @@ async function generateLockFile(pkgJson: PackageJson, yarnLock: YarnLock, rootDi }; } -// tslint:disable-next-line:max-line-length +// eslint-disable-next-line max-len async function dependenciesFor(deps: Record, yarnLock: YarnLock, rootDir: string): Promise> { const ret: Record = {}; @@ -143,7 +143,7 @@ export function formatPackageLock(entry: PackageLockEntry) { function recurse(names: string[], thisEntry: PackageLockEntry) { if (names.length > 0) { - // tslint:disable-next-line:no-console + // eslint-disable-next-line no-console lines.push(`${names.join(' -> ')} @ ${thisEntry.version}`); } for (const [depName, depEntry] of Object.entries(thisEntry.dependencies || {})) { diff --git a/tslint.yaml b/tslint.yaml deleted file mode 100644 index 53a5af55dab93..0000000000000 --- a/tslint.yaml +++ /dev/null @@ -1,57 +0,0 @@ -extends: "tslint:recommended" -rules: - semicolon: [true, "always", "ignore-interfaces"] - - # Due to VSCode syntax highlighting we're unlikely to do this wrong, and it gets annoying - # when trying to construct literal Fn::Sub() arguments. - no-invalid-template-strings: false - - # No preference for quotes (?) - quotemark: false - - # Our props struct currently don't start with "I" - interface-name: false - - # We're not Java - max-classes-per-file: false - - # We have this wrong on all classes, keep it a warning for now - member-access: - severity: warning - - # Rule is dumb, complains about aliases for interface definitions - interface-over-type-literal: false - - # File should end with a newline. Why? - eofline: false - - # Way more readable without - arrow-parens: false - - # We're using namespaces. - no-namespace: false - - # The lines with CloudFormation doc links are quite long - max-line-length: [true, 150] - - # Super annoying - object-literal-sort-keys: false - - # Trailing comma gets into a fight with itself when splitting lists over multiple lines - trailing-comma: false - - # We create Constructs for their side effect all the time - no-unused-expression: [true, "allow-new"] - - # Without this rule, _blabla would be disallowed, which is necessary to silence unused variable errors. - # Allow Pascal Case for static variables - variable-name: [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"] - - # Unhandled promises are the source of all kinds of bugs and race conditions... - no-floating-promises: ["Promise"] - - # We require empty interfaces for AWS construct guideline compliance - no-empty-interface: false - - # Cleaner imports - no-duplicate-imports: error \ No newline at end of file