-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: awslint #1468
chore: awslint #1468
Conversation
Initial RFC for design of #1432
Adds CloudFormation resource metadata which enables tools such as SAM CLI to find local assets used by resources in the template. See design document under [design/code-asset-metadata.md](./design/code-asset-metadata.md) Fixes #1432
- Move all construct members (besides protected "validate") under "node" - Rename "parent" to "scope" - Rename "id" or "name" to "scid" (not sure about this one)
…o benisrae/awslint
tools/awslint/GUIDELINES.md
Outdated
} | ||
``` | ||
|
||
The reason we are defining `export` on the resource interface and not on the resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worthwhile splitting this document into two parts:
- These are the rules.
- This is why the rules are what they are.
The reason is if I'm implementing something and I want to quickly validate whether I'm following the rules properly, I just want to be able to skim them and not have to skip swathes of rationale.
The rationale can probably go at the end or into a different file, it's going to be mostly interesting if people are curious or want to quibble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think awslint list
is not good enough?
$ awslint list
module-name: module name must be @aws-cdk/aws-<namespace>
construct-ctor: signature of all construct constructors should be "scope, id, props"
resource-class: every resource must have a resource class (L2)
resource-class-is-construct: resource classes must extend "cdk.Construct" directly or indirectly
resource-props: an interface for resource props must be defined
resource-interface: every resource must have a resource interface
import-props-interface: every resource must have an "FooImportProps" interface
resource-interface-extends-construct: resource interface must extends cdk.IConstruct
resource-attribute: resources must represent all attributes as properties
resource-attribute-immutable: resource attributes must be immutable (readonly)
import: resource class must have a static "import" method
export: resource interface must have an "export" method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's tension between "rule caption", "rule + short description + example" and "rule + rationale".
But also I don't want to create duplicate work for nothing. If we say this doc is the rationale doc, I think I can live with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the rationale doc, but we can definitely add a longer description to the code itself.
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Introducing awslint: a linter for the AWS Construct Library APIs. The goal of the linter is to enforce the API design guidelines across the AWS Construct Library.
For details on how to use the linter see README. All rules are going to be documented under GUIDELINES.
awslint
npm script has been added to all modules through pkglint.package.json
files so we can continue to lint from here.TODO:
This change is built on top of #1444
Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.