Skip to content

Commit f44209e

Browse files
authored
chore: enable unbound-method eslint rule (#33605)
Unbound method calls using `this` are likely to have unintended effects. Here is an example with static methods, but the same thing applies to object methods: ```ts class Class { public static staticMethod() { this.otherStaticMethod() } public static otherStaticMethod() { } } // ✅ valid Class.staticMethod(); // ❌ boom const x = Class.staticMethod; x(); ``` When assigning a method to a variable, you need to take extra care and this linter rule is going to remind you. This rule also catches a lot of cases were we meant to call a function but accidentally didn't: ```ts // Actual examples of unintentional code in our code base list.map(x => x.toString).join(', ') expect(x).toBeTruthy ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 127059e commit f44209e

File tree

47 files changed

+123
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+123
-101
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ customerDS.createResolver('MutationRemoveCustomer', {
178178
responseMappingTemplate: MappingTemplate.dynamoDbResultItem(),
179179
});
180180

181-
const ops = [
182-
{ suffix: 'Eq', op: KeyCondition.eq },
183-
{ suffix: 'Lt', op: KeyCondition.lt },
184-
{ suffix: 'Le', op: KeyCondition.le },
185-
{ suffix: 'Gt', op: KeyCondition.gt },
186-
{ suffix: 'Ge', op: KeyCondition.ge },
181+
const ops: Array<{ suffix: string; op: (x: string, y: string) => KeyCondition }> = [
182+
{ suffix: 'Eq', op: (x, y) => KeyCondition.eq(x, y) },
183+
{ suffix: 'Lt', op: (x, y) => KeyCondition.lt(x, y) },
184+
{ suffix: 'Le', op: (x, y) => KeyCondition.le(x, y) },
185+
{ suffix: 'Gt', op: (x, y) => KeyCondition.gt(x, y) },
186+
{ suffix: 'Ge', op: (x, y) => KeyCondition.ge(x, y) },
187187
];
188188
for (const { suffix, op } of ops) {
189189
orderDS.createResolver(`QueryGetCustomerOrders${suffix}`, {

packages/@aws-cdk/aws-eks-v2-alpha/lib/managed-nodegroup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ function getPossibleAmiTypes(instanceTypes: InstanceType[]): NodegroupAmiType[]
633633
const architectures: Set<AmiArchitecture> = new Set(instanceTypes.map(typeToArch));
634634

635635
if (architectures.size === 0) { // protective code, the current implementation will never result in this.
636-
throw new Error(`Cannot determine any ami type compatible with instance types: ${instanceTypes.map(i => i.toString).join(', ')}`);
636+
throw new Error(`Cannot determine any ami type compatible with instance types: ${instanceTypes.map(i => i.toString()).join(', ')}`);
637637
}
638638

639639
if (architectures.size > 1) {

packages/@aws-cdk/aws-glue-alpha/lib/triggers/workflow.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
137137
...options,
138138
workflowName: this.workflowName,
139139
type: 'ON_DEMAND',
140-
actions: options.actions?.map(this.renderAction),
140+
actions: options.actions?.map(this.renderAction.bind(this)),
141141
description: options.description || undefined,
142142
});
143143

@@ -162,7 +162,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
162162
...options,
163163
workflowName: this.workflowName,
164164
type: 'SCHEDULED',
165-
actions: options.actions?.map(this.renderAction),
165+
actions: options.actions?.map(this.renderAction.bind(this)),
166166
schedule: dailySchedule.expressionString,
167167
startOnCreation: options.startOnCreation ?? false,
168168
});
@@ -189,7 +189,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
189189
...options,
190190
workflowName: this.workflowName,
191191
type: 'SCHEDULED',
192-
actions: options.actions?.map(this.renderAction),
192+
actions: options.actions?.map(this.renderAction.bind(this)),
193193
schedule: weeklySchedule.expressionString,
194194
startOnCreation: options.startOnCreation ?? false,
195195
});
@@ -210,7 +210,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
210210
...options,
211211
workflowName: this.workflowName,
212212
type: 'SCHEDULED',
213-
actions: options.actions?.map(this.renderAction),
213+
actions: options.actions?.map(this.renderAction.bind(this)),
214214
schedule: options.schedule.expressionString,
215215
startOnCreation: options.startOnCreation ?? false,
216216
});
@@ -231,7 +231,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
231231
...options,
232232
workflowName: this.workflowName,
233233
type: 'EVENT',
234-
actions: options.actions?.map(this.renderAction),
234+
actions: options.actions?.map(this.renderAction.bind(this)),
235235
eventBatchingCondition: this.renderEventBatchingCondition(options),
236236
description: options.description ?? undefined,
237237
});
@@ -253,7 +253,7 @@ export abstract class WorkflowBase extends cdk.Resource implements IWorkflow {
253253
...options,
254254
workflowName: this.workflowName,
255255
type: 'CONDITIONAL',
256-
actions: options.actions?.map(this.renderAction),
256+
actions: options.actions?.map(this.renderAction.bind(this)),
257257
predicate: this.renderPredicate(options),
258258
eventBatchingCondition: this.renderEventBatchingCondition(options),
259259
description: options.description ?? undefined,

packages/@aws-cdk/aws-iot-alpha/test/topic-rule.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import { Template } from 'aws-cdk-lib/assertions';
23
import * as cdk from 'aws-cdk-lib';
34
import * as iot from '../lib';

packages/@aws-cdk/aws-kinesisanalytics-flink-alpha/test/application.test.ts

+25-25
Original file line numberDiff line numberDiff line change
@@ -857,31 +857,31 @@ describe('Application', () => {
857857

858858
// Table driven test with: [method, metricName, default statistic]
859859
const assertions: Array<[(options?: cloudwatch.MetricOptions) => cloudwatch.Metric, string, string]> = [
860-
[flinkApp.metricKpus, 'KPUs', 'Average'],
861-
[flinkApp.metricDowntime, 'downtime', 'Average'],
862-
[flinkApp.metricUptime, 'uptime', 'Average'],
863-
[flinkApp.metricFullRestarts, 'fullRestarts', 'Sum'],
864-
[flinkApp.metricNumberOfFailedCheckpoints, 'numberOfFailedCheckpoints', 'Sum'],
865-
[flinkApp.metricLastCheckpointDuration, 'lastCheckpointDuration', 'Maximum'],
866-
[flinkApp.metricLastCheckpointSize, 'lastCheckpointSize', 'Maximum'],
867-
[flinkApp.metricCpuUtilization, 'cpuUtilization', 'Average'],
868-
[flinkApp.metricHeapMemoryUtilization, 'heapMemoryUtilization', 'Average'],
869-
[flinkApp.metricOldGenerationGCTime, 'oldGenerationGCTime', 'Sum'],
870-
[flinkApp.metricOldGenerationGCCount, 'oldGenerationGCCount', 'Sum'],
871-
[flinkApp.metricThreadsCount, 'threadsCount', 'Average'],
872-
[flinkApp.metricNumRecordsIn, 'numRecordsIn', 'Average'],
873-
[flinkApp.metricNumRecordsInPerSecond, 'numRecordsInPerSecond', 'Average'],
874-
[flinkApp.metricNumRecordsOut, 'numRecordsOut', 'Average'],
875-
[flinkApp.metricNumRecordsOutPerSecond, 'numRecordsOutPerSecond', 'Average'],
876-
[flinkApp.metricNumLateRecordsDropped, 'numLateRecordsDropped', 'Sum'],
877-
[flinkApp.metricCurrentInputWatermark, 'currentInputWatermark', 'Maximum'],
878-
[flinkApp.metricCurrentOutputWatermark, 'currentOutputWatermark', 'Maximum'],
879-
[flinkApp.metricManagedMemoryUsed, 'managedMemoryUsed', 'Average'],
880-
[flinkApp.metricManagedMemoryTotal, 'managedMemoryTotal', 'Average'],
881-
[flinkApp.metricManagedMemoryUtilization, 'managedMemoryUtilization', 'Average'],
882-
[flinkApp.metricIdleTimeMsPerSecond, 'idleTimeMsPerSecond', 'Average'],
883-
[flinkApp.metricBackPressuredTimeMsPerSecond, 'backPressuredTimeMsPerSecond', 'Average'],
884-
[flinkApp.metricBusyTimePerMsPerSecond, 'busyTimePerMsPerSecond', 'Average'],
860+
[x => flinkApp.metricKpus(x), 'KPUs', 'Average'],
861+
[x => flinkApp.metricDowntime(x), 'downtime', 'Average'],
862+
[x => flinkApp.metricUptime(x), 'uptime', 'Average'],
863+
[x => flinkApp.metricFullRestarts(x), 'fullRestarts', 'Sum'],
864+
[x => flinkApp.metricNumberOfFailedCheckpoints(x), 'numberOfFailedCheckpoints', 'Sum'],
865+
[x => flinkApp.metricLastCheckpointDuration(x), 'lastCheckpointDuration', 'Maximum'],
866+
[x => flinkApp.metricLastCheckpointSize(x), 'lastCheckpointSize', 'Maximum'],
867+
[x => flinkApp.metricCpuUtilization(x), 'cpuUtilization', 'Average'],
868+
[x => flinkApp.metricHeapMemoryUtilization(x), 'heapMemoryUtilization', 'Average'],
869+
[x => flinkApp.metricOldGenerationGCTime(x), 'oldGenerationGCTime', 'Sum'],
870+
[x => flinkApp.metricOldGenerationGCCount(x), 'oldGenerationGCCount', 'Sum'],
871+
[x => flinkApp.metricThreadsCount(x), 'threadsCount', 'Average'],
872+
[x => flinkApp.metricNumRecordsIn(x), 'numRecordsIn', 'Average'],
873+
[x => flinkApp.metricNumRecordsInPerSecond(x), 'numRecordsInPerSecond', 'Average'],
874+
[x => flinkApp.metricNumRecordsOut(x), 'numRecordsOut', 'Average'],
875+
[x => flinkApp.metricNumRecordsOutPerSecond(x), 'numRecordsOutPerSecond', 'Average'],
876+
[x => flinkApp.metricNumLateRecordsDropped(x), 'numLateRecordsDropped', 'Sum'],
877+
[x => flinkApp.metricCurrentInputWatermark(x), 'currentInputWatermark', 'Maximum'],
878+
[x => flinkApp.metricCurrentOutputWatermark(x), 'currentOutputWatermark', 'Maximum'],
879+
[x => flinkApp.metricManagedMemoryUsed(x), 'managedMemoryUsed', 'Average'],
880+
[x => flinkApp.metricManagedMemoryTotal(x), 'managedMemoryTotal', 'Average'],
881+
[x => flinkApp.metricManagedMemoryUtilization(x), 'managedMemoryUtilization', 'Average'],
882+
[x => flinkApp.metricIdleTimeMsPerSecond(x), 'idleTimeMsPerSecond', 'Average'],
883+
[x => flinkApp.metricBackPressuredTimeMsPerSecond(x), 'backPressuredTimeMsPerSecond', 'Average'],
884+
[x => flinkApp.metricBusyTimePerMsPerSecond(x), 'busyTimePerMsPerSecond', 'Average'],
885885
];
886886

887887
assertions.forEach(([method, metricName, defaultStatistic]) => {

packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import * as child_process from 'child_process';
23
import * as os from 'os';
34
import * as path from 'path';

packages/@aws-cdk/aws-lambda-go-alpha/test/function.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import * as path from 'path';
23
import { Template } from 'aws-cdk-lib/assertions';
34
import { Runtime } from 'aws-cdk-lib/aws-lambda';

packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import * as fs from 'fs';
23
import * as path from 'path';
34
import { Architecture, Code, Runtime } from 'aws-cdk-lib/aws-lambda';

packages/@aws-cdk/aws-lambda-python-alpha/test/function.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import * as path from 'path';
23
import { Template } from 'aws-cdk-lib/assertions';
34
import { Code, Runtime, Architecture } from 'aws-cdk-lib/aws-lambda';

packages/@aws-cdk/aws-lambda-python-alpha/test/layer.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import * as path from 'path';
23
import { Runtime } from 'aws-cdk-lib/aws-lambda';
34
import { DockerImage, Stack } from 'aws-cdk-lib';

packages/@aws-cdk/aws-pipes-alpha/test/pipe.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ describe('Pipe', () => {
469469
expect(pipe.pipeRole).toBe(role);
470470
expect(source.grantRead).toHaveBeenCalledWith(role);
471471
expect(target.grantPush).toHaveBeenCalledWith(role);
472+
// eslint-disable-next-line @typescript-eslint/unbound-method
472473
expect(enrichment.grantInvoke).toHaveBeenCalledWith(role);
473474
});
474475

packages/@aws-cdk/integ-runner/test/workers/snapshot-worker.test.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as child_process from 'child_process';
21
import * as path from 'path';
32
import * as fs from 'fs-extra';
43
import { snapshotTestWorker } from '../../lib/workers/extract';
@@ -33,7 +32,6 @@ describe('Snapshot tests', () => {
3332

3433
test('has snapshot', () => {
3534
// WHEN
36-
jest.spyOn(child_process, 'spawnSync').mockResolvedValue;
3735
const test = {
3836
fileName: path.join(directory, 'xxxxx.test-with-snapshot.js'),
3937
discoveryRoot: directory,
@@ -46,7 +44,6 @@ describe('Snapshot tests', () => {
4644

4745
test('failed snapshot', () => {
4846
// WHEN
49-
jest.spyOn(child_process, 'spawnSync').mockRejectedValue;
5047
const test = {
5148
fileName: path.join(directory, 'xxxxx.test-with-snapshot-assets-diff.js'),
5249
discoveryRoot: directory,

packages/aws-cdk-lib/aws-backup/lib/plan.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class BackupPlan extends Resource implements IBackupPlan {
200200
});
201201
}
202202

203-
private planCopyActions(props: BackupPlanCopyActionProps): CfnBackupPlan.CopyActionResourceTypeProperty {
203+
private planCopyActions(this: void, props: BackupPlanCopyActionProps): CfnBackupPlan.CopyActionResourceTypeProperty {
204204
return {
205205
destinationBackupVaultArn: props.destinationBackupVault.backupVaultArn,
206206
lifecycle: (props.deleteAfter || props.moveToColdStorageAfter) && {

packages/aws-cdk-lib/aws-cloudfront/lib/geo-restriction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class GeoRestriction {
1111
* that you want to allow. Include one element for each country.
1212
* See ISO 3166-1-alpha-2 code on the *International Organization for Standardization* website
1313
*/
14-
public static allowlist(...locations: string[]) {
14+
public static allowlist(this: void, ...locations: string[]) {
1515
return new GeoRestriction('whitelist', GeoRestriction.validateLocations(locations));
1616
}
1717

@@ -22,7 +22,7 @@ export class GeoRestriction {
2222
* that you want to deny. Include one element for each country.
2323
* See ISO 3166-1-alpha-2 code on the *International Organization for Standardization* website
2424
*/
25-
public static denylist(...locations: string[]) {
25+
public static denylist(this: void, ...locations: string[]) {
2626
return new GeoRestriction('blacklist', GeoRestriction.validateLocations(locations));
2727
}
2828

packages/aws-cdk-lib/aws-config/lib/rule.ts

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ export class CustomRule extends RuleNew {
449449
}
450450
const hash = createHash('sha256')
451451
.update(JSON.stringify({
452+
/* eslint-disable-next-line @typescript-eslint/unbound-method *//* REMOVEME: this is a latent bug */
452453
fnName: props.lambdaFunction.functionName.toString,
453454
accountId: Stack.of(this).resolve(this.env.account),
454455
region: Stack.of(this).resolve(this.env.region),

packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -655,42 +655,42 @@ export class InitPackage extends InitElement {
655655
/**
656656
* Install an RPM from an HTTP URL or a location on disk
657657
*/
658-
public static rpm(location: string, options: LocationPackageOptions = {}): InitPackage {
658+
public static rpm(this: void, location: string, options: LocationPackageOptions = {}): InitPackage {
659659
return new InitPackage('rpm', [location], options.key, options.serviceRestartHandles);
660660
}
661661

662662
/**
663663
* Install a package using Yum
664664
*/
665-
public static yum(packageName: string, options: NamedPackageOptions = {}): InitPackage {
665+
public static yum(this: void, packageName: string, options: NamedPackageOptions = {}): InitPackage {
666666
return new InitPackage('yum', options.version ?? [], packageName, options.serviceRestartHandles);
667667
}
668668

669669
/**
670670
* Install a package from RubyGems
671671
*/
672-
public static rubyGem(gemName: string, options: NamedPackageOptions = {}): InitPackage {
672+
public static rubyGem(this: void, gemName: string, options: NamedPackageOptions = {}): InitPackage {
673673
return new InitPackage('rubygems', options.version ?? [], gemName, options.serviceRestartHandles);
674674
}
675675

676676
/**
677677
* Install a package from PyPI
678678
*/
679-
public static python(packageName: string, options: NamedPackageOptions = {}): InitPackage {
679+
public static python(this: void, packageName: string, options: NamedPackageOptions = {}): InitPackage {
680680
return new InitPackage('python', options.version ?? [], packageName, options.serviceRestartHandles);
681681
}
682682

683683
/**
684684
* Install a package using APT
685685
*/
686-
public static apt(packageName: string, options: NamedPackageOptions = {}): InitPackage {
686+
public static apt(this: void, packageName: string, options: NamedPackageOptions = {}): InitPackage {
687687
return new InitPackage('apt', options.version ?? [], packageName, options.serviceRestartHandles);
688688
}
689689

690690
/**
691691
* Install an MSI package from an HTTP URL or a location on disk
692692
*/
693-
public static msi(location: string, options: LocationPackageOptions = {}): InitPackage {
693+
public static msi(this: void, location: string, options: LocationPackageOptions = {}): InitPackage {
694694
// The MSI package version must be a string, not an array.
695695
return new class extends InitPackage {
696696
protected renderPackageVersions() { return location; }

packages/aws-cdk-lib/aws-ec2/test/ip-addresses.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ describe('Cidr vpc allocation', () => {
1212

1313
test('Default Cidr returns ipv4IpamPoolId as undefined', () => {
1414
const ipAddresses = IpAddresses.cidr('10.0.0.0/16');
15-
expect(ipAddresses.allocateVpcCidr().ipv4IpamPoolId).toBeUndefined;
15+
expect(ipAddresses.allocateVpcCidr().ipv4IpamPoolId).toBeUndefined();
1616
});
1717

1818
test('Default Cidr returns ipv4NetmaskLength as undefined', () => {
1919
const ipAddresses = IpAddresses.cidr('10.0.0.0/16');
20-
expect(ipAddresses.allocateVpcCidr().ipv4NetmaskLength).toBeUndefined;
20+
expect(ipAddresses.allocateVpcCidr().ipv4NetmaskLength).toBeUndefined();
2121
});
2222
});
2323

@@ -102,7 +102,7 @@ describe('AwsIpam vpc allocation', () => {
102102

103103
test('AwsIpam returns cidrBlock as undefined', () => {
104104
const ipAddresses = IpAddresses.awsIpamAllocation(awsIpamProps);
105-
expect(ipAddresses.allocateVpcCidr().cidrBlock).toBeUndefined;
105+
expect(ipAddresses.allocateVpcCidr().cidrBlock).toBeUndefined();
106106
});
107107

108108
test('AwsIpam returns the correct vpc ipv4IpamPoolId', () => {

packages/aws-cdk-lib/aws-ec2/test/vpc.from-lookup.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ interface MockVpcContextResponse {
380380
function mockVpcContextProviderWith(
381381
response: MockVpcContextResponse,
382382
paramValidator?: (options: cxschema.VpcContextQuery) => void) {
383+
// eslint-disable-next-line @typescript-eslint/unbound-method
383384
const previous = ContextProvider.getValue;
384385
ContextProvider.getValue = (_scope: Construct, options: GetContextValueOptions) => {
385386
// do some basic sanity checks

packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ describe('ApplicationLoadBalancedFargateService', () => {
710710
// THEN
711711
expect(() => {
712712
service.internalDesiredCount;
713-
}).toBeTruthy;
713+
}).toBeTruthy();
714714
});
715715

716716
test('multiple capacity provider strategies are set', () => {

packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import { testDeprecated } from '@aws-cdk/cdk-build-tools';
23
import { Annotations, Match, Template } from '../../assertions';
34
import * as autoscaling from '../../aws-autoscaling';

packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-task-definition.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ describe('fargate task definition', () => {
352352
// THEN
353353
expect(() => {
354354
taskDefinition.ephemeralStorageGiB;
355-
}).toBeTruthy;
355+
}).toBeTruthy();
356356
});
357357

358358
test('runtime testing for windows container', () => {

packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ function getPossibleAmiTypes(instanceTypes: InstanceType[]): NodegroupAmiType[]
646646
const architectures: Set<AmiArchitecture> = new Set(instanceTypes.map(typeToArch));
647647

648648
if (architectures.size === 0) { // protective code, the current implementation will never result in this.
649-
throw new Error(`Cannot determine any ami type compatible with instance types: ${instanceTypes.map(i => i.toString).join(', ')}`);
649+
throw new Error(`Cannot determine any ami type compatible with instance types: ${instanceTypes.map(i => i.toString()).join(', ')}`);
650650
}
651651

652652
if (architectures.size > 1) {

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ export class ListenerCertificate implements IListenerCertificate {
1717
/**
1818
* Use an ACM certificate as a listener certificate
1919
*/
20-
public static fromCertificateManager(acmCertificate: acm.ICertificate) {
20+
public static fromCertificateManager(this: void, acmCertificate: acm.ICertificate) {
2121
return new ListenerCertificate(acmCertificate.certificateArn);
2222
}
2323

2424
/**
2525
* Use any certificate, identified by its ARN, as a listener certificate
2626
*/
27-
public static fromArn(certificateArn: string) {
27+
public static fromArn(this: void, certificateArn: string) {
2828
return new ListenerCertificate(certificateArn);
2929
}
3030

packages/aws-cdk-lib/aws-iam/lib/principals.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ export class ComparablePrincipal {
9292
/**
9393
* Whether or not the given principal is a comparable principal
9494
*/
95-
public static isComparablePrincipal(x: IPrincipal): x is IComparablePrincipal {
95+
public static isComparablePrincipal(this: void, x: IPrincipal): x is IComparablePrincipal {
9696
return 'dedupeString' in x;
9797
}
9898

9999
/**
100100
* Return the dedupeString of the given principal, if available
101101
*/
102-
public static dedupeStringFor(x: IPrincipal): string | undefined {
102+
public static dedupeStringFor(this: void, x: IPrincipal): string | undefined {
103103
return ComparablePrincipal.isComparablePrincipal(x) ? x.dedupeString() : undefined;
104104
}
105105
}

0 commit comments

Comments
 (0)