Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch to using @cdklabs/eslint-plugin #31682

Merged
merged 5 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,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",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,15 @@ 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);

// 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('somewhat balance', async () => {

const keys = Object.keys(counters) as Array<keyof typeof counters> ;
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "4d5b294c39db24ed94c9ed774f730bf5be973c88a429f9754ea6461ae81fc3a7.zip"
"S3Key": "ea1d80e97fa5c08dbdf4ef5f6705b6bf49d07fbc05e7b4917b12359a44437b9d.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ 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);
}));
}

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);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent
*/
async function addTags(ssm: SSM, parameters: string[], keyName: string): Promise<void> {
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({
Expand All @@ -73,7 +73,7 @@ async function addTags(ssm: SSM, parameters: string[], keyName: string): Promise
*/
async function removeTags(ssm: SSM, parameters: string[], keyName: string): Promise<void> {
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({
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-appconfig/lib/application.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-events/test/rule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/core/lib/arn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',

/**
Expand All @@ -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',

/**
Expand All @@ -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',

/**
Expand All @@ -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',
}

Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Loading