diff --git a/.gitignore b/.gitignore index 17ba70d7ac568..2f2092ed1a333 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # VSCode extension -.vscode/ /.favorites.json # TypeScript incremental build states diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000..676c7b4ff8b61 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "eslint.workingDirectories": [ + { "pattern": "./packages/@aws-cdk/*" }, + { "pattern": "./packages/@monocdk-experiment/*" }, + { "pattern": "./packages/*" }, + { "pattern": "./tools/*" } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e0f427499887..c3531cc3cc13a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -287,19 +287,9 @@ All packages in the repo use a standard base configuration found at [eslintrc.js This can be customized for any package by modifying the `.eslintrc` file found at its root. If you're using the VS Code and would like to see eslint violations on it, install the [eslint -extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint). - -The following additional [VS Code setting](https://code.visualstudio.com/docs/getstarted/settings) is required when the -entire project is opened (not required if only a specific module is opened) - - -```json -"eslint.workingDirectories": [ - { "pattern": "./packages/@aws-cdk/*" }, - { "pattern": "./packages/@monocdk-experiment/*" }, - { "pattern": "./packages/*" }, - { "pattern": "./tools/*" }, -], -``` +extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint). The VS Code setting [needed for +the extension to work](https://github.com/Microsoft/vscode-eslint#settings-options) on the monorepo is configured in +the [folder settings](https://code.visualstudio.com/docs/editor/multi-root-workspaces#_settings). #### pkglint diff --git a/packages/@aws-cdk/aws-ec2/lib/instance.ts b/packages/@aws-cdk/aws-ec2/lib/instance.ts index cbac936427ab7..1cd3d73a62c9f 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance.ts @@ -291,7 +291,7 @@ export class Instance extends Resource implements IInstance { if (selected.length === 1) { subnet = selected[0]; } else { - throw new Error('When specifying AZ there has to be exactly one subnet of the given type in this az'); + throw new Error(`Need exactly 1 subnet to match AZ '${props.availabilityZone}', found ${selected.length}. Use a different availabilityZone.`); } } else { subnet = subnets[0]; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index a7fa786066abb..0ad96716bd562 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -1910,13 +1910,13 @@ const DUMMY_VPC_PROPS: cxapi.VpcContextResponse = { type: cxapi.VpcSubnetGroupType.PUBLIC, subnets: [ { - availabilityZone: 'dummy-1a', + availabilityZone: 'dummy1a', subnetId: 's-12345', routeTableId: 'rtb-12345s', cidr: '1.2.3.4/5', }, { - availabilityZone: 'dummy-1b', + availabilityZone: 'dummy1b', subnetId: 's-67890', routeTableId: 'rtb-67890s', cidr: '1.2.3.4/5', @@ -1928,13 +1928,13 @@ const DUMMY_VPC_PROPS: cxapi.VpcContextResponse = { type: cxapi.VpcSubnetGroupType.PRIVATE, subnets: [ { - availabilityZone: 'dummy-1a', + availabilityZone: 'dummy1a', subnetId: 'p-12345', routeTableId: 'rtb-12345p', cidr: '1.2.3.4/5', }, { - availabilityZone: 'dummy-1b', + availabilityZone: 'dummy1b', subnetId: 'p-67890', routeTableId: 'rtb-57890p', cidr: '1.2.3.4/5', diff --git a/packages/@aws-cdk/aws-ec2/test/test.vpc.from-lookup.ts b/packages/@aws-cdk/aws-ec2/test/test.vpc.from-lookup.ts index 956f88f0aad0a..0c88693f1e7db 100644 --- a/packages/@aws-cdk/aws-ec2/test/test.vpc.from-lookup.ts +++ b/packages/@aws-cdk/aws-ec2/test/test.vpc.from-lookup.ts @@ -172,6 +172,22 @@ export = { restoreContextProvider(previous); test.done(); }, + + 'AZ in dummy lookup VPC matches AZ in Stack'(test: Test) { + // GIVEN + const stack = new Stack(undefined, 'MyTestStack', { env: { account: '1234567890', region: 'dummy' } }); + const vpc = Vpc.fromLookup(stack, 'vpc', { isDefault: true }); + + // WHEN + const subnets = vpc.selectSubnets({ + availabilityZones: stack.availabilityZones, + }); + + // THEN + test.equals(subnets.subnets.length, 2); + + test.done(); + }, }, }; diff --git a/packages/@aws-cdk/cloud-assembly-schema/package.json b/packages/@aws-cdk/cloud-assembly-schema/package.json index d8ba6872b2381..063bd6d0d1090 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/package.json +++ b/packages/@aws-cdk/cloud-assembly-schema/package.json @@ -40,13 +40,6 @@ "compat": "cdk-compat", "update-schema": "bash scripts/update-schema.sh" }, - "cdk-build": { - "eslint": { - "ignore-pattern": [ - "scripts/*" - ] - } - }, "author": { "name": "Amazon Web Services", "url": "https://aws.amazon.com", diff --git a/tools/cfn2ts/package.json b/tools/cfn2ts/package.json index 712832bfc0403..1fc6b8fd231cf 100644 --- a/tools/cfn2ts/package.json +++ b/tools/cfn2ts/package.json @@ -43,13 +43,6 @@ "jest": "^25.5.0", "pkglint": "0.0.0" }, - "cdk-build": { - "eslint": { - "ignore-pattern": [ - "test/enrichments/*.ts" - ] - } - }, "keywords": [ "aws", "cdk"