Lint
Lint reads your contract and warns about things that compile but look wrong. Run it in the app folder. Without Node, run it with the compiler binary: see commands per stack. The lines below use npx for Node.
npx seampact lintYou see Linted 1 api(s): 0 error(s), 0 warning(s). A finding prints the file, the line, the rule and the fix.
api.yaml:26:7: warning seampact/credential-name: The property 'Note.token' is named like a credential and is not sensitive. Fix: Mark 'Note.token' sensitive, or allow seampact/credential-name on it with a reason.Warnings do not fail. An error does: the command exits with 1. lint reads sources with a path, not bundles.
The rules
Section titled “The rules”| Rule | Reports |
|---|---|
seampact/subtree-exception |
A safety exception written above a route, so it reaches every route below. |
seampact/cookie-without-csrf |
A cookie scheme without csrf. |
seampact/redundant-maturity |
A maturity equal to the one the route already has. |
seampact/credential-name |
A property named like a credential (token, password, apiKey) and not sensitive. |
seampact/unused-declaration |
A declaration that no route, identity or convention uses. |
seampact/not-found-role |
A declared 404 code beside the derived not-found code on a route. |
All are warnings by default.
Change a rule level
Section titled “Change a rule level”Set the level under lint.rules in api.yaml or in the shared file: disabled, warning or error.
lint: rules: seampact/unused-declaration: error seampact/credential-name: disabledWith error, a finding fails lint and compile. With disabled, the rule does not run. Write disabled, not off: YAML reads off as a boolean.
Allow one case
Section titled “Allow one case”To silence a rule in one place, put lint.allow on that property, route or declaration, with a reason.
token: type: string lint: allow: seampact/credential-name: "A public share token, not a secret."On a route, the allow reaches every route below it (Settings flow down the tree). Each rule’s fix says where its allow goes.
Your own rules
Section titled “Your own rules”seampact lint does not load plugins yet. A level set for a rule that does not exist prints seampact/lint/unclaimed-rule and is ignored.
Errors: Troubleshooting.
Check it in CI. The rules in full: Grammar 12.