From c5949f85ef9a7f576a7bd02bcd0af917e4833628 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 19 Oct 2018 12:31:32 +0100 Subject: [PATCH] build: update ts-api-guardian jsdoc tag requirements (#26595) Now `@experimental` tags are banned; and `@publicApi` tags are required on exports. PR Close #26595 --- tools/ts-api-guardian/lib/cli.ts | 6 +++--- tools/ts-api-guardian/test/fixtures/module_identifier.d.ts | 1 + tools/ts-api-guardian/test/fixtures/simple.d.ts | 2 ++ tools/ts-api-guardian/test/fixtures/sorting.d.ts | 6 ++++++ tools/ts-api-guardian/test/fixtures/stripped_alias.d.ts | 1 + tools/ts-api-guardian/test/fixtures/underscored.d.ts | 1 + tools/ts-api-guardian/test/fixtures/verify_entrypoint.d.ts | 1 + tools/ts-api-guardian/test/fixtures/verify_submodule.d.ts | 1 + 8 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/ts-api-guardian/lib/cli.ts b/tools/ts-api-guardian/lib/cli.ts index 72f6fbcf07..ac26ab4242 100644 --- a/tools/ts-api-guardian/lib/cli.ts +++ b/tools/ts-api-guardian/lib/cli.ts @@ -24,9 +24,9 @@ export function startCli() { const options: SerializationOptions = { stripExportPattern: [].concat(argv['stripExportPattern']), allowModuleIdentifiers: [].concat(argv['allowModuleIdentifiers']), - exportTags: {required: [], banned: [], toCopy: ['deprecated', 'experimental']}, - memberTags: {required: [], banned: [], toCopy: ['deprecated', 'experimental']}, - paramTags: {required: [], banned: [], toCopy: ['deprecated', 'experimental']} + exportTags: {required: ['publicApi'], banned: ['experimental'], toCopy: ['deprecated']}, + memberTags: {required: [], banned: ['experimental', 'publicApi'], toCopy: ['deprecated']}, + paramTags: {required: [], banned: ['experimental', 'publicApi'], toCopy: ['deprecated']} }; for (const error of errors) { diff --git a/tools/ts-api-guardian/test/fixtures/module_identifier.d.ts b/tools/ts-api-guardian/test/fixtures/module_identifier.d.ts index fa50910435..f8af6eedf4 100644 --- a/tools/ts-api-guardian/test/fixtures/module_identifier.d.ts +++ b/tools/ts-api-guardian/test/fixtures/module_identifier.d.ts @@ -1,4 +1,5 @@ import * as foo from './somewhere'; +/** @publicApi */ export declare class A extends foo.Bar { } diff --git a/tools/ts-api-guardian/test/fixtures/simple.d.ts b/tools/ts-api-guardian/test/fixtures/simple.d.ts index 191760e7a0..b3c07b7e77 100644 --- a/tools/ts-api-guardian/test/fixtures/simple.d.ts +++ b/tools/ts-api-guardian/test/fixtures/simple.d.ts @@ -1,2 +1,4 @@ +/** @publicApi */ export declare const A: string; +/** @publicApi */ export declare var B: string; diff --git a/tools/ts-api-guardian/test/fixtures/sorting.d.ts b/tools/ts-api-guardian/test/fixtures/sorting.d.ts index 58b42c6515..59daef5b7b 100644 --- a/tools/ts-api-guardian/test/fixtures/sorting.d.ts +++ b/tools/ts-api-guardian/test/fixtures/sorting.d.ts @@ -1,11 +1,17 @@ +/** @publicApi */ export declare type E = string; +/** @publicApi */ export interface D { e: number; } +/** @publicApi */ export declare var e: C; +/** @publicApi */ export declare class C { e: number; d: string; } +/** @publicApi */ export declare function b(): boolean; +/** @publicApi */ export declare const a: string; diff --git a/tools/ts-api-guardian/test/fixtures/stripped_alias.d.ts b/tools/ts-api-guardian/test/fixtures/stripped_alias.d.ts index df39a7eb0d..b3ba8b7a40 100644 --- a/tools/ts-api-guardian/test/fixtures/stripped_alias.d.ts +++ b/tools/ts-api-guardian/test/fixtures/stripped_alias.d.ts @@ -1,3 +1,4 @@ export {original_symbol as __private_symbol} from './stripped_alias_original'; +/** @publicApi */ export class B { } \ No newline at end of file diff --git a/tools/ts-api-guardian/test/fixtures/underscored.d.ts b/tools/ts-api-guardian/test/fixtures/underscored.d.ts index ee6bfd8eab..8ff7249036 100644 --- a/tools/ts-api-guardian/test/fixtures/underscored.d.ts +++ b/tools/ts-api-guardian/test/fixtures/underscored.d.ts @@ -1,3 +1,4 @@ export const __a__: string; +/** @publicApi */ export class B { } diff --git a/tools/ts-api-guardian/test/fixtures/verify_entrypoint.d.ts b/tools/ts-api-guardian/test/fixtures/verify_entrypoint.d.ts index 07a6c15ae8..6c5d1c5cff 100644 --- a/tools/ts-api-guardian/test/fixtures/verify_entrypoint.d.ts +++ b/tools/ts-api-guardian/test/fixtures/verify_entrypoint.d.ts @@ -1,3 +1,4 @@ +/** @publicApi */ export interface A { c: number; a(arg: any[]): {[name: string]: number}; diff --git a/tools/ts-api-guardian/test/fixtures/verify_submodule.d.ts b/tools/ts-api-guardian/test/fixtures/verify_submodule.d.ts index a9f8f857a2..ae7a488d4b 100644 --- a/tools/ts-api-guardian/test/fixtures/verify_submodule.d.ts +++ b/tools/ts-api-guardian/test/fixtures/verify_submodule.d.ts @@ -1 +1,2 @@ +/** @publicApi */ export declare const b: boolean;