diff --git a/packages/awslint/lib/rules/docs.ts b/packages/awslint/lib/rules/docs.ts index fda92170bd80a..8c5107d8450ac 100644 --- a/packages/awslint/lib/rules/docs.ts +++ b/packages/awslint/lib/rules/docs.ts @@ -1,3 +1,4 @@ +import { Stability } from '@jsii/spec'; import * as reflect from 'jsii-reflect'; import { Linter } from '../linter'; import { CoreTypes } from './core-types'; @@ -71,6 +72,21 @@ docsLinter.add({ }, }); +docsLinter.add({ + code: 'no-experimental-apis', + message: 'The use of @experimental in not allowed', + eval: e => { + if (!isPublic(e.ctx)) { return; } + // technically we should ban the use of @experimental in the codebase. Since jsii marks all symbols + // of experimental modules as experimental we can't. + if (isModuleExperimental(e.ctx.assembly)) { + return; + } + const sym = e.ctx.documentable; + e.assert(sym.docs.docs.stability !== Stability.Experimental, e.ctx.errorKey); + }, +}); + function isPublic(ctx: DocsLinterContext) { switch (ctx.kind) { case 'class-property': @@ -97,6 +113,10 @@ function isCfnType(ctx: DocsLinterContext) { } } +function isModuleExperimental(assembly: reflect.Assembly) { + return assembly.spec.docs?.stability === Stability.Experimental; +} + function flatMap(array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U[]): U[] { return Array.prototype.concat(...array.map(callbackfn)); } diff --git a/tools/cfn2ts/lib/codegen.ts b/tools/cfn2ts/lib/codegen.ts index c06fce32e10ff..f952bb34a832e 100644 --- a/tools/cfn2ts/lib/codegen.ts +++ b/tools/cfn2ts/lib/codegen.ts @@ -439,7 +439,6 @@ export default class CodeGenerator { this.code.line(' *'); this.code.line(' * @param inspector - tree inspector to collect and process attributes'); this.code.line(' *'); - this.code.line(' * @stability experimental'); this.code.line(' */'); this.code.openBlock(`public inspect(inspector: ${CORE}.TreeInspector)`); this.code.line(`inspector.addAttribute("${TreeAttributes.CFN_TYPE}", ${resource.className}.CFN_RESOURCE_TYPE_NAME);`);