Skip to content

Commit

Permalink
chore: Fix new import/order lint errors
Browse files Browse the repository at this point in the history
This version of eslint-plugin-import prefers `import` statements to appear before `import type`.

This change fixes these linting errors.

See:
  - import-js/eslint-plugin-import#2021
  • Loading branch information
akash1810 committed May 19, 2021
1 parent cd70547 commit bef3c0b
Show file tree
Hide file tree
Showing 78 changed files with 137 additions and 137 deletions.
2 changes: 1 addition & 1 deletion src/constructs/acm/certificate.test.ts
@@ -1,8 +1,8 @@
import { SynthUtils } from "@aws-cdk/assert";
import { Stage } from "../../constants";
import type { SynthedStack } from "../../utils/test";
import { simpleGuStackForTesting } from "../../utils/test";
import { GuCertificate } from "./certificate";
import type { SynthedStack } from "../../utils/test";

describe("The GuCertificate class", () => {
it("should create a new certificate when hosted zone ids are provided", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/acm/certificate.ts
@@ -1,12 +1,12 @@
import { Certificate, CertificateValidation } from "@aws-cdk/aws-certificatemanager";
import type { CertificateProps } from "@aws-cdk/aws-certificatemanager/lib/certificate";
import { HostedZone } from "@aws-cdk/aws-route53";
import { RemovalPolicy } from "@aws-cdk/core";
import { Stage } from "../../constants";
import { GuStatefulMigratableConstruct } from "../../utils/mixin";
import type { GuStack } from "../core";
import { AppIdentity } from "../core/identity";
import type { GuStack } from "../core";
import type { GuMigratingResource } from "../core/migrating";
import type { CertificateProps } from "@aws-cdk/aws-certificatemanager/lib/certificate";

export type GuCertificateProps = Record<Stage, GuDnsValidatedCertificateProps> & GuMigratingResource;
export type GuCertificatePropsWithApp = GuCertificateProps & AppIdentity;
Expand Down
6 changes: 3 additions & 3 deletions src/constructs/autoscaling/asg.test.ts
Expand Up @@ -5,14 +5,14 @@ import { InstanceType, UserData, Vpc } from "@aws-cdk/aws-ec2";
import { ApplicationProtocol } from "@aws-cdk/aws-elasticloadbalancingv2";
import { Stack } from "@aws-cdk/core";
import { Stage } from "../../constants";
import type { Resource, SynthedStack } from "../../utils/test";
import { findResourceByTypeAndLogicalId, simpleGuStackForTesting } from "../../utils/test";
import type { AppIdentity } from "../core/identity";
import { GuSecurityGroup } from "../ec2";
import { GuAllowPolicy, GuInstanceRole } from "../iam";
import { GuApplicationTargetGroup } from "../loadbalancing";
import type { GuAutoScalingGroupProps } from "./asg";
import { GuAutoScalingGroup } from "./";
import type { Resource, SynthedStack } from "../../utils/test";
import type { AppIdentity } from "../core/identity";
import type { GuAutoScalingGroupProps } from "./asg";

describe("The GuAutoScalingGroup", () => {
const vpc = Vpc.fromVpcAttributes(new Stack(), "VPC", {
Expand Down
10 changes: 5 additions & 5 deletions src/constructs/autoscaling/asg.ts
@@ -1,16 +1,16 @@
import type { AutoScalingGroupProps, CfnAutoScalingGroup } from "@aws-cdk/aws-autoscaling";
import { AutoScalingGroup } from "@aws-cdk/aws-autoscaling";
import type { ISecurityGroup, MachineImage, MachineImageConfig } from "@aws-cdk/aws-ec2";
import { InstanceType, OperatingSystemType, UserData } from "@aws-cdk/aws-ec2";
import type { ApplicationTargetGroup } from "@aws-cdk/aws-elasticloadbalancingv2";
import { Stage } from "../../constants";
import { GuStatefulMigratableConstruct } from "../../utils/mixin";
import type { GuStack } from "../core";
import { GuAmiParameter, GuInstanceTypeParameter } from "../core";
import { AppIdentity } from "../core/identity";
import type { GuMigratingResource } from "../core/migrating";
import { GuHttpsEgressSecurityGroup, GuWazuhAccess } from "../ec2";
import { GuInstanceRole } from "../iam";
import type { GuStack } from "../core";
import type { GuMigratingResource } from "../core/migrating";
import type { AutoScalingGroupProps, CfnAutoScalingGroup } from "@aws-cdk/aws-autoscaling";
import type { ISecurityGroup, MachineImage, MachineImageConfig } from "@aws-cdk/aws-ec2";
import type { ApplicationTargetGroup } from "@aws-cdk/aws-elasticloadbalancingv2";

// Since we want to override the types of what gets passed in for the below props,
// we need to use Omit<T, U> to remove them from the interface this extends
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/autoscaling/user-data.test.ts
Expand Up @@ -5,8 +5,8 @@ import { Stage } from "../../constants";
import { simpleGuStackForTesting } from "../../utils/test";
import { GuPrivateConfigBucketParameter } from "../core";
import { GuAutoScalingGroup } from "./asg";
import type { GuUserDataPropsWithApp } from "./user-data";
import { GuUserData } from "./user-data";
import type { GuUserDataPropsWithApp } from "./user-data";

describe("GuUserData", () => {
const vpc = Vpc.fromVpcAttributes(new Stack(), "VPC", {
Expand Down
6 changes: 3 additions & 3 deletions src/constructs/autoscaling/user-data.ts
@@ -1,12 +1,12 @@
import type { S3DownloadOptions } from "@aws-cdk/aws-ec2";
import { UserData } from "@aws-cdk/aws-ec2";
import { Bucket } from "@aws-cdk/aws-s3";
import type { GuDistributableForEc2 } from "../../types/distributable";
import { GuDistributable } from "../../types/distributable";
import { GuDistributionBucketParameter } from "../core";
import type { GuDistributableForEc2 } from "../../types/distributable";
import type { GuPrivateS3ConfigurationProps } from "../../utils/ec2";
import type { GuStack } from "../core";
import { GuDistributionBucketParameter } from "../core";
import type { AppIdentity } from "../core/identity";
import type { S3DownloadOptions } from "@aws-cdk/aws-ec2";

export type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;
export interface GuUserDataProps {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/cloudwatch/alarm.test.ts
Expand Up @@ -2,10 +2,10 @@ import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert";
import { ComparisonOperator } from "@aws-cdk/aws-cloudwatch";
import { Runtime } from "@aws-cdk/aws-lambda";
import type { SynthedStack } from "../../utils/test";
import { simpleGuStackForTesting } from "../../utils/test";
import { GuLambdaFunction } from "../lambda";
import { GuAlarm } from "./alarm";
import type { SynthedStack } from "../../utils/test";

describe("The GuAlarm class", () => {
it("should create a CloudWatch alarm", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/cloudwatch/alarm.ts
@@ -1,10 +1,10 @@
import type { AlarmProps } from "@aws-cdk/aws-cloudwatch";
import { Alarm } from "@aws-cdk/aws-cloudwatch";
import { SnsAction } from "@aws-cdk/aws-cloudwatch-actions";
import type { ITopic } from "@aws-cdk/aws-sns";
import { Topic } from "@aws-cdk/aws-sns";
import { Stage } from "../../constants";
import type { GuStack, GuStageDependentValue } from "../core";
import type { AlarmProps } from "@aws-cdk/aws-cloudwatch";
import type { ITopic } from "@aws-cdk/aws-sns";

export interface GuAlarmProps extends AlarmProps {
snsTopicName: string;
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/cloudwatch/ec2-alarms.test.ts
Expand Up @@ -3,9 +3,9 @@ import { SynthUtils } from "@aws-cdk/assert";
import { Vpc } from "@aws-cdk/aws-ec2";
import { Stack } from "@aws-cdk/core";
import { simpleGuStackForTesting } from "../../utils/test";
import type { AppIdentity } from "../core/identity";
import { GuApplicationLoadBalancer } from "../loadbalancing";
import { Gu5xxPercentageAlarm } from "./ec2-alarms";
import type { AppIdentity } from "../core/identity";

const vpc = Vpc.fromVpcAttributes(new Stack(), "VPC", {
vpcId: "test",
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/cloudwatch/ec2-alarms.ts
@@ -1,11 +1,11 @@
import { ComparisonOperator, MathExpression, TreatMissingData } from "@aws-cdk/aws-cloudwatch";
import { HttpCodeElb, HttpCodeTarget } from "@aws-cdk/aws-elasticloadbalancingv2";
import { Duration } from "@aws-cdk/core";
import { GuAlarm } from "./alarm";
import type { GuStack } from "../core";
import type { AppIdentity } from "../core/identity";
import type { GuApplicationLoadBalancer } from "../loadbalancing";
import type { GuAlarmProps } from "./alarm";
import { GuAlarm } from "./alarm";

export interface Gu5xxPercentageMonitoringProps
extends Omit<GuAlarmProps, "evaluationPeriods" | "metric" | "period" | "threshold" | "treatMissingData"> {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/cloudwatch/lambda-alarms.ts
@@ -1,9 +1,9 @@
import { ComparisonOperator, MathExpression, TreatMissingData } from "@aws-cdk/aws-cloudwatch";
import { Duration } from "@aws-cdk/core";
import { GuAlarm } from "./alarm";
import type { GuStack } from "../core";
import type { GuLambdaFunction } from "../lambda";
import type { GuAlarmProps } from "./alarm";
import { GuAlarm } from "./alarm";

export interface GuLambdaErrorPercentageMonitoringProps
extends Omit<GuAlarmProps, "metric" | "threshold" | "comparisonOperator" | "evaluationPeriods" | "treatMissingData"> {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/core/custom-resources/runtime/lambda.ts
@@ -1,9 +1,9 @@
import { request } from "https";
import { parse } from "url";
// eslint-disable-next-line import/no-unresolved -- this comes from @types/aws-lambda, but eslint can't seem to read it properly
import type { CloudFormationCustomResourceEvent, Context } from "aws-lambda";
import SSM from "aws-sdk/clients/ssm";
import type { CustomResourceGetParameterProps } from "../interfaces";
// eslint-disable-next-line import/no-unresolved -- this comes from @types/aws-lambda, but eslint can't seem to read it properly
import type { CloudFormationCustomResourceEvent, Context } from "aws-lambda";

/* eslint-disable -- This function is copied straight from AWS */
// https://github.com/aws/aws-cdk/blob/95438b56bfdc90e94f969f6998e5b5b680cbd7a8/packages/%40aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts#L16-L29
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/identity.ts
@@ -1,5 +1,5 @@
import type { IConstruct } from "@aws-cdk/core";
import { Tags } from "@aws-cdk/core";
import type { IConstruct } from "@aws-cdk/core";

export interface StackStageIdentity {
stack: string;
Expand Down
6 changes: 3 additions & 3 deletions src/constructs/core/migrating.test.ts
@@ -1,13 +1,13 @@
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert";
import type { BucketProps } from "@aws-cdk/aws-s3";
import { Bucket } from "@aws-cdk/aws-s3";
import { Annotations } from "@aws-cdk/core";
import type { GuStatefulConstruct } from "../../utils/mixin";
import type { SynthedStack } from "../../utils/test";
import { simpleGuStackForTesting } from "../../utils/test";
import { GuMigratingResource } from "./migrating";
import type { GuStatefulConstruct } from "../../utils/mixin";
import type { SynthedStack } from "../../utils/test";
import type { GuStack } from "./stack";
import type { BucketProps } from "@aws-cdk/aws-s3";

class TestGuStatefulConstruct extends Bucket implements GuStatefulConstruct {
isStatefulConstruct: true;
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/migrating.ts
@@ -1,6 +1,6 @@
import type { CfnElement, IConstruct } from "@aws-cdk/core";
import { Annotations } from "@aws-cdk/core";
import { isGuStatefulConstruct } from "../../utils/mixin";
import type { CfnElement, IConstruct } from "@aws-cdk/core";

export interface GuMigratingStack {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/acm.ts
@@ -1,7 +1,7 @@
import { RegexPattern } from "../../../constants";
import { AppIdentity } from "../identity";
import type { GuStack } from "../stack";
import { GuStringParameter } from "./base";
import type { GuStack } from "../stack";

export class GuCertificateArnParameter extends GuStringParameter {
constructor(scope: GuStack, props: AppIdentity) {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/base.test.ts
@@ -1,8 +1,8 @@
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert/lib/synth-utils";
import type { SynthedStack } from "../../../utils/test";
import { simpleGuStackForTesting } from "../../../utils/test";
import { GuArnParameter, GuParameter, GuStringParameter } from "./base";
import type { SynthedStack } from "../../../utils/test";

describe("The GuParameter class", () => {
it("sets the type as passed through by default", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/base.ts
@@ -1,8 +1,8 @@
import type { CfnParameterProps } from "@aws-cdk/core";
import { CfnParameter } from "@aws-cdk/core";
import { RegexPattern } from "../../../constants";
import type { AppIdentity } from "../identity";
import type { GuStack } from "../stack";
import type { CfnParameterProps } from "@aws-cdk/core";

export interface GuParameterProps extends CfnParameterProps {
fromSSM?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/ec2.test.ts
@@ -1,8 +1,8 @@
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert/lib/synth-utils";
import { simpleGuStackForTesting } from "../../../utils/test";
import type { SynthedStack } from "../../../utils/test";
import { GuInstanceTypeParameter } from "./ec2";
import type { SynthedStack } from "../../../utils/test";

describe("The GuInstanceTypeParameter class", () => {
it("should combine default, override and prop values", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/ec2.ts
@@ -1,7 +1,7 @@
import { AppIdentity } from "../identity";
import { GuParameter } from "./base";
import type { GuStack } from "../stack";
import type { GuNoTypeParameterPropsWithAppIdentity } from "./base";
import { GuParameter } from "./base";

export class GuInstanceTypeParameter extends GuParameter {
constructor(scope: GuStack, props: GuNoTypeParameterPropsWithAppIdentity) {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/identity.ts
@@ -1,6 +1,6 @@
import { Stage, Stages } from "../../../constants";
import type { GuStack } from "../stack";
import { GuStringParameter } from "./base";
import type { GuStack } from "../stack";

export class GuStageParameter extends GuStringParameter {
constructor(scope: GuStack) {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/log-shipping.ts
@@ -1,6 +1,6 @@
import { isSingletonPresentInStack } from "../../../utils/test";
import type { GuStack } from "../stack";
import { GuStringParameter } from "./base";
import type { GuStack } from "../stack";

export class GuLoggingStreamNameParameter extends GuStringParameter {
private static instance: GuStringParameter | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/s3.ts
@@ -1,6 +1,6 @@
import { isSingletonPresentInStack } from "../../../utils/test";
import type { GuStack } from "../stack";
import { GuStringParameter } from "./base";
import type { GuStack } from "../stack";

/**
* Creates a CloudFormation parameter which references the bucket used to store code artifacts.
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/ses.ts
@@ -1,6 +1,6 @@
import { RegexPattern } from "../../../constants";
import type { GuStack } from "../stack";
import { GuStringParameter } from "./base";
import type { GuStack } from "../stack";

export class GuGuardianEmailSenderParameter extends GuStringParameter {
constructor(scope: GuStack) {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/vpc.test.ts
@@ -1,8 +1,8 @@
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert/lib/synth-utils";
import type { SynthedStack } from "../../../utils/test";
import { simpleGuStackForTesting } from "../../../utils/test";
import { GuSubnetListParameter, GuVpcParameter } from "./vpc";
import type { SynthedStack } from "../../../utils/test";

describe("The GuSubnetListParameter class", () => {
it("should combine override and prop values", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/parameters/vpc.ts
@@ -1,6 +1,6 @@
import { GuParameter } from "./base";
import type { GuStack } from "../stack";
import type { GuNoTypeParameterProps } from "./base";
import { GuParameter } from "./base";

export class GuSubnetListParameter extends GuParameter {
constructor(scope: GuStack, id: string, props: GuNoTypeParameterProps) {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/core/ssm.ts
@@ -1,14 +1,14 @@
import { readFileSync } from "fs";
import { join } from "path";
import type { IGrantable, IPrincipal } from "@aws-cdk/aws-iam";
import { Policy, PolicyStatement } from "@aws-cdk/aws-iam";
import { Code, Runtime, SingletonFunction } from "@aws-cdk/aws-lambda";
import type { Reference } from "@aws-cdk/core";
import { Construct, CustomResource, Duration } from "@aws-cdk/core";
import { AwsCustomResourcePolicy } from "@aws-cdk/custom-resources";
import type { CustomResourceGetParameterProps } from "./custom-resources/interfaces";
import type { AppIdentity } from "./identity";
import type { GuStack } from "./stack";
import type { IGrantable, IPrincipal } from "@aws-cdk/aws-iam";
import type { Reference } from "@aws-cdk/core";

export interface GuSSMParameterProps {
parameter: string;
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/stack.test.ts
Expand Up @@ -8,9 +8,9 @@ import { Stage, Stages } from "../../constants";
import { ContextKeys } from "../../constants/context-keys";
import { TagKeys } from "../../constants/tag-keys";
import { simpleGuStackForTesting } from "../../utils/test";
import type { SynthedStack } from "../../utils/test";
import { GuParameter } from "./parameters";
import { GuStack } from "./stack";
import type { SynthedStack } from "../../utils/test";

describe("The GuStack construct", () => {
it("requires passing the stack value as props", function () {
Expand Down
6 changes: 3 additions & 3 deletions src/constructs/core/stack.ts
@@ -1,4 +1,3 @@
import type { App, StackProps } from "@aws-cdk/core";
import { Stack, Tags } from "@aws-cdk/core";
import execa from "execa";
import gitUrlParse from "git-url-parse";
Expand All @@ -7,12 +6,13 @@ import { ContextKeys } from "../../constants/context-keys";
import { TagKeys } from "../../constants/tag-keys";
import { TrackingTag } from "../../constants/tracking-tag";
import { Logger } from "../../utils/logger";
import { GuStageMapping } from "./mappings";
import { GuStageParameter } from "./parameters";
import type { StackStageIdentity } from "./identity";
import type { GuStageDependentValue } from "./mappings";
import { GuStageMapping } from "./mappings";
import type { GuMigratingStack } from "./migrating";
import type { GuParameter } from "./parameters";
import { GuStageParameter } from "./parameters";
import type { App, StackProps } from "@aws-cdk/core";

export interface GuStackProps extends StackProps, Partial<GuMigratingStack> {
stack: string;
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/ec2/security-groups/base.ts
@@ -1,9 +1,9 @@
import type { IPeer, SecurityGroupProps } from "@aws-cdk/aws-ec2";
import { Peer, Port, SecurityGroup } from "@aws-cdk/aws-ec2";
import { GuMigratableConstruct } from "../../../utils/mixin";
import type { GuStack } from "../../core";
import { AppIdentity } from "../../core/identity";
import type { GuStack } from "../../core";
import type { GuMigratingResource } from "../../core/migrating";
import type { IPeer, SecurityGroupProps } from "@aws-cdk/aws-ec2";

/**
* A way to describe an ingress or egress rule for a security group.
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/ec2/security-groups/wazuh.ts
@@ -1,9 +1,9 @@
import type { IVpc } from "@aws-cdk/aws-ec2";
import { Peer } from "@aws-cdk/aws-ec2";
import { isSingletonPresentInStack } from "../../../utils/test";
import type { GuStack } from "../../core";
import { GuMigratingResource } from "../../core/migrating";
import { GuBaseSecurityGroup } from "./base";
import type { GuStack } from "../../core";
import type { IVpc } from "@aws-cdk/aws-ec2";

/**
* A security group to allow a Wazuh agent on an EC2 instance to communicate with the outside.
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/ec2/vpc.test.ts
@@ -1,7 +1,7 @@
import { SynthUtils } from "@aws-cdk/assert";
import type { SynthedStack } from "../../utils/test";
import { simpleGuStackForTesting } from "../../utils/test";
import { GuVpc, SubnetType } from "./vpc";
import type { SynthedStack } from "../../utils/test";

describe("The GuVpc class", () => {
describe("subnets method", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/constructs/ec2/vpc.ts
@@ -1,7 +1,7 @@
import type { ISubnet, IVpc, VpcAttributes } from "@aws-cdk/aws-ec2";
import { Subnet, Vpc } from "@aws-cdk/aws-ec2";
import type { GuStack } from "../core";
import { GuSubnetListParameter, GuVpcParameter } from "../core";
import type { GuStack } from "../core";
import type { ISubnet, IVpc, VpcAttributes } from "@aws-cdk/aws-ec2";

interface VpcFromIdProps extends Omit<VpcAttributes, "availabilityZones"> {
availabilityZones?: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/iam/policies/assume-role.ts
@@ -1,7 +1,7 @@
import { Effect, PolicyStatement } from "@aws-cdk/aws-iam";
import { GuPolicy } from "./base-policy";
import type { GuStack } from "../../core";
import type { GuNoStatementsPolicyProps } from "./base-policy";
import { GuPolicy } from "./base-policy";

export interface GuAssumeRolePolicyProps extends GuNoStatementsPolicyProps {
resources: string[];
Expand Down

0 comments on commit bef3c0b

Please sign in to comment.