Skip to content

Commit

Permalink
build(awslint): include types from submodules during linting (#27160)
Browse files Browse the repository at this point in the history
Various fixes to awslint. Also adds new exclusions to prevent existing lint errors from failing the build - will address these errors in a follow-up. Linter config, including exclusions, has been moved into a new file `awslint.json`. If this file does not exist, the linter will continue reading and updating the config in `package.json`. Fixes #26839.

Linter changes:
- Include symbols from submodules by using e.g. `assembly.allClasses` instead of `assembly.classes`
- Fix FQNs in the construct linter by including the submodule name
- Use `cloudformationResource` tag (added in cdklabs/awscdk-service-spec#538) to store CFN resource ID when generating L1 constructs. This is used in the CFN resource linter.
- Fix `core-types.ts` to use new package names
- Ignore version suffixes when guessing resource names in `packages/awslint/lib/rules/resource.ts`

The change in `aws-apigateway/lib/resource.ts` is an example of a `props-physical-name` fix.

Breakdown of new linter errors:
```
docs-public-apis: 2308
props-default-doc: 214
props-physical-name: 106
attribute-tag: 13
construct-interface-extends-iconstruct: 8
resource-interface-extends-resource: 8
from-method: 8
props-no-cfn-types: 7
ref-via-interface: 5
from-signature: 4
construct-ctor-props-optional: 3
props-no-arn-refs: 3
props-no-any: 2
integ-return-type: 2
module-name: 1
construct-ctor: 1
props-struct-name: 1
construct-ctor-props-type: 1
no-static-import: 1
public-static-props-all-caps: 1
Total: 2697
```

### Tasks
- [x] Push cdklabs/awscdk-service-spec#538 before merging

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mikewrighton authored Sep 22, 2023
1 parent 193cd3f commit 5ae9099
Show file tree
Hide file tree
Showing 90 changed files with 3,071 additions and 349 deletions.
6 changes: 6 additions & 0 deletions packages/@aws-cdk/app-staging-synthesizer-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"exclude": [
"construct-ctor:@aws-cdk/app-staging-synthesizer-alpha.DefaultStagingStack.<initializer>.params[0]",
"props-no-arn-refs:@aws-cdk/app-staging-synthesizer-alpha.DefaultStagingStackProps.deployRoleArn"
]
}
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-amplify-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@
},
"stability": "experimental",
"maturity": "experimental",
"awslint": {
"exclude": [
"*:*"
]
},
"awscdkio": {
"announce": false
},
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-apigatewayv2-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"features": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@
"tag": "latest"
},
"private": false,
"awslint": {
"exclude": [
"*:*"
]
},
"pkglint": {
"exclude": [
"naming/package-matches-directory",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@
"publishConfig": {
"tag": "latest"
},
"awslint": {
"exclude": [
"*:*"
]
},
"pkglint": {
"exclude": [
"naming/package-matches-directory",
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-appconfig-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-appconfig-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@
},
"stability": "experimental",
"maturity": "experimental",
"awslint": {
"exclude": [
"*:*"
]
},
"awscdkio": {
"announce": false
},
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-apprunner-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-apprunner-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@
"tag": "latest"
},
"private": false,
"awslint": {
"exclude": [
"*:*"
]
},
"pkglint": {
"exclude": [
"naming/package-matches-directory",
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-cloud9-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-cloud9-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-codestar-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-codestar-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-cognito-identitypool-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-gamelift-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-gamelift-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-glue-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-glue-alpha/lib/external-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ExternalTableProps extends TableBaseProps {

/**
* A Glue table that targets an external data location (e.g. A table in a Redshift Cluster).
* @resource AWS::Glue::Table
*/
export class ExternalTable extends TableBase {
/**
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-glue-alpha/lib/s3-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface S3TableProps extends TableBaseProps {

/**
* A Glue table that targets a S3 dataset.
* @resource AWS::Glue::Table
*/
export class S3Table extends TableBase {
/**
Expand Down
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-glue-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
},
"stability": "experimental",
"maturity": "experimental",
"awslint": {
"exclude": [
"*:*"
]
},
"awscdkio": {
"announce": false
},
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-iot-actions-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-iot-actions-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@
"tag": "latest"
},
"private": false,
"awslint": {
"exclude": [
"*:*"
]
},
"pkglint": {
"exclude": [
"naming/package-matches-directory",
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-iot-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-iot-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-iotevents-actions-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-iotevents-actions-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@
"tag": "latest"
},
"private": false,
"awslint": {
"exclude": [
"*:*"
]
},
"pkglint": {
"exclude": [
"naming/package-matches-directory",
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-iotevents-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-iotevents-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-ivs-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-ivs-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
}
}
},
"awslint": {
"exclude": [
"*:*"
]
},
"repository": {
"type": "git",
"url": "https://github.com/aws/aws-cdk.git",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@
"engines": {
"node": ">= 14.15.0"
},
"awslint": {
"exclude": [
"*:*"
]
},
"stability": "experimental",
"maturity": "experimental",
"awscdkio": {
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-kinesisfirehose-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-kinesisfirehose-alpha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@
"publishConfig": {
"tag": "latest"
},
"awslint": {
"exclude": [
"*:*"
]
},
"jsiiRosetta": {
"exampleDependencies": {
"@aws-cdk/aws-kinesisfirehose-destinations-alpha": "*"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@
},
"stability": "experimental",
"maturity": "experimental",
"awslint": {
"exclude": [
"*:*"
]
},
"awscdkio": {
"announce": false
},
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-lambda-go-alpha/awslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"*:*"
]
}
Loading

0 comments on commit 5ae9099

Please sign in to comment.