Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kenoir committed Sep 15, 2023
1 parent 0a86d82 commit 6c74202
Show file tree
Hide file tree
Showing 45 changed files with 74 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/aspects/cfn-include-reporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("CfnIncludeReporter aspect", () => {
app.synth();

expect(warning).toHaveBeenCalledWith(
`As you're migrating a YAML/JSON template to ${LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`,
`As you're migrating a YAML/JSON template to ${LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/aspects/cfn-include-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CfnIncludeReporter implements IAspect {
public visit(node: IConstruct) {
if (node instanceof CfnInclude) {
Annotations.of(node).addWarning(
`As you're migrating a YAML/JSON template to ${LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`,
`As you're migrating a YAML/JSON template to ${LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/aspects/cfn-parameter-reporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("CfnParameterReporter aspect", () => {
app.synth();

expect(info).toHaveBeenCalledWith(
"Stack reads the SSM Parameter '/TEST/test/my-app/database-password'. Ensure it exists prior to deployment.",
"Stack reads the SSM Parameter '/TEST/test/my-app/database-password'. Ensure it exists prior to deployment."
);
});
});
2 changes: 1 addition & 1 deletion src/aspects/cfn-parameter-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class CfnParameterReporter implements IAspect {

if (isSsmParameter && hasDefault) {
Annotations.of(node.stack).addInfo(
`Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`,
`Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/aws-credential-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CredentialProviderChain } from "aws-sdk";
import AWS from "aws-sdk";

export const awsCredentialProviderChain: (profile: string | undefined) => CredentialProviderChain = (
profile: string | undefined,
profile: string | undefined
) => {
const envCredentials = () => new AWS.EnvironmentCredentials("AWS");

Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/account-readiness/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const accountReadinessCommand = async (props: AwsConfig): CliCommandRespo

if (report.parametersFound === 0) {
console.log(
`It looks like this account has not been set up for @guardian/cdk yet. See https://github.com/guardian/aws-account-setup`,
`It looks like this account has not been set up for @guardian/cdk yet. See https://github.com/guardian/aws-account-setup`
);

return 1;
Expand Down
6 changes: 3 additions & 3 deletions src/bin/commands/account-readiness/ssm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ssmParamReadiness = async ({ credentialProvider, region }: AwsConfig): Pro
});

const ssmParametersMatchingDefaultVpc = ssmParamsFromAccount.filter(
({ Value }) => Value && defaultVpcs.includes(Value),
({ Value }) => Value && defaultVpcs.includes(Value)
);

const defaultVPCReferencePaths = ssmParametersMatchingDefaultVpc
Expand Down Expand Up @@ -77,8 +77,8 @@ export const report = async (props: AwsConfig): Promise<Report> => {
errs.set(
"Default VPC referenced in VPC parameters",
`you should use a custom VPC instead. Default VPC is referenced in paths: ${output.defaultVPCReferences.join(
", ",
)}.`,
", "
)}.`
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/new-project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const newCdkProject = async (props: NewProjectProps): CliCommandResponse
["lib/** bin/**", "--ext .ts", "--no-error-on-unmatched-pattern", "--fix"],
{
cwd: config.cdkDir,
},
}
);

ux.action.start(chalk.yellow("Running lint check..."));
Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/new-project/utils/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AppBuilder {

stages.forEach((stage) => {
this.code.line(
`new ${appName.pascal}(app, "${appName.pascal}-${stage}", { stack: "${stack.kebab}", stage: "${stage}" });`,
`new ${appName.pascal}(app, "${appName.pascal}-${stage}", { stack: "${stack.kebab}", stage: "${stage}" });`
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/new-project/utils/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class TestBuilder {

this.code.line("const app = new App();");
this.code.line(
`const stack = new ${appName.pascal}(app, "${appName.pascal}", { stack: "${stackName.kebab}", stage: "TEST" });`,
`const stack = new ${appName.pascal}(app, "${appName.pascal}", { stack: "${stackName.kebab}", stage: "TEST" });`
);

this.code.line(`const template = Template.fromStack(stack);`);
Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/new-project/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function runTask(packageManager: PackageManager, cwd: string, task: string

export function getCommands(
packageManager: PackageManager,
cwd: string,
cwd: string
): {
installDependencies: () => Promise<string>;
lint: () => Promise<string>;
Expand Down
8 changes: 4 additions & 4 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const parseCommandLineArguments = () => {
.command(Commands.AccountReadiness, "Perform checks on an AWS account to see if it is GuCDK ready", (yargs) =>
yargs
.option("profile", { type: "string", description: "AWS profile" })
.option("region", { type: "string", description: "AWS region", default: "eu-west-1" }),
.option("region", { type: "string", description: "AWS region", default: "eu-west-1" })
)
.command(
Commands.New,
Expand Down Expand Up @@ -67,14 +67,14 @@ const parseCommandLineArguments = () => {
"The Node package manager to use. Match this to the repository (package-lock.json = npm, yarn.lock = yarn). If the repository has neither file, and there is no strong convention in your team, we recommend npm.",
choices: ["npm", "yarn"],
demandOption: true,
}),
})
)
.version(
`${LibraryInfo.VERSION} (using aws-cdk-lib ${LibraryInfo.AWS_CDK_VERSION}, constructs ${LibraryInfo.CONSTRUCTS_VERSION})`,
`${LibraryInfo.VERSION} (using aws-cdk-lib ${LibraryInfo.AWS_CDK_VERSION}, constructs ${LibraryInfo.CONSTRUCTS_VERSION})`
)
.demandCommand(1, "") // just print help
.help()
.alias("h", "help").argv,
.alias("h", "help").argv
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/constants/ssm-parameter-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ export const NAMED_SSM_PARAMETER_PATHS: NamedSsmParameterPaths = {
};

export const ALL_SSM_PARAMETER_PATHS: SsmParameterPath[] = Object.values(
NAMED_SSM_PARAMETER_PATHS,
NAMED_SSM_PARAMETER_PATHS
) as SsmParameterPath[];
4 changes: 2 additions & 2 deletions src/constructs/autoscaling/asg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class GuAutoScalingGroup extends GuAppAwareConstruct(AutoScalingGroup) {
// Ensure min and max are defined in the same way. Throwing an `Error` when necessary. For example when min is defined via a Mapping, but max is not.
if (Token.isUnresolved(minimumInstances) && !Token.isUnresolved(maximumInstances)) {
throw new Error(
"minimumInstances is defined via a Mapping, but maximumInstances is not. Create maximumInstances via a Mapping too.",
"minimumInstances is defined via a Mapping, but maximumInstances is not. Create maximumInstances via a Mapping too."
);
}

Expand Down Expand Up @@ -131,7 +131,7 @@ export class GuAutoScalingGroup extends GuAppAwareConstruct(AutoScalingGroup) {
// Note: Launch templates via CDK allow specifying only one SG, so use connections
// https://github.com/aws/aws-cdk/issues/18712
[GuWazuhAccess.getInstance(scope, vpc), ...additionalSecurityGroups].forEach((sg) =>
launchTemplate.connections.addSecurityGroup(sg),
launchTemplate.connections.addSecurityGroup(sg)
);

const asgProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/cloudwatch/alarm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("The GuAlarm class", () => {
{
OkActions: snsActionsCFN,
},
0,
0
);
});

Expand Down
4 changes: 2 additions & 2 deletions src/constructs/core/stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("The GuStack construct", () => {
{
stack: "test",
stage: "TEST",
},
}
);

new Role(stack, "MyRole", {
Expand All @@ -61,7 +61,7 @@ describe("The GuStack construct", () => {
{
stack: "test",
stage: "TEST",
},
}
);

expect(stack.repositoryName).toEqual("guardian/my-repository");
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class GuStack extends Stack implements StackStageIdentity {
return gitUrlParse(repositoryUrl).full_name;
} catch {
console.info(
`Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`,
`Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`
);
return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/dns/dns-records.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("The GuDnsRecordSet construct", () => {
ttl: Duration.hours(1),
});
}).toThrowError(
"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution.",
"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution."
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/dns/dns-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class GuDnsRecordSet extends Construct {
*/
if (resourceRecords.length !== 1) {
throw new Error(
"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution.",
"According to RFC, a CNAME record should not return multiple answers. Doing so may cause problems during resolution."
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/ec2/vpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class GuVpc {
* TODO: Understand VPCs and Subnets better and develop a better solution to this problem
*/
return subnets.map((subnetId) =>
Subnet.fromSubnetAttributes(scope, `subnet-${subnetId}`, { subnetId, routeTableId: " " }),
Subnet.fromSubnetAttributes(scope, `subnet-${subnetId}`, { subnetId, routeTableId: " " })
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/constructs/ecs/ecs-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class GuEcsTask extends Construct {

if (storage && storage < 21) {
throw new Error(
"Storage must be at least 21. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-ephemeralstorage.html",
"Storage must be at least 21. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-ephemeralstorage.html"
);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ export class GuEcsTask extends Construct {
const alarmTopic = Topic.fromTopicArn(
scope,
AppIdentity.suffixText(props, "AlarmTopic"),
monitoringConfiguration.snsTopicArn,
monitoringConfiguration.snsTopicArn
);
const alarms = [
{
Expand Down
8 changes: 4 additions & 4 deletions src/constructs/iam/policies/base-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("GuAllowPolicy", () => {
new GuAllowPolicy(stack, "AllowS3GetObject", {
actions: ["s3:GetObject"],
resources: ["*"],
}),
})
);

Template.fromStack(stack).hasResourceProperties("AWS::IAM::Policy", {
Expand All @@ -34,7 +34,7 @@ describe("GuAllowPolicy", () => {
new GuAllowPolicy(stack, "AllowS3GetObject", {
actions: ["s3:GetObject", "s3:ListBucket"],
resources: ["*"],
}),
})
);

Template.fromStack(stack).hasResourceProperties("AWS::IAM::Policy", {
Expand All @@ -60,7 +60,7 @@ describe("GuDenyPolicy", () => {
new GuDenyPolicy(stack, "DenyS3GetObject", {
actions: ["s3:GetObject"],
resources: ["*"],
}),
})
);

Template.fromStack(stack).hasResourceProperties("AWS::IAM::Policy", {
Expand All @@ -84,7 +84,7 @@ describe("GuDenyPolicy", () => {
new GuDenyPolicy(stack, "DenyS3GetObject", {
actions: ["s3:GetObject", "s3:ListBucket"],
resources: ["*"],
}),
})
);

Template.fromStack(stack).hasResourceProperties("AWS::IAM::Policy", {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/iam/policies/base-policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class GuAllowPolicy extends GuPolicy {
effect: Effect.ALLOW,
resources: props.resources,
actions: props.actions,
}),
})
);
}
}
Expand All @@ -41,7 +41,7 @@ export class GuDenyPolicy extends GuPolicy {
effect: Effect.DENY,
resources: props.resources,
actions: props.actions,
}),
})
);
}
}
4 changes: 2 additions & 2 deletions src/constructs/iam/roles/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export class GuGithubActionsRole extends GuRole {
{
StringLike: {
[`${GITHUB_ACTIONS_ID_TOKEN_REQUEST_DOMAIN}:sub`]: GuGithubActionsRepositoryCondition.toString(
props.condition ?? ALL_GUARDIAN_REPOSITORIES,
props.condition ?? ALL_GUARDIAN_REPOSITORIES
),
},
},
"sts:AssumeRoleWithWebIdentity",
"sts:AssumeRoleWithWebIdentity"
),
});

Expand Down
4 changes: 2 additions & 2 deletions src/constructs/loadbalancing/alb/application-listener.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("The GuApplicationListener class", () => {

GuTemplate.fromStack(stack).hasResourceWithLogicalId(
"AWS::ElasticLoadBalancingV2::Listener",
/ApplicationListenerTesting.+/,
/ApplicationListenerTesting.+/
);
});

Expand Down Expand Up @@ -115,7 +115,7 @@ describe("The GuHttpsApplicationListener class", () => {

GuTemplate.fromStack(stack).hasResourceWithLogicalId(
"AWS::ElasticLoadBalancingV2::Listener",
/^HttpsApplicationListenerTesting.+/,
/^HttpsApplicationListenerTesting.+/
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("The GuApplicationLoadBalancer class", () => {

GuTemplate.fromStack(stack).hasResourceWithLogicalId(
"AWS::ElasticLoadBalancingV2::LoadBalancer",
/^ApplicationLoadBalancerTesting.+/,
/^ApplicationLoadBalancerTesting.+/
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("The GuApplicationTargetGroup class", () => {

GuTemplate.fromStack(stack).hasResourceWithLogicalId(
"AWS::ElasticLoadBalancingV2::TargetGroup",
/^ApplicationTargetGroupTesting.+/,
/^ApplicationTargetGroupTesting.+/
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/constructs/ses/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("The GuEmailIdentity construct", () => {
app: "test",
});
}).toThrowError(
"Auto verification is only supported for certain domains. my-service.theguardian.com is not supported.",
"Auto verification is only supported for certain domains. my-service.theguardian.com is not supported."
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/constructs/stack-set/stack-set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("The GuStackSet construct", () => {
theStackSetInstance,
"central-topic",
new GuStringParameter(theStackSetInstance, "CentralSnsTopicArn", { allowedPattern: RegexPattern.ARN })
.valueAsString,
.valueAsString
);

const awsOrgId = "o-12345abcde";
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/vpc/vpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class GuVpc extends Vpc {
private static setAvailabilityZoneContext({ account, node }: GuStack) {
if (Token.isUnresolved(account)) {
throw new Error(
`Account ID not set - the resulting VPC might not be shaped how you'd expect. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html#env`,
`Account ID not set - the resulting VPC might not be shaped how you'd expect. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html#env`
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class GuFastlyKinesisLogRoleExperimental extends GuRole {
policyName ?? "GuKinesisPutRecordsPolicyExperimental",
{
stream,
},
}
);

policy.attachToRole(this);
Expand Down
4 changes: 2 additions & 2 deletions src/experimental/patterns/kinesis-lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ export class GuKinesisLambdaExperimental extends GuLambdaFunction {
? Stream.fromStreamArn(
scope,
existingKinesisStream.externalKinesisStreamName,
`arn:aws:kinesis:${region}:${account}:stream/${existingKinesisStream.externalKinesisStreamName}`,
`arn:aws:kinesis:${region}:${account}:stream/${existingKinesisStream.externalKinesisStreamName}`
)
: AppIdentity.taggedConstruct(
props,
new GuKinesisStream(scope, "KinesisStream", { encryption: StreamEncryption.MANAGED, ...kinesisStreamProps }),
new GuKinesisStream(scope, "KinesisStream", { encryption: StreamEncryption.MANAGED, ...kinesisStreamProps })
);

const errorHandlingPropsToAwsProps = toAwsErrorHandlingProps(props.errorHandlingConfiguration);
Expand Down
Loading

0 comments on commit 6c74202

Please sign in to comment.