diff --git a/lerna.json b/lerna.json index 45baeccd2d79d..11ba780008542 100644 --- a/lerna.json +++ b/lerna.json @@ -11,7 +11,6 @@ "packages/@aws-cdk/*/lambda-packages/*", "tools/@aws-cdk/cdk-build-tools", "tools/@aws-cdk/cdk-release", - "tools/@aws-cdk/eslint-plugin", "tools/@aws-cdk/node-bundle", "tools/@aws-cdk/pkglint", "tools/@aws-cdk/pkgtools", diff --git a/package.json b/package.json index 81541f5989b1f..99e5e83aed8c4 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "packages/@aws-cdk/*/lambda-packages/*", "tools/@aws-cdk/cdk-build-tools", "tools/@aws-cdk/cdk-release", - "tools/@aws-cdk/eslint-plugin", "tools/@aws-cdk/node-bundle", "tools/@aws-cdk/pkglint", "tools/@aws-cdk/pkgtools", diff --git a/packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts b/packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts index 5e55ca9be74b9..53317662ad8aa 100644 --- a/packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts +++ b/packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts @@ -530,7 +530,7 @@ export class TestFixture extends ShellHelper { // Bootstrap stacks have buckets that need to be cleaned const bucketNames = stacksToDelete.map(stack => outputFromStack('BucketName', stack)).filter(defined); // Parallelism will be reasonable - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(bucketNames.map(b => this.aws.emptyBucket(b))); // The bootstrap bucket has a removal policy of RETAIN by default, so add it to the buckets to be cleaned up. this.bucketsToDelete.push(...bucketNames); @@ -538,7 +538,7 @@ export class TestFixture extends ShellHelper { // Bootstrap stacks have ECR repositories with images which should be deleted const imageRepositoryNames = stacksToDelete.map(stack => outputFromStack('ImageRepositoryName', stack)).filter(defined); // Parallelism will be reasonable - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(imageRepositoryNames.map(r => this.aws.deleteImageRepository(r))); await this.aws.deleteStacks( diff --git a/packages/@aws-cdk-testing/cli-integ/test/resource-pool.test.ts b/packages/@aws-cdk-testing/cli-integ/test/resource-pool.test.ts index 73b3b169c46da..9f8c37895e377 100644 --- a/packages/@aws-cdk-testing/cli-integ/test/resource-pool.test.ts +++ b/packages/@aws-cdk-testing/cli-integ/test/resource-pool.test.ts @@ -51,7 +51,7 @@ test('somewhat balance', async () => { const keys = Object.keys(counters) as Array ; const pool = ResourcePool.withResources(POOL_NAME, keys); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Array.from(range(N)).map(() => pool.using(async (x) => { counters[x] += 1; diff --git a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/bootstrapping.integtest.ts b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/bootstrapping.integtest.ts index 1056faeb3a223..e6d2b05903f5e 100644 --- a/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/bootstrapping.integtest.ts +++ b/packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/bootstrapping.integtest.ts @@ -1,4 +1,4 @@ -/* eslint-disable @aws-cdk/no-literal-partition */ +/* eslint-disable @cdklabs/no-literal-partition */ import * as fs from 'fs'; import * as path from 'path'; import { DescribeStackResourcesCommand, DescribeStacksCommand } from '@aws-sdk/client-cloudformation'; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources-node-18.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources-node-18.ts index 6b5f09afabe48..a7703e7f7b98b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources-node-18.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources-node-18.ts @@ -10,7 +10,7 @@ import { App, CfnOutput, CustomResource, CustomResourceProvider, CustomResourceP import { Construct } from 'constructs'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts index 755e8182ac92e..4035934f38aad 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts @@ -10,7 +10,7 @@ import { App, CfnOutput, CustomResource, CustomResourceProvider, Stack, Token } import { Construct } from 'constructs'; import { STANDARD_CUSTOM_RESOURCE_PROVIDER_RUNTIME } from '../../config'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts index 367c74e39c9f0..01c18aac41dc2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts @@ -6,7 +6,7 @@ import { App, CfnParameter, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { STANDARD_NODEJS_RUNTIME } from '../../config'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ interface MyNestedStackProps { readonly subscriber?: sqs.Queue; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts index 79147ff9eec12..fa25598c66f5f 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts @@ -4,7 +4,7 @@ import { App, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { STANDARD_NODEJS_RUNTIME } from '../../config'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ class MyNestedStack extends NestedStack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts index ff4e8ece52ac6..ca63695b69458 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts @@ -2,7 +2,7 @@ import * as sns from 'aws-cdk-lib/aws-sns'; import { App, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ class YourNestedStack extends NestedStack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts index 5720f72d43727..368db01719a84 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts @@ -11,7 +11,7 @@ export class TestOrigin extends OriginBase { export class TestOriginGroup implements IOrigin { constructor(private readonly primaryDomainName: string, private readonly secondaryDomainName: string) { } - /* eslint-disable @aws-cdk/no-core-construct */ + /* eslint-disable @cdklabs/no-core-construct */ public bind(scope: Construct, options: OriginBindOptions): OriginBindConfig { const primaryOrigin = new TestOrigin(this.primaryDomainName); const secondaryOrigin = new TestOrigin(this.secondaryDomainName); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts index 9b2a8c46a2e6a..f7dd094a1ccc3 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts @@ -23,7 +23,7 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent async function putObjects(bucketName: string, n = 5) { // Put n objects in parallel // Bounded by human input - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all([...Array(n).keys()] .map(key => s3.putObject({ Bucket: bucketName, diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/privileges.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/privileges.ts index 76fdc54b28280..0ad9e85c14605 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/privileges.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/privileges.ts @@ -33,7 +33,7 @@ export async function handler(props: UserTablePrivilegesHandlerProps & ClusterPr async function revokePrivileges(username: string, tablePrivileges: TablePrivilege[], clusterProps: ClusterProps) { // Limited by human input - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(tablePrivileges.map(({ tableName, actions }) => { return executeStatement(`REVOKE ${actions.join(', ')} ON ${tableName} FROM ${username}`, clusterProps); })); @@ -41,7 +41,7 @@ async function revokePrivileges(username: string, tablePrivileges: TablePrivileg async function grantPrivileges(username: string, tablePrivileges: TablePrivilege[], clusterProps: ClusterProps) { // Limited by human input - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(tablePrivileges.map(({ tableName, actions }) => { return executeStatement(`GRANT ${actions.join(', ')} ON ${tableName} TO ${username}`, clusterProps); })); diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/table.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/table.ts index 5eac29e2af0eb..1e1041d06e2d3 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/table.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query-provider/table.ts @@ -211,7 +211,7 @@ async function updateTable( } // Limited by human input - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(alterationStatements.map(statement => executeStatement(statement, tableAndClusterProps))); if (isTableV2) { diff --git a/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts b/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts index a2eacf037959d..cb203498b6ec0 100644 --- a/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts +++ b/packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts @@ -170,7 +170,7 @@ export function parseLambdaPermission(x: any): Statement { statement.Principal = '*'; } else if (/^\d{12}$/.test(x.Principal)) { // Account number - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition statement.Principal = { AWS: `arn:aws:iam::${x.Principal}:root` }; } else { // Assume it's a service principal diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts index 2ec7bd37b0afb..7c9178e29b1df 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/core/cross-region-ssm-reader-handler/index.ts @@ -51,7 +51,7 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent */ async function addTags(ssm: SSM, parameters: string[], keyName: string): Promise { const limit = pLimit(10); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(parameters.map((name) => limit(async () => { try { return await ssm.addTagsToResource({ @@ -73,7 +73,7 @@ async function addTags(ssm: SSM, parameters: string[], keyName: string): Promise */ async function removeTags(ssm: SSM, parameters: string[], keyName: string): Promise { const limit = pLimit(10); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(parameters.map(name => limit(async() => { try { return await ssm.removeTagsFromResource({ diff --git a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts index 17e7db2cd7200..9295141067dc6 100644 --- a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts +++ b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts @@ -1,4 +1,4 @@ -/* eslint-disable @aws-cdk/no-literal-partition */ +/* eslint-disable @cdklabs/no-literal-partition */ import * as path from 'path'; import { CdkCliWrapper, ICdk } from '@aws-cdk/cdk-cli-wrapper'; import { TestCase, DefaultCdkOptions } from '@aws-cdk/cloud-assembly-schema'; diff --git a/packages/@aws-cdk/integ-runner/lib/workers/integ-snapshot-worker.ts b/packages/@aws-cdk/integ-runner/lib/workers/integ-snapshot-worker.ts index 4b7c75648523b..38d7e9b48feeb 100644 --- a/packages/@aws-cdk/integ-runner/lib/workers/integ-snapshot-worker.ts +++ b/packages/@aws-cdk/integ-runner/lib/workers/integ-snapshot-worker.ts @@ -21,7 +21,7 @@ export async function runSnapshotTests( }); // The worker pool is already limited - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism const failedTests: IntegTestWorkerConfig[][] = await Promise.all( tests.map((test) => pool.exec('snapshotTestWorker', [test.info /* Dehydrate class -> data */, options], { on: (x) => { diff --git a/packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts b/packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts index 9b985bc88ebb8..f764a4ac5d572 100644 --- a/packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts +++ b/packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts @@ -156,7 +156,7 @@ export async function runIntegrationTestsInParallel( const workers = accountWorkers.map((worker) => runTest(worker)); // Workers are their own concurrency limits - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(workers); return results; } diff --git a/packages/aws-cdk-lib/aws-appconfig/lib/application.ts b/packages/aws-cdk-lib/aws-appconfig/lib/application.ts index a2eceecb71f94..03a0901f2b402 100644 --- a/packages/aws-cdk-lib/aws-appconfig/lib/application.ts +++ b/packages/aws-cdk-lib/aws-appconfig/lib/application.ts @@ -1,4 +1,4 @@ -/* eslint-disable @aws-cdk/no-literal-partition */ +/* eslint-disable @cdklabs/no-literal-partition */ import { Construct } from 'constructs'; import { CfnApplication } from './appconfig.generated'; import { HostedConfiguration, HostedConfigurationOptions, SourcedConfiguration, SourcedConfigurationOptions } from './configuration'; diff --git a/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts b/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts index 13ff15dd7883c..223c3bfa8543b 100644 --- a/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts +++ b/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts @@ -9,7 +9,7 @@ import { App, CfnParameter, CfnResource, ContextProvider, LegacyStackSynthesizer import * as cxapi from '../../cx-api'; import { NestedStack } from '../lib/nested-stack'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ /* eslint-disable max-len */ describeDeprecated('NestedStack', () => { diff --git a/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts b/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts index 390c600bce3ba..d566163f905af 100644 --- a/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts +++ b/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts @@ -6,7 +6,7 @@ import * as sns from '../../aws-sns'; import * as cdk from '../../core'; import { CustomResource, CustomResourceProvider } from '../lib'; -/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable @cdklabs/no-core-construct */ /* eslint-disable quote-props */ describeDeprecated('custom resources honor removalPolicy', () => { diff --git a/packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts b/packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts index 2f4f70c899eac..8763187e09c9a 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts @@ -11,7 +11,7 @@ export class TestOrigin extends OriginBase { export class TestOriginGroup implements IOrigin { constructor(private readonly primaryDomainName: string, private readonly secondaryDomainName: string) { } - /* eslint-disable @aws-cdk/no-core-construct */ + /* eslint-disable @cdklabs/no-core-construct */ public bind(scope: Construct, options: OriginBindOptions): OriginBindConfig { const primaryOrigin = new TestOrigin(this.primaryDomainName); const secondaryOrigin = new TestOrigin(this.secondaryDomainName); diff --git a/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts b/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts index 99744a5791ce2..901605af7585f 100644 --- a/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts @@ -369,7 +369,7 @@ export class AlbController extends Construct { // This is safe to disable because we're actually replacing the literal partition with a reference to // the stack partition (which is hardcoded into the JSON files) to prevent issues such as // aws/aws-cdk#22520. - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition const rewriteResource = (s: string) => s.replace('arn:aws:', `arn:${Aws.PARTITION}:`); if (!resources) { diff --git a/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts index fe0df0fd7cc37..733911f4f26ac 100644 --- a/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts @@ -455,7 +455,7 @@ export class Nodegroup extends Resource implements INodegroup { // https://docs.aws.amazon.com/eks/latest/userguide/cni-iam-role.html if (props.cluster.ipFamily == IpFamily.IP_V6) { ngRole.addToPrincipalPolicy(new PolicyStatement({ - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition resources: ['arn:aws:ec2:*:*:network-interface/*'], actions: [ 'ec2:AssignIpv6Addresses', diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts index 72dad641eb2d7..b17dbeeef55d6 100644 --- a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts @@ -99,7 +99,7 @@ export abstract class BaseListener extends Resource implements IListener { loadBalancerType: options.loadBalancerType, } as cxschema.LoadBalancerListenerContextQuery, dummyValue: { - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition listenerArn: `arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/${options.loadBalancerType}/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2`, listenerPort: 80, securityGroupIds: ['sg-123456789012'], diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts index c68cef4db49d9..6816b67ebeda0 100644 --- a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts @@ -147,7 +147,7 @@ export abstract class BaseLoadBalancer extends Resource { } as cxschema.LoadBalancerContextQuery, dummyValue: { ipAddressType: cxapi.LoadBalancerIpAddressType.DUAL_STACK, - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition loadBalancerArn: `arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/${options.loadBalancerType}/my-load-balancer/50dc6c495c0c9188`, loadBalancerCanonicalHostedZoneId: 'Z3DZXE0EXAMPLE', loadBalancerDnsName: 'my-load-balancer-1234567890.us-west-2.elb.amazonaws.com', diff --git a/packages/aws-cdk-lib/aws-events/test/rule.test.ts b/packages/aws-cdk-lib/aws-events/test/rule.test.ts index b99bcdd5443b2..f360bc41137d5 100644 --- a/packages/aws-cdk-lib/aws-events/test/rule.test.ts +++ b/packages/aws-cdk-lib/aws-events/test/rule.test.ts @@ -1194,7 +1194,7 @@ describe('rule', () => { }); class SomeTarget implements IRuleTarget { - // eslint-disable-next-line @aws-cdk/no-core-construct + // eslint-disable-next-line @cdklabs/no-core-construct public constructor(private readonly id?: string, private readonly resource?: IConstruct) { } diff --git a/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts index 9ab72e1a5fe10..600fd8ea43501 100644 --- a/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts @@ -131,7 +131,7 @@ export class SecretRotationApplication { constructor(applicationId: string, semanticVersion: string, options?: SecretRotationApplicationOptions) { // partitions are handled explicitly via applicationArnForPartition() - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition this.applicationId = `arn:aws:serverlessrepo:us-east-1:297356227824:applications/${applicationId}`; this.semanticVersion = semanticVersion; this.applicationName = applicationId; diff --git a/packages/aws-cdk-lib/core/lib/arn.ts b/packages/aws-cdk-lib/core/lib/arn.ts index 0af5a35d9db9f..804b1ff85c657 100644 --- a/packages/aws-cdk-lib/core/lib/arn.ts +++ b/packages/aws-cdk-lib/core/lib/arn.ts @@ -15,7 +15,7 @@ export enum ArnFormat { * even if it contains slashes, * like in 'arn:aws:s3:::bucket/object.zip'. */ - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition NO_RESOURCE_NAME = 'arn:aws:service:region:account:resource', /** @@ -26,7 +26,7 @@ export enum ArnFormat { * even if it contains slashes, * like in 'arn:aws:apigateway:region:account:resource:/test/mydemoresource/*'. */ - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition COLON_RESOURCE_NAME = 'arn:aws:service:region:account:resource:resourceName', /** @@ -37,7 +37,7 @@ export enum ArnFormat { * even if it contains colons, * like in 'arn:aws:cognito-sync:region:account:identitypool/us-east-1:1a1a1a1a-ffff-1111-9999-12345678:bla'. */ - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition SLASH_RESOURCE_NAME = 'arn:aws:service:region:account:resource/resourceName', /** @@ -47,7 +47,7 @@ export enum ArnFormat { * Like in: 'arn:aws:service:region:account:/resource/resourceName'. * Note that the leading slash is _not_ included in the parsed 'resource' part. */ - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition SLASH_RESOURCE_SLASH_RESOURCE_NAME = 'arn:aws:service:region:account:/resource/resourceName', } diff --git a/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts b/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts index 007beab6f5ee2..ac05513ed1dde 100644 --- a/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts +++ b/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts @@ -8,7 +8,7 @@ import { MAGIC_V2NEXT } from '../lib/private/flag-modeling'; async function main() { const featuresSourceFile = path.join(__dirname, '..', 'lib', 'features.ts'); - // eslint-disable-next-line @aws-cdk/no-invalid-path + // eslint-disable-next-line @cdklabs/no-invalid-path let currentv2: string | undefined = JSON.parse(await fs.readFile(path.join(__dirname, '..', '..', '..', '..', 'version.v2.json'), { encoding: 'utf-8' })).version; currentv2 = currentv2?.match(/^[0-9\.]+/)?.[0]; // Make sure to only retain the actual version number, not any '-rc.X' suffix diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index 2524e01e2dd30..5ea7db464b326 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -527,7 +527,7 @@ export const FLAGS: Record = { [ENABLE_PARTITION_LITERALS]: { type: FlagType.BugFix, summary: 'Make ARNs concrete if AWS partition is known', - // eslint-disable-next-line @aws-cdk/no-literal-partition + // eslint-disable-next-line @cdklabs/no-literal-partition detailsMd: ` Enable this feature flag to get partition names as string literals in Stacks with known regions defined in their environment, such as "aws" or "aws-cn". Previously the CloudFormation intrinsic function @@ -936,9 +936,9 @@ export const FLAGS: Record = { type: FlagType.BugFix, summary: 'When enabled, will always use the arn for identifiers for CfnSourceApiAssociation in the GraphqlApi construct rather than id.', detailsMd: ` - When this feature flag is enabled, we use the IGraphqlApi ARN rather than ID when creating or updating CfnSourceApiAssociation in + When this feature flag is enabled, we use the IGraphqlApi ARN rather than ID when creating or updating CfnSourceApiAssociation in the GraphqlApi construct. Using the ARN allows the association to support an association with a source api or merged api in another account. - Note that for existing source api associations created with this flag disabled, enabling the flag will lead to a resource replacement. + Note that for existing source api associations created with this flag disabled, enabling the flag will lead to a resource replacement. `, introducedIn: { v2: '2.97.0' }, recommendedValue: true, @@ -957,7 +957,7 @@ export const FLAGS: Record = { is replicated with the new \`snapshotCredentials\` property, but the original \`credentials\` secret can still be created resulting in an extra database secret. - + Set this flag to prevent rendering deprecated \`credentials\` and creating an extra database secret when only using \`snapshotCredentials\` to create an RDS database cluster from a snapshot. @@ -971,7 +971,7 @@ export const FLAGS: Record = { type: FlagType.BugFix, summary: 'When enabled, the CodeCommit source action is using the default branch name \'main\'.', detailsMd: ` - When setting up a CodeCommit source action for the source stage of a pipeline, please note that the + When setting up a CodeCommit source action for the source stage of a pipeline, please note that the default branch is \'master\'. However, with the activation of this feature flag, the default branch is updated to \'main\'. `, @@ -987,7 +987,7 @@ export const FLAGS: Record = { When this feature flag is enabled, a logical ID of \`LambdaPermission\` for a \`LambdaAction\` will include an alarm ID. Therefore multiple alarms for the same Lambda can be created with \`LambdaAction\`. - + If the flag is set to false then it can only make one alarm for the Lambda with \`LambdaAction\`. `, @@ -1123,8 +1123,8 @@ export const FLAGS: Record = { Currently, 'inputPath' and 'outputPath' from the TaskStateBase Props is being used under BedrockInvokeModelProps to define S3URI under 'input' and 'output' fields of State Machine Task definition. - When this feature flag is enabled, specify newly introduced props 's3InputUri' and - 's3OutputUri' to populate S3 uri under input and output fields in state machine task definition for Bedrock invoke model. + When this feature flag is enabled, specify newly introduced props 's3InputUri' and + 's3OutputUri' to populate S3 uri under input and output fields in state machine task definition for Bedrock invoke model. `, introducedIn: { v2: '2.156.0' }, @@ -1154,8 +1154,8 @@ export const FLAGS: Record = { summary: 'When enabled, initOptions.timeout and resourceSignalTimeout values will be summed together.', detailsMd: ` Currently is both initOptions.timeout and resourceSignalTimeout are both specified in the options for creating an EC2 Instance, - only the value from 'resourceSignalTimeout' will be used. - + only the value from 'resourceSignalTimeout' will be used. + When this feature flag is enabled, if both initOptions.timeout and resourceSignalTimeout are specified, the values will to be summed together. `, recommendedValue: true, @@ -1167,11 +1167,11 @@ export const FLAGS: Record = { type: FlagType.BugFix, summary: 'When enabled, a Lambda authorizer Permission created when using GraphqlApi will be properly scoped with a SourceArn.', detailsMd: ` - Currently, when using a Lambda authorizer with an AppSync GraphQL API, the AWS CDK automatically generates the necessary AWS::Lambda::Permission - to allow the AppSync API to invoke the Lambda authorizer. This permission is overly permissive because it lacks a SourceArn, meaning + Currently, when using a Lambda authorizer with an AppSync GraphQL API, the AWS CDK automatically generates the necessary AWS::Lambda::Permission + to allow the AppSync API to invoke the Lambda authorizer. This permission is overly permissive because it lacks a SourceArn, meaning it allows invocations from any source. - When this feature flag is enabled, the AWS::Lambda::Permission will be properly scoped with the SourceArn corresponding to the + When this feature flag is enabled, the AWS::Lambda::Permission will be properly scoped with the SourceArn corresponding to the specific AppSync GraphQL API. `, recommendedValue: true, @@ -1184,7 +1184,7 @@ export const FLAGS: Record = { summary: 'When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn`', detailsMd: ` Currently, the value of the property 'instanceResourceId' in construct 'DatabaseInstanceReadReplica' is not correct, and set to 'DbInstanceArn' which is not correct when it is used to create the IAM Policy in the grantConnect method. - + When this feature flag is enabled, the value of that property will be as expected set to 'DbiResourceId' attribute, and that will fix the grantConnect method. `, introducedIn: { v2: '2.161.0' }, @@ -1210,9 +1210,9 @@ export const FLAGS: Record = { type: FlagType.BugFix, summary: 'When enabled, both `@aws-sdk` and `@smithy` packages will be excluded from the Lambda Node.js 18.x runtime to prevent version mismatches in bundled applications.', detailsMd: ` - Currently, when bundling Lambda functions with the non-latest runtime that supports AWS SDK JavaScript (v3), only the '@aws-sdk/*' packages are excluded by default. + Currently, when bundling Lambda functions with the non-latest runtime that supports AWS SDK JavaScript (v3), only the '@aws-sdk/*' packages are excluded by default. However, this can cause version mismatches between the '@aws-sdk/*' and '@smithy/*' packages, as they are tightly coupled dependencies in AWS SDK v3. - + When this feature flag is enabled, both '@aws-sdk/*' and '@smithy/*' packages will be excluded during the bundling process. This ensures that no mismatches occur between these tightly coupled dependencies when using the AWS SDK v3 in Lambda functions. `, diff --git a/packages/aws-cdk-lib/cx-api/test/features.test.ts b/packages/aws-cdk-lib/cx-api/test/features.test.ts index 470b2644ba2a6..bfd64873122ec 100644 --- a/packages/aws-cdk-lib/cx-api/test/features.test.ts +++ b/packages/aws-cdk-lib/cx-api/test/features.test.ts @@ -70,7 +70,7 @@ test.each([ expect(compareVersions(b, a)).toBeCloseTo(-expected, 10); // Gets around expect(-0).toEqual(0) failing... :x }); -// eslint-disable-next-line @aws-cdk/no-invalid-path +// eslint-disable-next-line @cdklabs/no-invalid-path const currentv2: string = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', '..', '..', 'version.v2.json'), { encoding: 'utf-8' })).version; describe(`introducedIn.v2 is either <= ${currentv2} or magic value "${MAGIC_V2NEXT}"`, () => { diff --git a/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts b/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts index fd394600d14b3..da989522c9b63 100644 --- a/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts +++ b/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts @@ -1,4 +1,4 @@ -/* eslint-disable @aws-cdk/no-literal-partition */ +/* eslint-disable @cdklabs/no-literal-partition */ /** * The hosted zone Id if using an alias record in Route53. * diff --git a/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts b/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts index bf89af5ac6021..7dabca366a067 100644 --- a/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts +++ b/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts @@ -296,7 +296,7 @@ export class EvaluateCloudFormationTemplate { if (Array.isArray(cfnExpression)) { // Small arrays in practice - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism return Promise.all(cfnExpression.map(expr => this.evaluateCfnExpression(expr))); } diff --git a/packages/aws-cdk/lib/api/hotswap-deployments.ts b/packages/aws-cdk/lib/api/hotswap-deployments.ts index 8aed36f033fc3..17db0805e555f 100644 --- a/packages/aws-cdk/lib/api/hotswap-deployments.ts +++ b/packages/aws-cdk/lib/api/hotswap-deployments.ts @@ -161,7 +161,7 @@ async function classifyResourceChanges( const changesDetectionResults: Array = []; for (const detectorResultPromises of promises) { // Constant set of promises per resource - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism const hotswapDetectionResults = await Promise.all(await detectorResultPromises()); changesDetectionResults.push(hotswapDetectionResults); } @@ -336,7 +336,7 @@ async function applyAllHotswappableChanges(sdk: ISDK, hotswappableChanges: Hotsw print(`\n${ICON} hotswapping resources:`); } const limit = pLimit(10); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism return Promise.all(hotswappableChanges.map(hotswapOperation => limit(() => { return applyHotswappableChange(sdk, hotswapOperation); }))); diff --git a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts index c3e306fb0b878..c79032eec6e88 100644 --- a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts +++ b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts @@ -112,11 +112,11 @@ export async function isHotswappableEcsServiceChange( }); } // Limited set of updates per cluster - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Object.values(servicePerClusterUpdates) .map(clusterUpdates => { // Limited set of updates per cluster - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism return Promise.all(clusterUpdates.map(serviceUpdate => serviceUpdate.promise)); }), ); @@ -168,7 +168,7 @@ export async function isHotswappableEcsServiceChange( // create a custom Waiter that uses the deploymentCompleted configuration added above const deploymentWaiter = new (AWS as any).ResourceWaiter(sdk.ecs(), 'deploymentCompleted'); // wait for all of the waiters to finish - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Object.entries(servicePerClusterUpdates).map(([clusterName, serviceUpdates]) => { return deploymentWaiter.wait({ cluster: clusterName, diff --git a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts index 6df07dd5880d9..d7532435ff269 100644 --- a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts +++ b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts @@ -123,7 +123,7 @@ export async function isHotswappableLambdaFunctionChange( // run all of our updates in parallel // Limited set of updates per function - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(operations); }, }); @@ -367,7 +367,7 @@ async function versionsAndAliases(logicalId: string, evaluateCfnTemplate: Evalua const aliasesReferencingVersions = flatMap(versionsReferencingFunction, v => evaluateCfnTemplate.findReferencesTo(v.LogicalId)); // Limited set of updates per function - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism const aliasesNames = await Promise.all(aliasesReferencingVersions.map(a => evaluateCfnTemplate.evaluateCfnExpression(a.Properties?.Name))); @@ -385,7 +385,7 @@ async function renderAliases( const aliasesNames = (await versionsAndAliases(logicalId, evaluateCfnTemplate)).aliasesNames; // Limited set of updates per function - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism return Promise.all(aliasesNames.map(callbackfn)); } diff --git a/packages/aws-cdk/lib/api/logs/logs-monitor.ts b/packages/aws-cdk/lib/api/logs/logs-monitor.ts index 446e4bd62033a..4148331c5abe1 100644 --- a/packages/aws-cdk/lib/api/logs/logs-monitor.ts +++ b/packages/aws-cdk/lib/api/logs/logs-monitor.ts @@ -148,7 +148,7 @@ export class CloudWatchLogEventMonitor { } } // Limited set of log groups - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism return Promise.all(promises); } diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 068f16dc1e12c..4863316f3b419 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -794,7 +794,7 @@ export class CdkToolkit { const limit = pLimit(20); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(environments.map((environment) => limit(async () => { success(' ⏳ Bootstrapping environment %s...', chalk.blue(environment.name)); try { diff --git a/packages/aws-cdk/lib/util/archive.ts b/packages/aws-cdk/lib/util/archive.ts index 971e79831d49c..26e39ad029e96 100644 --- a/packages/aws-cdk/lib/util/archive.ts +++ b/packages/aws-cdk/lib/util/archive.ts @@ -45,7 +45,7 @@ function writeZipFile(directory: string, outputFile: string): Promise { for (const file of files) { const fullPath = path.resolve(directory, file); // Exactly 2 promises - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism const [data, stat] = await Promise.all([fs.readFile(fullPath), fs.stat(fullPath)]); archive.append(data, { name: file, diff --git a/packages/aws-cdk/test/cdk-toolkit.test.ts b/packages/aws-cdk/test/cdk-toolkit.test.ts index 248f6d615dfe7..cabd1da365256 100644 --- a/packages/aws-cdk/test/cdk-toolkit.test.ts +++ b/packages/aws-cdk/test/cdk-toolkit.test.ts @@ -983,7 +983,7 @@ describe('watch', () => { }); test("triggers a 'deploy' twice for two file changes", async () => { - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all([ fakeChokidarWatcherOn.fileEventCallback('add', 'my-file1'), fakeChokidarWatcherOn.fileEventCallback('change', 'my-file2'), @@ -993,7 +993,7 @@ describe('watch', () => { }); test("batches file changes that happen during 'deploy'", async () => { - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all([ fakeChokidarWatcherOn.fileEventCallback('add', 'my-file1'), fakeChokidarWatcherOn.fileEventCallback('change', 'my-file2'), diff --git a/packages/awslint/.eslintrc.js b/packages/awslint/.eslintrc.js index 0f4db45f2ba91..e2f3abcc426c0 100644 --- a/packages/awslint/.eslintrc.js +++ b/packages/awslint/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { plugins: [ '@typescript-eslint', 'import', - '@aws-cdk', + '@cdklabs', 'jest', ], parser: '@typescript-eslint/parser', diff --git a/packages/awslint/package.json b/packages/awslint/package.json index 0c6567968c429..532860681a78e 100644 --- a/packages/awslint/package.json +++ b/packages/awslint/package.json @@ -26,7 +26,7 @@ "yargs": "^16.2.0" }, "devDependencies": { - "@aws-cdk/eslint-plugin": "0.0.0", + "@cdklabs/eslint-plugin": "^1.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/fs-extra": "^9.0.13", "@types/jest": "^29.5.12", @@ -71,4 +71,4 @@ "publishConfig": { "tag": "latest" } -} \ No newline at end of file +} diff --git a/tools/@aws-cdk/cdk-build-tools/bin/cdk-copy.ts b/tools/@aws-cdk/cdk-build-tools/bin/cdk-copy.ts index 0231481a410d5..06cece369aedd 100644 --- a/tools/@aws-cdk/cdk-build-tools/bin/cdk-copy.ts +++ b/tools/@aws-cdk/cdk-build-tools/bin/cdk-copy.ts @@ -87,7 +87,7 @@ async function copyAndRewrite(sourceDirectory: string, targetDirectory: string, // Copy all files to new destination and rewrite imports if needed const limit = pLimit(20); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all( files.map((filePath: string) => limit(async () => { const stat = await fs.stat(filePath); diff --git a/tools/@aws-cdk/cdk-build-tools/config/eslintrc.js b/tools/@aws-cdk/cdk-build-tools/config/eslintrc.js index 4f0ba2a313d60..ea069f1c29d37 100644 --- a/tools/@aws-cdk/cdk-build-tools/config/eslintrc.js +++ b/tools/@aws-cdk/cdk-build-tools/config/eslintrc.js @@ -15,7 +15,7 @@ module.exports = { plugins: [ '@typescript-eslint', 'import', - '@aws-cdk', + '@cdklabs', 'jest', ], parser: '@typescript-eslint/parser', diff --git a/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts b/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts index c8a4ac4d6b574..9657930be27d7 100644 --- a/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts +++ b/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts @@ -105,7 +105,7 @@ export function packageCompiler(compilers: CompilerOverrides, options?: CDKBuild } if (options?.stripDeprecated) { // This package is not published to npm so the linter rule is invalid - // eslint-disable-next-line @aws-cdk/no-invalid-path + // eslint-disable-next-line @cdklabs/no-invalid-path args.push(`--strip-deprecated ${path.join(__dirname, '..', '..', '..', '..', 'deprecated_apis.txt')}`); } return [compilers.jsii || require.resolve('jsii/bin/jsii'), ...args]; diff --git a/tools/@aws-cdk/cdk-build-tools/package.json b/tools/@aws-cdk/cdk-build-tools/package.json index 1b211cd20afe4..6b027ac3c2213 100644 --- a/tools/@aws-cdk/cdk-build-tools/package.json +++ b/tools/@aws-cdk/cdk-build-tools/package.json @@ -44,7 +44,7 @@ }, "main": "lib/index.js", "dependencies": { - "@aws-cdk/eslint-plugin": "0.0.0", + "@cdklabs/eslint-plugin": "^1.0.0", "@aws-cdk/yarn-cling": "0.0.0", "@aws-cdk/node-bundle": "0.0.0", "@typescript-eslint/eslint-plugin": "^6.21.0", diff --git a/tools/@aws-cdk/eslint-plugin/.gitignore b/tools/@aws-cdk/eslint-plugin/.gitignore deleted file mode 100644 index a29d60ebc38a3..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -*.js -*.js.map -*.d.ts -dist - -.LAST_BUILD -*.snk -!jest.config.js - -.nyc_output -coverage -nyc.config.js -!.eslintrc.js -!eslintrc.js - -.test-output/ diff --git a/tools/@aws-cdk/eslint-plugin/LICENSE b/tools/@aws-cdk/eslint-plugin/LICENSE deleted file mode 100644 index dcf28b52a83af..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/@aws-cdk/eslint-plugin/NOTICE b/tools/@aws-cdk/eslint-plugin/NOTICE deleted file mode 100644 index c0b1f046c881a..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/tools/@aws-cdk/eslint-plugin/README.md b/tools/@aws-cdk/eslint-plugin/README.md deleted file mode 100644 index f3fa8da62daf6..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# eslint-plugin-cdk - -Eslint plugin for the CDK repository. Contains rules that need to be applied specific to the CDK repository. - -## Rules - -* `invalid-cfn-imports`: Ensures that imports of `Cfn` L1 resources come from the stable - `aws-cdk-lib` package and not the alpha packages. Rule only applies to alpha modules. - -* `no-core-construct`: Forbid the use of `Construct` and `IConstruct` from the "@aws-cdk/core" module. - Instead use `Construct` and `IConstruct` from the "constructs" module. - Rule only applies to typescript files under the `test/` folder. - -* `no-invalid-path`: Checks paths specified using `path.join()` for validity, including not going backwards (`'..'`) - multiple times in the path and not going backwards beyond a package's `package.json`. - -* `no-literal-partition`: Forbids the use of literal partitions (usually `aws`). Instead, use - `Aws.PARTITION` to ensure that the code works for other partitions too. - -* `consider-promise-all`: when using `Promise.all()`, attest that there is no unbounded parallelism. - -## How to add new rules - -* Make a new file in `lib/rules`. It should export one function called `create`. The - `create` function should return a visitor object. -* Add the new file to `lib/index.ts`. -* Add a fixture directory under `test/fixtures/`. Copy and adjust an `eslintrc.js` file - from another test. -* Add a testing `.ts` file, and be sure to add either an `expected.ts` or an `.error.txt` variant - as well! -* You can now run the test in debugging mode (make sure to have `npx tsc -w` running, then from a debugging terminal, `npx jest --no-coverage -it 'your rule name'`), set a breakpoint, and inspect the typeless objects. - -Use to get a feel for the AST you're trying to analyze. Note -that eslint uses `estree` to model AST nodes (not the TypeScript AST nodes), but they are -often comparable. Add type-testing TypeScript helpers to `type-checkers.ts` for typing -assistance. - -To activate it for real on the repo, also add it to `cdk-build-tools/config/eslintrc.js`. diff --git a/tools/@aws-cdk/eslint-plugin/lib/index.ts b/tools/@aws-cdk/eslint-plugin/lib/index.ts deleted file mode 100644 index 26121b7e28603..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const rules = { - 'no-core-construct': require('./rules/no-core-construct'), - 'invalid-cfn-imports': require('./rules/invalid-cfn-imports'), - 'no-literal-partition': require('./rules/no-literal-partition'), - 'no-invalid-path': require('./rules/no-invalid-path'), - 'promiseall-no-unbounded-parallelism': require('./rules/promiseall-no-unbounded-parallelism'), -}; diff --git a/tools/@aws-cdk/eslint-plugin/lib/private/import-cache.ts b/tools/@aws-cdk/eslint-plugin/lib/private/import-cache.ts deleted file mode 100644 index 04325645fdb5d..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/private/import-cache.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as crypto from 'crypto'; - -export interface ImportCacheKey { - readonly fileName: string; - readonly typeName: string; -} - -// `node` is a type from @typescript-eslint/typescript-estree, but using 'any' for now -// since it's incompatible with eslint.Rule namespace. Waiting for better compatibility in -// https://github.com/typescript-eslint/typescript-eslint/tree/1765a178e456b152bd48192eb5db7e8541e2adf2/packages/experimental-utils#note -export type Node = any; - -export interface ImportCacheRecord extends ImportCacheKey { - readonly importNode: Node; - readonly localName: string -} - -export class ImportCache { - private records: { [key: string]: ImportCacheRecord } = {}; - - public record(record: ImportCacheRecord): void { - const key: ImportCacheKey = { - fileName: record.fileName, - typeName: record.typeName, - }; - this.records[hashed(key)] = record; - } - - public find(key: ImportCacheKey): ImportCacheRecord | undefined { - return this.records[hashed(key)]; - } - - public get imports(): ImportCacheRecord[] { - return Object.values(this.records); - } -} - -function hashed(key: {}): string { - const hash = crypto.createHash('md5'); - hash.update(JSON.stringify(key)); - return hash.digest('hex'); -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/lib/private/is-prod-file.ts b/tools/@aws-cdk/eslint-plugin/lib/private/is-prod-file.ts deleted file mode 100644 index 989b0c79602ea..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/private/is-prod-file.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as path from 'path'; - -/** - * We don't care about project test files (in a /test/ directory, excluding our fixtures) - */ -export function isProdFile(filename: string) { - const isInTestFolder = new RegExp(/\/test\//).test(filename); - const isTestingPackage = new RegExp(/@aws-cdk-testing/).test(filename); - - const isInOurTestFolder = path.resolve(filename).startsWith(path.resolve(__dirname, '..', '..', 'test')); - - return (!isInTestFolder && !isTestingPackage) || isInOurTestFolder; -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/private/match-ast.ts b/tools/@aws-cdk/eslint-plugin/lib/private/match-ast.ts deleted file mode 100644 index 0267c13786a6e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/private/match-ast.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Matching the AST is a perennial problem. Here are some helpers. - * - * (NOTE: variable binding here does not support backtracking yet. - * That requires either explicitly keeping a stack somewhere, or using - * continuation-passing style everywhere so that we can use JS for - * backtracking. We don't need it yet and it's a bit of work, so it's not in - * here.) - */ -export interface Match { } - -export type Pattern = (x: unknown, state: Match) => Match | undefined; - -export function match(value: unknown, pattern: Pattern): Match | undefined { - return pattern(value, {}); -} - -/** - * Match any value - */ -export function matchAny(): Pattern { - return function matchAny(_, state) { return state; }; -} - -/** - * Make a Pattern that matches a literal value. - */ -export function matchLiteral(x: any): Pattern { - return function matchLiteral(value, state) { - return value === x ? state : undefined; - }; -} - -/** - * Match an object's fields - */ -export function matchObject(fields: Record): Pattern { - const patFields = Object.fromEntries(Object.entries(fields).map(([key, pat]) => [key, makePattern(pat)])); - - return function matchObject(value, state) { - if (!value || typeof value !== 'object') { - return undefined; - } - for (const [field, pattern] of Object.entries(patFields)) { - state = pattern((value as any)[field], state); - if (!state) { - break; - } - } - return state; - }; -} - -/** - * Turn any value into a Pattern - * - * If it is already a Pattern (function0, return. Otherwise, - * make a Pattern that matches a literal value. - */ -export function makePattern(x: unknown) { - return typeof x === 'function' ? x : matchLiteral(x); -} - -/** - * Create a capturable variable in the matching - * - * The variable can have an `inner` pattern, which it will only match if the inner - * matcher succeeds. - * - * It optionally can also have a type tester, to validate that `variable.get()` will - * not lie about the type it has captured later on. - */ -export function variable(inner?: Pattern, tester?: (x: any) => x is T): Variable { - if (!inner) { - inner = matchAny; - } - - const sym = Symbol(); - const ret = function variable(x: unknown, state: Match) { - const newState = inner(x, state); - if (!newState) { - return undefined; - } - if (tester && !tester(x)) { - throw new Error(`${JSON.stringify(x)} should be of type ${tester.name}, but doesn't`); - } - Object.defineProperty(newState, sym, { - value: x, - }); - - return newState; - }; - ret.get = (m: Match) => { - return (m as any)[sym]; - }; - return ret; -} - -export interface Variable extends Pattern { - get(m: Match): T; -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/private/type-checkers.ts b/tools/@aws-cdk/eslint-plugin/lib/private/type-checkers.ts deleted file mode 100644 index fa94ad8e387f3..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/private/type-checkers.ts +++ /dev/null @@ -1,37 +0,0 @@ -// ESTree is supposed to be used dynamically typed (from JavaScript) and -// `@types/estree` only adds interface declarations, not helper functions to -// type guard objects. Therefore, we make a bunch here. - -import * as estree from 'estree'; -import { matchObject } from './match-ast'; - -export function isMemberExpression(x: estree.BaseNode): x is estree.MemberExpression { - return x.type === 'MemberExpression'; -} - -export function isIdentifier(x: estree.BaseNode): x is estree.Identifier { - return x.type === 'Identifier'; -} - -export function matchMemberExpression(details?: NodeDetails) { - return matchEstree('MemberExpression', details); -} - -export function matchIdentifier(name: string) { - return matchEstree('Identifier', { name }); -} - -/** - * The type of additional node fields (except its type) - */ -type NodeDetails = {[k in Exclude]?: unknown}; - -/** - * Match an ESTree node of a given type with given subfields - */ -export function matchEstree(type: T['type'], details?: NodeDetails) { - return matchObject({ - type, - ...details, - }); -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts deleted file mode 100644 index 139837ea4ef19..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { Rule } from 'eslint'; -import { Identifier, ImportSpecifier } from 'estree'; -import * as fs from 'fs-extra'; -import * as path from 'path'; - -let namespaceImports: { - [key: string]: string -} = {}; - -export function create(context: Rule.RuleContext): Rule.NodeListener { - // The format of Cfn imports only matters for alpha packages, so that they can be - // formatted correctly when released separately for V2. The linter rule should only be - // applied if the file is in an alpha package, or it is a test file. - const filename = context.getFilename(); - if (!currentFileIsInAlphaPackage(filename) && !filename.match('test/rules/fixtures')) { - return {}; - } - - return { - ImportDeclaration: node => { - const location = node.source.value as string; - // Store all of the 'import * as name from location' imports, so that we can check the location when - // we find name.CfnXXX references. - node.specifiers.forEach(e => { - if (e.type === 'ImportNamespaceSpecifier') { - namespaceImports[e.local.name] = location; - } - }); - - if (location.endsWith('generated') || location === '@aws-cdk/core') { - // If importing directly from a generated file, this is fine. Also we know that aws-cdk/core is not experimental, so that is fine as well. - return; - } - - const cfnImports: ImportSpecifier[] = []; - const otherImports: ImportSpecifier[] = []; - node.specifiers.forEach(e => { - if (e.type === 'ImportSpecifier') { - if (e.imported.name.startsWith('Cfn')) { - cfnImports.push(e); - } else { - otherImports.push(e); - } - } - }); - - if (cfnImports.length > 0 && otherImports.length > 0 && location.startsWith('.')) { - // import { CfnXXX, SomethingElse, AnotherThing } from './some/relative/path/not/ending/in/generated'; - context.report({ - message: 'To allow rewriting imports when generating v2 experimental packages, import of `' + cfnImports.map(e => e.imported.name).join(', ') + '` must be separate from import of `' + otherImports.map(e => e.imported.name).join(', ') + '`, and imported from its specific .generated location.', - node: node, - }); - } else if (cfnImports.length > 0 && location.startsWith('.')) { - // import { CfnXXX } from './some/relative/path/not/ending/in/generated'; - context.report({ - message: 'To allow rewriting imports when generating v2 experimental packages, import of `' + cfnImports.map(e => e.imported.name).join(', ') + '` must be imported from its specific .generated location.', - node: node, - }); - } else if (cfnImports.length > 0 && otherImports.length > 0 && checkIfImportedLocationIsAnAlphaPackage(location, context.getFilename())) { - // import { CfnXXX, SomethingElse, AnotherThing } from '@aws-cdk/another-alpha-package'; - context.report({ - message: 'To allow rewriting imports when generating v2 experimental packages, import of `' + cfnImports.map(e => e.imported.name).join(', ') + '` must be separate from import of `' + otherImports.map(e => e.imported.name).join(', ') + '`', - node: node, - }); - } - }, - - // This captures using `xxx.CfnConstruct` as an identifier - Identifier: node => { - const typeAnnotation = (node as any).typeAnnotation?.typeAnnotation; - const type = typeAnnotation?.typeName; - if (type?.type === 'TSQualifiedName') { - const result = checkLeftAndRightForCfn(type); - if (result) { - reportErrorIfImportedLocationIsNotValid(context, node, result.name, result.location); - } - } - if (node.name.startsWith('Cfn') && node.parent.type === 'MemberExpression' && node.parent.object.type === 'Identifier') { - // new xxx.CfnConstruct(); - reportErrorIfImportedLocationIsNotValid(context, node, node.name, node.parent.object.name); - } - }, - }; -} - -function reportErrorIfImportedLocationIsNotValid(context: Rule.RuleContext, node: Identifier, name: string, barrelImportName: string) { - const location = namespaceImports[barrelImportName]; - if (!location) { - // This scenario should not happen, but if it does, we don't want users to run into weird runtime errors from the linter. - return; - } - if (location.endsWith('generated') || location === '@aws-cdk/core') { - return; - } - if (location.startsWith('.')) { - // import * as name from './some/relative/path/not/ending/in/generated'; name.CfnConstruct(); - context.report({ - message: 'To allow rewriting imports when generating v2 experimental packages, `' + name + '` must be imported by name from its specific .generated location.', - node: node, - }); - } else if (checkIfImportedLocationIsAnAlphaPackage(location, context.getFilename())) { - // import * as name from '@aws-cdk/another-alpha-package'; name.CfnConstruct(); - context.report({ - message: 'To allow rewriting imports when generating v2 experimental packages, `' + name + '` must be imported by name and separate from non-L1 imports, since it is being imported from an experimental package: ' + location, - node: node, - }); - } -} - -function currentFileIsInAlphaPackage(filename: string): boolean { - const filePathSplit = filename.split(path.sep); - const awsCdkNamespaceIndex = filePathSplit.findIndex(e => e.match('@aws-cdk')) - if (awsCdkNamespaceIndex !== -1) { - const packageDir = filePathSplit.slice(0, awsCdkNamespaceIndex + 2).join(path.sep); - return isAlphaPackage(packageDir); - } - return false; -} - -function checkIfImportedLocationIsAnAlphaPackage(location: string, currentFilename: string): boolean { - const rootDir = getCdkRootDir(currentFilename); - if (rootDir) { - const packageDir = rootDir + `/packages/${location}`; - return isAlphaPackage(packageDir); - } - return false; -} - -function getCdkRootDir(filename: string): string | undefined { - const filenameSplit = filename.split(path.sep); - // for test files - let rootDirIndex = filenameSplit.findIndex(e => e.match('tools')); - - // for package files - if (rootDirIndex === -1) { - rootDirIndex = filenameSplit.findIndex(e => e.match('packages')); - } - - if (rootDirIndex !== -1) { - return filenameSplit.slice(0, rootDirIndex).join(path.sep); - } - return undefined; -} - -function isAlphaPackage(packageDir: string): boolean { - if (packageDir.endsWith('aws-cdk-lib/core')) { - return false; // special case for core because it does not have a package.json - } - - const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), { encoding: 'utf-8' })); - - const separateModule = pkg['separate-module']; - if (separateModule !== undefined) { - return separateModule; - } - - const maturity = pkg.maturity; - if (maturity !== 'experimental' && maturity !== 'developer-preview') { - return false; - } - // we're only interested in '@aws-cdk/' packages, - // and those that are JSII-enabled - return pkg.name.startsWith('@aws-cdk/') && !!pkg['jsii']; -} - -function checkLeftAndRightForCfn(node: any): { name: string, location: string } | undefined { - // Checking the left and right allows capturing the CfnConstruct name even if the TSQualifiedName references a subtype like: - // xxx.CfnConstruct.subtype - // xxx.CfnConstruct.subtype.anothersubtype - if (!node) { - return undefined; - } - if (node.name?.startsWith('Cfn')) { - if (node.name === node.parent.left.name) { - // This is the scenario for a reference to CfnConstruct.subtype - // In this case, it is not qualified with a barrel import, so we don't need to do anything. - return undefined; - } - return { - name: node.name, - location: node.parent.left.name, - }; - } - - const right = checkLeftAndRightForCfn(node.right); - const left = checkLeftAndRightForCfn(node.left); - - return right ?? left ?? undefined; -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/no-core-construct.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/no-core-construct.ts deleted file mode 100644 index 4e808e26c375f..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/no-core-construct.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { Rule } from 'eslint'; -import { ImportCache, Node } from '../private/import-cache'; - -let importCache: ImportCache; -let importsFixed: boolean; - -const BANNED_TYPES = [ 'IConstruct', 'Construct' ]; - -export function create(context: Rule.RuleContext): Rule.NodeListener { - return { - - // `node` is a type from @typescript-eslint/typescript-estree, but using 'any' for now - // since it's incompatible with eslint.Rule namespace. Waiting for better compatibility in - // https://github.com/typescript-eslint/typescript-eslint/tree/1765a178e456b152bd48192eb5db7e8541e2adf2/packages/experimental-utils#note - // Meanwhile, use a debugger to explore the AST node. - - Program(_node: any) { - if (!isTestFile(context.getFilename())) { - return; - } - importCache = new ImportCache(); - importsFixed = false; - }, - - ImportDeclaration(node: any) { - if (!isTestFile(context.getFilename())) { - return; - } - if (node.source.value === '@aws-cdk/core') { - node.specifiers.forEach((s: any) => { - if (s.type === 'ImportSpecifier' && BANNED_TYPES.includes(s.imported.name)) { - // named import - importCache.record({ - fileName: context.getFilename(), - typeName: s.imported.name, - importNode: node, - localName: s.local.name - }); - } else if (s.type === 'ImportNamespaceSpecifier') { - // barrel import - BANNED_TYPES.forEach(typeName => { - importCache.record({ - fileName: context.getFilename(), - typeName, - importNode: node, - localName: `${s.local.name}.${typeName}` - }); - }); - } - }); - } - }, - - Identifier(node: any) { - if (!isTestFile(context.getFilename())) { - return; - } - // Only apply rule to bindings (variables and function parameters) - const typeAnnotation = node.typeAnnotation?.typeAnnotation - if (!typeAnnotation) { - return; - } - const type = typeAnnotation.typeName; - if (!type) { return; } - - const message = 'Use Construct and IConstruct from the "constructs" module in variable declarations (not "@aws-cdk/core")'; - - if (type.type === 'TSQualifiedName') { - // barrel import - const qualifier = type.left.name; - const typename = type.right.name; - const importNode = findImportNode(`${qualifier}.${typename}`); - if (!importNode) { - return; - } - context.report({ - node, - message, - fix: (fixer: Rule.RuleFixer) => { - const fixes: Rule.Fix[] = []; - if (!importsFixed) { - fixes.push(fixer.insertTextAfter(importNode, "\nimport * as constructs from 'constructs';")); - importsFixed = true; - } - fixes.push(fixer.replaceTextRange(typeAnnotation.range, `constructs.${typename}`)); - return fixes; - } - }); - } else if (type.type === 'Identifier') { - // named imports - const importNode = findImportNode(type.name); - if (!importNode) { - return; - } - context.report({ - node, - message, - fix: (fixer: Rule.RuleFixer) => { - const fixes: Rule.Fix[] = []; - if (!importsFixed) { - const typesToImport = BANNED_TYPES.map(typeName => { - const val = importCache.find({ fileName: context.getFilename(), typeName }); - if (!val) { return undefined; } - if (typeName === val.localName) { return typeName; } - return `${typeName} as ${val.localName}`; - }).filter(x => x !== undefined); - fixes.push(fixer.insertTextAfter(importNode, `\nimport { ${typesToImport.join(', ')} } from 'constructs';`)); - - const specifiers = importNode.specifiers; - if (specifiers.length === typesToImport.length) { - fixes.push(fixer.removeRange(importNode.range)); - } else { - for (let i = 0; i < specifiers.length; i++) { - const s = specifiers[i]; - if (typesToImport.includes(s.imported.name)) { - if (i === specifiers.length - 1) { - fixes.push(fixer.removeRange([s.range[0] - 2, s.range[1]])); // include the leading comma - } else { - fixes.push(fixer.removeRange([s.range[0], s.range[1] + 2])); // include the trailing comma - } - } - } - } - importsFixed = true; - } - return fixes; - } - }); - } else { - return; - } - - function findImportNode(locaName: string): Node | undefined { - return BANNED_TYPES.map(typeName => { - const val = importCache.find({ fileName: context.getFilename(), typeName }); - if (val && val.localName === locaName) { - return val.importNode; - } - return undefined; - }).find(x => x !== undefined); - } - }, - } -} - -function isTestFile(filename: string) { - return new RegExp(/\/test\//).test(filename); -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/no-invalid-path.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/no-invalid-path.ts deleted file mode 100644 index f8dbd374a7e03..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/no-invalid-path.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Rule } from 'eslint'; -import * as path from 'path'; -import * as fs from 'fs'; - -function isPathJoinFuncCall(node: any): boolean { - return ( - node.callee?.property?.name === 'join' && - (node.parent?.expression?.callee?.object?.name === 'path' || - node.parent?.arguments?.some((a: any) => a.callee?.object?.name === 'path')) - ); -} - -function noArgumentVariables(node: any): boolean { - // Outside of the first argument, all arguments should be strings - const components = node.arguments.slice(1); - return components.every((a: any) => a.value !== undefined); -} - -function hasSlashes(args: string[]): boolean { - return args.some((a) => a.includes('/')); -} - -function firstArgIsDirname(node: any): boolean { - return node.arguments[0].name && node.arguments[0].name === '__dirname'; -} - -function argumentList(node: any): string[] { - // Already confirmed that first argument is '__dirname', so can safely remove it - const args: string[] = node.arguments.slice(1).map((a: any) => { return a.value; }); - return args; -} - -function recreatePath(args: string[]): string { - return `path.join(__dirname, '${args.join('\', \'')}')`; -} - -export function create(context: Rule.RuleContext): Rule.NodeListener { - return { - CallExpression(node: any) { - if (isPathJoinFuncCall(node)) { - if (node.arguments.length === 0) { - // ERROR: this is 'path.join()' - context.report({ node, message: '\'path.join()\' is not a valid path. You must specify arguments into the function.'}) - return; - } - - if (!noArgumentVariables(node)) { - // WARNING: unexpected non-string in the argument list. This happens if part of the argument list is a variable, i.e. `path.join(__dirname, myPath)`. - // We may be able to do something about this, but we currently are just going to let it pass. - return; - } - - // We currently do not lint any path.join without '__dirname' as the first argument - if (!firstArgIsDirname(node)) { - return; - } - - const args = argumentList(node); - - if (hasSlashes(args)) { - // ERROR: This path looks like 'path.join(__dirname, 'a/b')' and should be changed to 'path.join(__dirname, 'a', 'b')' - context.report({ node, message: `${recreatePath(args)} is not a valid path. It has '/' in the arguments which is not allowed. Each directory should be its own separate argument.`}); - return; - } - - const firstDownDir = args.findIndex((p) => p !== '..'); - - // Confirm path does not have any unnecessary '..' paths - // This allows us to validate subsequent checks - if (firstDownDir > 0 && args.some((p, i) => p === '..' && i > firstDownDir)) { - // ERROR: This path oscillates between up and down commands - context.report({ node, message: `${recreatePath(args)} is not a valid path. It goes backwards and forwards and backwards again, and can be simplified.`}); - return; - } - - // Exclude the case where there are no '..' at all in the path -- those are never invalid - const currentFile = context.getFilename(); - if (firstDownDir > 0) { - for (let i = 0; i < firstDownDir; i++) { - const pjFile = path.join(...[path.dirname(currentFile), ...args.slice(0, i), 'package.json']); - if (fs.existsSync(pjFile)) { - // ERROR: this path will end up going out of the package.json directory - context.report({ node, message: `${recreatePath(args)} is not a valid path. It goes beyond the parent library's package.json file so the file it points to will not be available after the library is packaged.`}); - return; - } - } - } - } - } - } -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/no-literal-partition.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/no-literal-partition.ts deleted file mode 100644 index 6573048881d8f..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/no-literal-partition.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Rule } from 'eslint'; -import { isProdFile } from '../private/is-prod-file'; - -export const meta = { - messages: { - hardcodedArn: 'There are more partitions than just \'aws\'. Silence this message if you are sure this is safe, or switch to using \'Aws.PARTITION\'', - }, -}; - -export function create(context: Rule.RuleContext): Rule.NodeListener { - return { - - // `node` is a type from @typescript-eslint/typescript-estree, but using 'any' for now - // since it's incompatible with eslint.Rule namespace. Waiting for better compatibility in - // https://github.com/typescript-eslint/typescript-eslint/tree/1765a178e456b152bd48192eb5db7e8541e2adf2/packages/experimental-utils#note - // Meanwhile, use a debugger to explore the AST node. - - Literal(node: any) { - if (!isProdFile(context.getFilename())) { - return; - } - - if (typeof node.value === 'string' && node.value.includes('arn:aws:')) { - context.report({ node, messageId: 'hardcodedArn' }); - } - }, - - TemplateLiteral(node: any) { - if (!isProdFile(context.getFilename())) { - return; - } - for (const quasi of node.quasis) { - const value = quasi.value.cooked; - - if (typeof value === 'string' && value.includes('arn:aws:')) { - context.report({ node: quasi, messageId: 'hardcodedArn' }); - } - } - } - } -} diff --git a/tools/@aws-cdk/eslint-plugin/lib/rules/promiseall-no-unbounded-parallelism.ts b/tools/@aws-cdk/eslint-plugin/lib/rules/promiseall-no-unbounded-parallelism.ts deleted file mode 100644 index 26aefc7b83c16..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/lib/rules/promiseall-no-unbounded-parallelism.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Rule } from 'eslint'; -import { matchIdentifier, matchMemberExpression } from '../private/type-checkers'; -import { match } from '../private/match-ast'; - -/** - * Get the programmer to acknowledge that `Promise.all()` is potentially dangerous. - * - * Since JavaScript is single-threaded, `Promise.all()` will only ever be used for - * I/O-bound tasks. However, I/O-parallelism isn't free either. Every async I/O-performing - * task launched will consume some FDs, and their amount is limited. If the amount - * of promises launched is a function of the input the program runs on, the system - * FDs might be exhausted. Some concurrency limit must be introduced. - * - * This linter rule exists to remind the programmer of that fact. It triggers - * on every `Promise.all()` invocation and cannot be resolved; the only solution - * is to think about it, and then silence this rule as proof that you thought about it. - * - * In summary, it's fine if: - * - * - The arguments to `Promise.all()` is a fixed set of promises; OR - * - The arguments to `Promise.all()` is throttled by a mechanism like 'p-limit' or - * similar. - * - * (This check is currently only in the CDK repo; it can benefit all TypeScript repos, - * we should introduce and publish a global lint rules package). - */ -export function create(context: Rule.RuleContext): Rule.NodeListener { - return { - CallExpression: node => { - if (match(node.callee, matchMemberExpression({ - object: matchIdentifier('Promise'), - property: matchIdentifier('all'), - }))) { - context.report({ - message: 'Ensure the number of awaited promises does not depend on program input, or their parallelism is limited using something like \'p-limit\' or similar. Acknowledge this message using \'// eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism\'', - node, - }); - } - }, - }; -} diff --git a/tools/@aws-cdk/eslint-plugin/package.json b/tools/@aws-cdk/eslint-plugin/package.json deleted file mode 100644 index fd53d24b13694..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@aws-cdk/eslint-plugin", - "private": true, - "version": "0.0.0", - "description": "ESLint plugin for private use within the AWS CDK repo", - "main": "lib/index.js", - "scripts": { - "build": "tsc --build", - "watch": "tsc -w", - "test": "jest", - "build+test+package": "npm run build+test", - "build+test": "npm run build && npm test", - "build+test+extract": "npm run build+test", - "build+extract": "npm run build" - }, - "devDependencies": { - "@types/eslint": "^7.29.0", - "@types/fs-extra": "^9.0.13", - "@types/jest": "^29.5.12", - "@types/estree": "*", - "jest": "^29.7.0", - "typescript": "~5.4.5" - }, - "dependencies": { - "@typescript-eslint/parser": "^6.21.0", - "eslint": "^7.32.0", - "fs-extra": "^9.1.0" - }, - "jest": { - "testMatch": [ - "**/*.test.js" - ] - }, - "keywords": [], - "author": "", - "license": "Apache-2.0" -} diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures.test.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures.test.ts deleted file mode 100644 index 7f382e0d92b97..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { ESLint } from 'eslint'; -import * as fs from 'fs-extra'; -import * as path from 'path'; - -let linter: ESLint; - -const outputRoot = path.join(process.cwd(), '.test-output'); -fs.mkdirpSync(outputRoot); - -const fixturesRoot = path.join(__dirname, 'fixtures'); - -fs.readdirSync(fixturesRoot).filter(f => fs.lstatSync(path.join(fixturesRoot, f)).isDirectory()).forEach(d => { - describe(d, () => { - const fixturesDir = path.join(fixturesRoot, d); - - beforeAll(() => { - linter = new ESLint({ - baseConfig: { - parser: '@typescript-eslint/parser', - }, - overrideConfigFile: path.join(fixturesDir, 'eslintrc.js'), - rulePaths: [ - path.join(__dirname, '..', '..', 'lib', 'rules'), - ], - fix: true, - }); - }); - - const outputDir = path.join(outputRoot, d); - fs.mkdirpSync(outputDir); - - const fixtureFiles = fs.readdirSync(fixturesDir).filter(f => f.endsWith('.ts') && !f.endsWith('.expected.ts')); - - fixtureFiles.forEach(f => { - it(f, async () => { - const originalFilePath = path.join(fixturesDir, f); - const expectedFixedFilePath = path.join(fixturesDir, `${path.basename(f, '.ts')}.expected.ts`); - const expectedErrorFilepath = path.join(fixturesDir, `${path.basename(f, '.ts')}.error.txt`); - const fix = fs.existsSync(expectedFixedFilePath); - const checkErrors = fs.existsSync(expectedErrorFilepath); - if (fix && checkErrors) { - fail(`Expected only a fixed file or an expected error message file. Both ${expectedFixedFilePath} and ${expectedErrorFilepath} are present.`); - } else if (fix) { - const actualFile = await lintAndFix(originalFilePath, outputDir); - const actual = await fs.readFile(actualFile, { encoding: 'utf8' }); - const expected = await fs.readFile(expectedFixedFilePath, { encoding: 'utf8' }); - if (actual !== expected) { - fail(`Linted file did not match expectations.\n--------- Expected ----------\n${expected}\n---------- Actual ----------\n${actual}`); - } - return; - } else if (checkErrors) { - const actualErrorMessages = await lint(originalFilePath) - const expectedErrorMessages = (await fs.readFile(expectedErrorFilepath, { encoding: 'utf8' })).split('\n'); - if (expectedErrorMessages.length !== actualErrorMessages?.length) { - fail(`Number of messages from linter did not match expectations. Linted file: ${originalFilePath}. Expected number of messages: ${expectedErrorMessages.length}. Actual number of messages: ${actualErrorMessages?.length}.`); - } - actualErrorMessages.forEach(actualMessage => { - if(!expectedErrorMessages.some(expectedMessage => actualMessage.message.includes(expectedMessage))) { - fail(`Error message not found in .error.txt file. Linted file: ${originalFilePath}. Actual message:\n${actualMessage.message}\nExpected messages:\n${expectedErrorMessages}`); - } - }); - return; - } else { - fail(`Expected fixed file or expected error file not found.`); - } - }); - }); - }); -}); - -async function lintAndFix(file: string, outputDir: string) { - const newPath = path.join(outputDir, path.basename(file)) - let result = await linter.lintFiles(file); - const hasFixes = result.find(r => typeof(r.output) === 'string') !== undefined; - if (hasFixes) { - await ESLint.outputFixes(result.map(r => { - r.filePath = newPath; - return r; - })); - } else { - // If there are no fixes, copy the input file as output - await fs.copyFile(file, newPath); - } - return newPath; -} - -async function lint(file: string) { - const result = await linter.lintFiles(file); - // If you only lint one file, then result.length will always be one. - if (result.length === 1) { - return result[0].messages; - } - return []; -} - -function fail(x: string) { - throw new Error(x); -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt deleted file mode 100644 index d7f4b5dd32a04..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.error.txt +++ /dev/null @@ -1 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, `CfnDeliveryStream` must be imported by name and separate from non-L1 imports, since it is being imported from an experimental package: @aws-cdk/aws-kinesisfirehose-alpha \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts deleted file mode 100644 index 37ade29fac2a4..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-constructor.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha'; - -const x = new firehose.CfnDeliveryStream(scope, 'id'); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.error.txt deleted file mode 100644 index 13d4577af0186..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.error.txt +++ /dev/null @@ -1 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, import of `CfnCluster` must be separate from import of `KafkaVersion`, and imported from its specific .generated location. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.ts deleted file mode 100644 index 91a8c0391cbd6..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-from-relative-path.ts +++ /dev/null @@ -1 +0,0 @@ -import { CfnCluster, KafkaVersion } from './'; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.error.txt deleted file mode 100644 index 575e1f9b65cf0..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.error.txt +++ /dev/null @@ -1 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, import of `CfnCluster` must be separate from import of `Cluster, ClusterParameterGroup, ClusterSubnetGroup, ClusterType`, and imported from its specific .generated location. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.ts deleted file mode 100644 index 33819842a63fa..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/cfn-import-mixed-with-other-imports.ts +++ /dev/null @@ -1 +0,0 @@ -import { CfnCluster, Cluster, ClusterParameterGroup, ClusterSubnetGroup, ClusterType } from '../lib'; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/eslintrc.js b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/eslintrc.js deleted file mode 100644 index 66cfe13718dc7..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['@aws-cdk'], - rules: { - '@aws-cdk/invalid-cfn-imports': [ 'error' ], - } -} diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt deleted file mode 100644 index b7b4785dfa504..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.error.txt +++ /dev/null @@ -1,2 +0,0 @@ -To allow rewriting imports when generating v2 experimental packages, `CfnTable` must be imported by name from its specific .generated location. -To allow rewriting imports when generating v2 experimental packages, `CfnDeliveryStream` must be imported by name and separate from non-L1 imports, since it is being imported from an experimental package: @aws-cdk/aws-kinesisfirehose-alpha \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts deleted file mode 100644 index 20d0e65608f37..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/invalid-cfn-imports/reference-cfn-construct-on-barrel-import.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha'; -import * as glue from '../lib'; - -let x: firehose.CfnDeliveryStream.CloudWatchLoggingOptionsProperty; -let y: glue.CfnTable; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.expected.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.expected.ts deleted file mode 100644 index 372f4d582d94c..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.expected.ts +++ /dev/null @@ -1,4 +0,0 @@ - -import { Construct as CoreConstruct } from 'constructs'; - -const x: CoreConstruct; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.ts deleted file mode 100644 index 110b268e5e71e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/aliased-import.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Construct as CoreConstruct } from '@aws-cdk/core'; - -const x: CoreConstruct; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.expected.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.expected.ts deleted file mode 100644 index 5512432ebde45..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.expected.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as cdk from '@aws-cdk/core' -import * as constructs from 'constructs'; -import * as somethingElse from 'somewhereElse'; - -const x: constructs.Construct; -const y: somethingElse.Things; -function fn1(z: constructs.Construct) {} - -const p: constructs.IConstruct; -function fn2(p: constructs.IConstruct) {} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.ts deleted file mode 100644 index 1dacae5a5ed3d..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/barrel-import.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as cdk from '@aws-cdk/core' -import * as somethingElse from 'somewhereElse'; - -const x: cdk.Construct; -const y: somethingElse.Things; -function fn1(z: cdk.Construct) {} - -const p: cdk.IConstruct; -function fn2(p: cdk.IConstruct) {} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/eslintrc.js b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/eslintrc.js deleted file mode 100644 index 435bd02e6623e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['@aws-cdk'], - rules: { - '@aws-cdk/no-core-construct': [ 'error' ], - } -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.expected.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.expected.ts deleted file mode 100644 index b6a0f17b4cd54..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.expected.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { AnImport } from '@aws-cdk/core'; -import { IConstruct, Construct } from 'constructs'; - -const x: Construct; -const y: Construct; - -const p: IConstruct; -function fn2(q: IConstruct); - -const a: AnImport; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.ts deleted file mode 100644 index e1754569c45de..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-not-tail.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { IConstruct, Construct, AnImport } from '@aws-cdk/core'; - -const x: Construct; -const y: Construct; - -const p: IConstruct; -function fn2(q: IConstruct); - -const a: AnImport; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.expected.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.expected.ts deleted file mode 100644 index 364cede2b9871..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.expected.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AnImport } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -const x: Construct; -const y: Construct \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.ts deleted file mode 100644 index 31ea93947685b..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import-tail.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { AnImport, Construct } from '@aws-cdk/core'; - -const x: Construct; -const y: Construct \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.expected.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.expected.ts deleted file mode 100644 index e30eedc9d7a68..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.expected.ts +++ /dev/null @@ -1,8 +0,0 @@ - -import { IConstruct, Construct } from 'constructs'; - -const x: Construct; -function fn1(y: Construct) {} - -const p: IConstruct; -function fn2(q: IConstruct); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.ts deleted file mode 100644 index 4e2df727269c4..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-core-construct/named-import.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { IConstruct, Construct } from '@aws-cdk/core'; - -const x: Construct; -function fn1(y: Construct) {} - -const p: IConstruct; -function fn2(q: IConstruct); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/eslintrc.js b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/eslintrc.js deleted file mode 100644 index 9ae156ccc1ced..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['@aws-cdk'], - rules: { - '@aws-cdk/no-invalid-path': [ 'error' ], - } -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.error.txt deleted file mode 100644 index 671706f27a204..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.error.txt +++ /dev/null @@ -1 +0,0 @@ -'path.join()' is not a valid path. You must specify arguments into the function. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.ts deleted file mode 100644 index 4cc707705fde1..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/no-path.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as path from 'path'; - -path.join(); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.error.txt deleted file mode 100644 index 304d6e7fb16d2..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.error.txt +++ /dev/null @@ -1 +0,0 @@ -path.join(__dirname, '..', '..', '..', '..', '..', 'cfn2ts', 'README.md') is not a valid path. It goes beyond the parent library's package.json file so the file it points to will not be available after the library is packaged. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.ts deleted file mode 100644 index 32592280df2c0..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-beyond-packagejson.ts +++ /dev/null @@ -1,4 +0,0 @@ -import path from 'path'; - -// depends on eslint-plugin to have a package.json -path.join(__dirname, '..', '..', '..', '..', '..', 'cfn2ts', 'README.md'); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.error.txt deleted file mode 100644 index fffe5d427cdf1..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.error.txt +++ /dev/null @@ -1 +0,0 @@ -path.join(__dirname, '..', '..', 'no-path-outside-module', '..', '..', 'fixtures.test.ts') is not a valid path. It goes backwards and forwards and backwards again, and can be simplified. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.ts deleted file mode 100644 index bce94ee028c4e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-oscillates.ts +++ /dev/null @@ -1,3 +0,0 @@ -import path from 'path'; - -path.join(__dirname, '..', '..', 'no-path-outside-module', '..', '..', 'fixtures.test.ts'); diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.error.txt deleted file mode 100644 index 4c9e26a535c1e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.error.txt +++ /dev/null @@ -1 +0,0 @@ -ath.join(__dirname, '../..', 'fixtures.test.ts') is not a valid path. It has '/' in the arguments which is not allowed. Each directory should be its own separate argument. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.ts deleted file mode 100644 index 1750443533fc9..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/path-with-slashes.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as path from 'path'; - -path.join(__dirname, '../..', 'fixtures.test.ts'); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.error.txt deleted file mode 100644 index 64e8b877be8a0..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.error.txt +++ /dev/null @@ -1 +0,0 @@ -path.join(__dirname, './asdf') is not a valid path. It has '/' in the arguments which is not allowed. Each directory should be its own separate argument. \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.ts deleted file mode 100644 index 72f86b4bc2d36..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-invalid-path/within-function.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as path from 'path'; - -function Myfunction(_a: string, _p: string) {} - -Myfunction('arg1', path.join(__dirname, './asdf')); \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/eslintrc.js b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/eslintrc.js deleted file mode 100644 index 7e37829be98b1..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['@aws-cdk'], - rules: { - '@aws-cdk/no-literal-partition': [ 'error' ], - } -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.error.txt deleted file mode 100644 index 999ba4085e413..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.error.txt +++ /dev/null @@ -1 +0,0 @@ -There are more partitions than just 'aws'. Silence this message if you are sure this is safe, or switch to using 'Aws.PARTITION' \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.ts deleted file mode 100644 index 2dae214834c87..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/literal-string.ts +++ /dev/null @@ -1 +0,0 @@ -const x = 'arn:aws:something'; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.error.txt deleted file mode 100644 index 999ba4085e413..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.error.txt +++ /dev/null @@ -1 +0,0 @@ -There are more partitions than just 'aws'. Silence this message if you are sure this is safe, or switch to using 'Aws.PARTITION' \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.ts deleted file mode 100644 index a3cb4643c7754..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-after.ts +++ /dev/null @@ -1,2 +0,0 @@ -const REGION = 'REGION'; -const x = `${REGION}:arn:aws:`; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.error.txt deleted file mode 100644 index 999ba4085e413..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.error.txt +++ /dev/null @@ -1 +0,0 @@ -There are more partitions than just 'aws'. Silence this message if you are sure this is safe, or switch to using 'Aws.PARTITION' \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.ts deleted file mode 100644 index 72a023a2283d5..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-before.ts +++ /dev/null @@ -1,2 +0,0 @@ -const REGION = 'REGION'; -const x = `arn:aws:${REGION}`; diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.error.txt deleted file mode 100644 index 999ba4085e413..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.error.txt +++ /dev/null @@ -1 +0,0 @@ -There are more partitions than just 'aws'. Silence this message if you are sure this is safe, or switch to using 'Aws.PARTITION' \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.ts deleted file mode 100644 index 49376c52bdd3d..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/no-literal-partition/template-solo.ts +++ /dev/null @@ -1 +0,0 @@ -const x = `arn:aws:something`; \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.error.txt b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.error.txt deleted file mode 100644 index d333fab5afc30..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.error.txt +++ /dev/null @@ -1 +0,0 @@ -Ensure the number of awaited promises does not depend on program input \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.ts b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.ts deleted file mode 100644 index 8dd6d5d0b857e..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/detect-promise-all.ts +++ /dev/null @@ -1,4 +0,0 @@ -async function main() { - // This is trivial and shouldn't count... but it's the best we can find right now. - return Promise.all([]); -} \ No newline at end of file diff --git a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/eslintrc.js b/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/eslintrc.js deleted file mode 100644 index 9a0d0b21ed5a2..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/test/rules/fixtures/promiseall-no-unbounded-parallelism/eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['@aws-cdk'], - rules: { - '@aws-cdk/promiseall-no-unbounded-parallelism': [ 'error' ], - } -} diff --git a/tools/@aws-cdk/eslint-plugin/tsconfig.json b/tools/@aws-cdk/eslint-plugin/tsconfig.json deleted file mode 100644 index a2b16f6290078..0000000000000 --- a/tools/@aws-cdk/eslint-plugin/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["es2020", "dom"], - "strict": true, - "alwaysStrict": true, - "declaration": true, - "inlineSourceMap": true, - "inlineSources": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "composite": true, - "incremental": true - }, - "include": ["**/*.ts"], - "exclude": ["node_modules", "**/fixtures"] -} diff --git a/tools/@aws-cdk/pkglint/.eslintrc.js b/tools/@aws-cdk/pkglint/.eslintrc.js index 061eb5b0a80c9..c59a431dad04b 100644 --- a/tools/@aws-cdk/pkglint/.eslintrc.js +++ b/tools/@aws-cdk/pkglint/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { plugins: [ '@typescript-eslint', 'import', - '@aws-cdk', + '@cdklabs', 'jest', ], parser: '@typescript-eslint/parser', diff --git a/tools/@aws-cdk/pkglint/package.json b/tools/@aws-cdk/pkglint/package.json index 283ebe603e5cf..e10451a01f3a9 100644 --- a/tools/@aws-cdk/pkglint/package.json +++ b/tools/@aws-cdk/pkglint/package.json @@ -37,7 +37,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/eslint-plugin": "0.0.0", + "@cdklabs/eslint-plugin": "^1.0.0", "@types/fs-extra": "^9.0.13", "@types/glob": "^7.2.0", "@types/jest": "^29.5.12", diff --git a/tools/@aws-cdk/spec2cdk/lib/cfn2ts/index.ts b/tools/@aws-cdk/spec2cdk/lib/cfn2ts/index.ts index 617979bdce6c1..a874956e1abca 100644 --- a/tools/@aws-cdk/spec2cdk/lib/cfn2ts/index.ts +++ b/tools/@aws-cdk/spec2cdk/lib/cfn2ts/index.ts @@ -164,7 +164,7 @@ export async function generateAll( ); const limit = pLimit(20); - // eslint-disable-next-line @aws-cdk/promiseall-no-unbounded-parallelism + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(Object.keys(moduleMap).map((moduleName) => limit(async () => { // Add generated resources and files to module in map moduleMap[moduleName].resources = generated.modules[moduleName].map((m) => m.resources).reduce(mergeObjects, {}); diff --git a/yarn.lock b/yarn.lock index b524b5075a12b..c9af6a333fcfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4691,6 +4691,13 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@cdklabs/eslint-plugin@^1.0.0": + version "1.0.0" + resolved "https://registry.npmjs.org/@cdklabs/eslint-plugin/-/eslint-plugin-1.0.0.tgz#3b0c79ccac1c13a35aa3fb81fd3cacc90cc1d8f0" + integrity sha512-R3HyeQqDMeYULyDPX5NqOf57m8gyJRHUEWDEQUjAqgKGrFUzcCND8Sus4o8uzn1b57qWYcQdNLWl+Q3lioT8Bg== + dependencies: + fs-extra "^11.2.0" + "@cdklabs/tskb@^0.0.3": version "0.0.3" resolved "https://registry.npmjs.org/@cdklabs/tskb/-/tskb-0.0.3.tgz#4b79846d9381eb1252ba85d5d20b7cd7d99b6ecb" @@ -7381,19 +7388,6 @@ dependencies: "@types/node" "*" -"@types/eslint@^7.29.0": - version "7.29.0" - resolved "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" - integrity sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*": - version "1.0.5" - resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== - "@types/fs-extra@^9.0.13": version "9.0.13" resolved "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" @@ -7448,7 +7442,7 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.9": +"@types/json-schema@^7.0.12", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==