From c3490d4655ebca4770d12cba16dff95da265465c Mon Sep 17 00:00:00 2001 From: Enda Phelan Date: Fri, 27 Sep 2019 14:24:20 +0100 Subject: [PATCH 1/4] style(JSDoc): document private functions with `@internal` tag Closes #2183 --- src/__tests__/starWarsData.js | 8 ++++++++ src/execution/execute.js | 19 +++++++++++++++++-- src/execution/values.js | 4 ++++ src/jsutils/Path.js | 2 ++ src/language/__tests__/parser-benchmark.js | 4 ++++ src/language/blockString.js | 9 +++++++-- src/language/lexer.js | 4 +++- src/type/definition.js | 3 +++ .../__tests__/buildASTSchema-benchmark.js | 4 ++++ .../__tests__/buildClientSchema-benchmark.js | 4 ++++ .../introspectionFromSchema-benchmark.js | 4 ++++ src/validation/__tests__/harness.js | 9 +++++++++ .../__tests__/validateGQL-benchmark.js | 4 ++++ .../__tests__/validateInvalidGQL-benchmark.js | 4 ++++ .../__tests__/validateSDL-benchmark.js | 4 ++++ src/validation/validate.js | 4 +++- 16 files changed, 84 insertions(+), 6 deletions(-) diff --git a/src/__tests__/starWarsData.js b/src/__tests__/starWarsData.js index efb8759f98..3af10e35dd 100644 --- a/src/__tests__/starWarsData.js +++ b/src/__tests__/starWarsData.js @@ -122,6 +122,8 @@ function getCharacter(id) { /** * Allows us to query for a character's friends. + * + * @internal */ export function getFriends(character: Character): Array> { // Notice that GraphQL accepts Arrays of Promises. @@ -130,6 +132,8 @@ export function getFriends(character: Character): Array> { /** * Allows us to fetch the undisputed hero of the Star Wars trilogy, R2-D2. + * + * @internal */ export function getHero(episode: number): Character { if (episode === 5) { @@ -142,6 +146,8 @@ export function getHero(episode: number): Character { /** * Allows us to query for the human with the given id. + * + * @internal */ export function getHuman(id: string): Human { return humanData[id]; @@ -149,6 +155,8 @@ export function getHuman(id: string): Human { /** * Allows us to query for the droid with the given id. + * + * @internal */ export function getDroid(id: string): Droid { return droidData[id]; diff --git a/src/execution/execute.js b/src/execution/execute.js index 9ea2faa6c5..a068ac760b 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -244,6 +244,8 @@ function buildResponse( /** * Essential assertions before executing to provide developer feedback for * improper use of the GraphQL library. + * + * @internal */ export function assertValidExecutionArguments( schema: GraphQLSchema, @@ -267,6 +269,8 @@ export function assertValidExecutionArguments( * execute, which we will pass throughout the other execution methods. * * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal */ export function buildExecutionContext( schema: GraphQLSchema, @@ -465,6 +469,8 @@ function executeFields( * CollectFields requires the "runtime type" of an object. For a field which * returns an Interface or Union type, the "runtime type" will be the actual * Object type returned by that field. + * + * @internal */ export function collectFields( exeContext: ExecutionContext, @@ -641,6 +647,9 @@ function resolveField( ); } +/** + * @internal + */ export function buildResolveInfo( exeContext: ExecutionContext, fieldDef: GraphQLField, @@ -664,8 +673,12 @@ export function buildResolveInfo( }; } -// Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField` -// function. Returns the result of resolveFn or the abrupt-return Error object. +/** + * Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField` + * function. Returns the result of resolveFn or the abrupt-return Error object. + * + * @internal + */ export function resolveFieldValueOrError( exeContext: ExecutionContext, fieldDef: GraphQLField, @@ -1192,6 +1205,8 @@ export const defaultFieldResolver: GraphQLFieldResolver< * are allowed, like on a Union. __schema could get automatically * added to the query type, but that would require mutating type * definitions, which would cause issues. + * + * @internal */ export function getFieldDef( schema: GraphQLSchema, diff --git a/src/execution/values.js b/src/execution/values.js index d56132bf79..7d5397a62c 100644 --- a/src/execution/values.js +++ b/src/execution/values.js @@ -41,6 +41,8 @@ type CoercedVariableValues = * Note: The returned value is a plain Object with a prototype, since it is * exposed to user code. Care should be taken to not pull values from the * Object prototype. + * + * @internal */ export function getVariableValues( schema: GraphQLSchema, @@ -153,6 +155,8 @@ function coerceVariableValues( * Note: The returned value is a plain Object with a prototype, since it is * exposed to user code. Care should be taken to not pull values from the * Object prototype. + * + * @internal */ export function getArgumentValues( def: GraphQLField | GraphQLDirective, diff --git a/src/jsutils/Path.js b/src/jsutils/Path.js index 17f78e6c77..540fad27be 100644 --- a/src/jsutils/Path.js +++ b/src/jsutils/Path.js @@ -7,6 +7,8 @@ export type Path = {| /** * Given a Path and a key, return a new Path containing the new key. + * + * @internal */ export function addPath(prev: $ReadOnly | void, key: string | number) { return { prev, key }; diff --git a/src/language/__tests__/parser-benchmark.js b/src/language/__tests__/parser-benchmark.js index 3a9dc8f579..ec3931cb64 100644 --- a/src/language/__tests__/parser-benchmark.js +++ b/src/language/__tests__/parser-benchmark.js @@ -6,6 +6,10 @@ import { kitchenSinkQuery } from '../../__fixtures__'; export const name = 'Parse kitchen sink'; export const count = 1000; + +/** + * @internal + */ export function measure() { parse(kitchenSinkQuery); } diff --git a/src/language/blockString.js b/src/language/blockString.js index 913fad521d..928cfd9c82 100644 --- a/src/language/blockString.js +++ b/src/language/blockString.js @@ -5,6 +5,8 @@ * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. * * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal */ export function dedentBlockStringValue(rawString: string): string { // Expand a block string's raw value into independent lines. @@ -30,8 +32,9 @@ export function dedentBlockStringValue(rawString: string): string { // Return a string of the lines joined with U+000A. return lines.join('\n'); } - -// @internal +/** + * @internal + */ export function getBlockStringIndentation( lines: $ReadOnlyArray, ): number { @@ -71,6 +74,8 @@ function isBlank(str) { * Print a block string in the indented block form by adding a leading and * trailing blank line. However, if a block string starts with whitespace and is * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal */ export function printBlockString( value: string, diff --git a/src/language/lexer.js b/src/language/lexer.js index b94b0d65ea..b200ef7071 100644 --- a/src/language/lexer.js +++ b/src/language/lexer.js @@ -93,7 +93,9 @@ export type Lexer = { ... }; -// @internal +/** + * @internal + */ export function isPunctuatorTokenKind(kind: TokenKindEnum) { return ( kind === TokenKind.BANG || diff --git a/src/type/definition.js b/src/type/definition.js index 9d1f2133c8..ffa21c7a52 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -822,6 +822,9 @@ function fieldsToFieldsConfig(fields) { })); } +/** + * @internal + */ export function argsToArgsConfig( args: $ReadOnlyArray, ): GraphQLFieldConfigArgumentMap { diff --git a/src/utilities/__tests__/buildASTSchema-benchmark.js b/src/utilities/__tests__/buildASTSchema-benchmark.js index 58f65dd5cf..138b3e11be 100644 --- a/src/utilities/__tests__/buildASTSchema-benchmark.js +++ b/src/utilities/__tests__/buildASTSchema-benchmark.js @@ -10,6 +10,10 @@ const schemaAST = parse(bigSchemaSDL); export const name = 'Build Schema from AST'; export const count = 10; + +/** + * @internal + */ export function measure() { buildASTSchema(schemaAST, { assumeValid: true }); } diff --git a/src/utilities/__tests__/buildClientSchema-benchmark.js b/src/utilities/__tests__/buildClientSchema-benchmark.js index d7d9500ed3..57444aca63 100644 --- a/src/utilities/__tests__/buildClientSchema-benchmark.js +++ b/src/utilities/__tests__/buildClientSchema-benchmark.js @@ -6,6 +6,10 @@ import { bigSchemaIntrospectionResult } from '../../__fixtures__'; export const name = 'Build Schema from Introspection'; export const count = 10; + +/** + * @internal + */ export function measure() { buildClientSchema(bigSchemaIntrospectionResult.data, { assumeValid: true }); } diff --git a/src/utilities/__tests__/introspectionFromSchema-benchmark.js b/src/utilities/__tests__/introspectionFromSchema-benchmark.js index f591b8a889..636df600e3 100644 --- a/src/utilities/__tests__/introspectionFromSchema-benchmark.js +++ b/src/utilities/__tests__/introspectionFromSchema-benchmark.js @@ -13,6 +13,10 @@ const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); export const name = 'Execute Introspection Query'; export const count = 10; + +/** + * @internal + */ export function measure() { execute(schema, queryAST); } diff --git a/src/validation/__tests__/harness.js b/src/validation/__tests__/harness.js index c4f313504d..ee663b109d 100644 --- a/src/validation/__tests__/harness.js +++ b/src/validation/__tests__/harness.js @@ -370,6 +370,9 @@ export const testSchema = new GraphQLSchema({ ], }); +/** + * @internal + */ export function expectValidationErrorsWithSchema( schema: GraphQLSchema, rule: ValidationRule, @@ -380,10 +383,16 @@ export function expectValidationErrorsWithSchema( return expect(errors); } +/** + * @internal + */ export function expectValidationErrors(rule: ValidationRule, queryStr: string) { return expectValidationErrorsWithSchema(testSchema, rule, queryStr); } +/** + * @internal + */ export function expectSDLValidationErrors( schema: ?GraphQLSchema, rule: SDLValidationRule, diff --git a/src/validation/__tests__/validateGQL-benchmark.js b/src/validation/__tests__/validateGQL-benchmark.js index 509fd7cdc9..bd6fb274e0 100644 --- a/src/validation/__tests__/validateGQL-benchmark.js +++ b/src/validation/__tests__/validateGQL-benchmark.js @@ -13,6 +13,10 @@ const queryAST = parse(getIntrospectionQuery()); export const name = 'Validate Introspection Query'; export const count = 50; + +/** + * @internal + */ export function measure() { validate(schema, queryAST); } diff --git a/src/validation/__tests__/validateInvalidGQL-benchmark.js b/src/validation/__tests__/validateInvalidGQL-benchmark.js index 13e9402d64..16993a7026 100644 --- a/src/validation/__tests__/validateInvalidGQL-benchmark.js +++ b/src/validation/__tests__/validateInvalidGQL-benchmark.js @@ -24,6 +24,10 @@ const queryAST = parse(` export const name = 'Validate Invalid Query'; export const count = 50; + +/** + * @internal + */ export function measure() { validate(schema, queryAST); } diff --git a/src/validation/__tests__/validateSDL-benchmark.js b/src/validation/__tests__/validateSDL-benchmark.js index 921ce506e7..327d0afabf 100644 --- a/src/validation/__tests__/validateSDL-benchmark.js +++ b/src/validation/__tests__/validateSDL-benchmark.js @@ -10,6 +10,10 @@ const sdlAST = parse(bigSchemaSDL); export const name = 'Validate SDL Document'; export const count = 10; + +/** + * @internal + */ export function measure() { validateSDL(sdlAST); } diff --git a/src/validation/validate.js b/src/validation/validate.js index 41485ee317..42f5f269bf 100644 --- a/src/validation/validate.js +++ b/src/validation/validate.js @@ -82,7 +82,9 @@ export function validate( return errors; } -// @internal +/** + * @internal + */ export function validateSDL( documentAST: DocumentNode, schemaToExtend?: ?GraphQLSchema, From ae8a63e80ac5f62957c4f01f512c5e7b643a7588 Mon Sep 17 00:00:00 2001 From: Enda Phelan Date: Fri, 27 Sep 2019 16:34:32 +0100 Subject: [PATCH 2/4] style(prettier): format code --- src/__tests__/starWarsData.js | 8 ++++---- src/execution/execute.js | 10 +++++----- src/execution/values.js | 4 ++-- src/jsutils/Path.js | 2 +- src/language/blockString.js | 4 ++-- .../__tests__/introspectionFromSchema-benchmark.js | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/__tests__/starWarsData.js b/src/__tests__/starWarsData.js index 3af10e35dd..dc0049a23a 100644 --- a/src/__tests__/starWarsData.js +++ b/src/__tests__/starWarsData.js @@ -122,7 +122,7 @@ function getCharacter(id) { /** * Allows us to query for a character's friends. - * + * * @internal */ export function getFriends(character: Character): Array> { @@ -132,7 +132,7 @@ export function getFriends(character: Character): Array> { /** * Allows us to fetch the undisputed hero of the Star Wars trilogy, R2-D2. - * + * * @internal */ export function getHero(episode: number): Character { @@ -146,7 +146,7 @@ export function getHero(episode: number): Character { /** * Allows us to query for the human with the given id. - * + * * @internal */ export function getHuman(id: string): Human { @@ -155,7 +155,7 @@ export function getHuman(id: string): Human { /** * Allows us to query for the droid with the given id. - * + * * @internal */ export function getDroid(id: string): Droid { diff --git a/src/execution/execute.js b/src/execution/execute.js index a068ac760b..024cb0f5a9 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -244,7 +244,7 @@ function buildResponse( /** * Essential assertions before executing to provide developer feedback for * improper use of the GraphQL library. - * + * * @internal */ export function assertValidExecutionArguments( @@ -269,7 +269,7 @@ export function assertValidExecutionArguments( * execute, which we will pass throughout the other execution methods. * * Throws a GraphQLError if a valid execution context cannot be created. - * + * * @internal */ export function buildExecutionContext( @@ -469,7 +469,7 @@ function executeFields( * CollectFields requires the "runtime type" of an object. For a field which * returns an Interface or Union type, the "runtime type" will be the actual * Object type returned by that field. - * + * * @internal */ export function collectFields( @@ -676,7 +676,7 @@ export function buildResolveInfo( /** * Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField` * function. Returns the result of resolveFn or the abrupt-return Error object. - * + * * @internal */ export function resolveFieldValueOrError( @@ -1205,7 +1205,7 @@ export const defaultFieldResolver: GraphQLFieldResolver< * are allowed, like on a Union. __schema could get automatically * added to the query type, but that would require mutating type * definitions, which would cause issues. - * + * * @internal */ export function getFieldDef( diff --git a/src/execution/values.js b/src/execution/values.js index 7d5397a62c..1d09672e5f 100644 --- a/src/execution/values.js +++ b/src/execution/values.js @@ -41,7 +41,7 @@ type CoercedVariableValues = * Note: The returned value is a plain Object with a prototype, since it is * exposed to user code. Care should be taken to not pull values from the * Object prototype. - * + * * @internal */ export function getVariableValues( @@ -155,7 +155,7 @@ function coerceVariableValues( * Note: The returned value is a plain Object with a prototype, since it is * exposed to user code. Care should be taken to not pull values from the * Object prototype. - * + * * @internal */ export function getArgumentValues( diff --git a/src/jsutils/Path.js b/src/jsutils/Path.js index 540fad27be..d78b2aa443 100644 --- a/src/jsutils/Path.js +++ b/src/jsutils/Path.js @@ -7,7 +7,7 @@ export type Path = {| /** * Given a Path and a key, return a new Path containing the new key. - * + * * @internal */ export function addPath(prev: $ReadOnly | void, key: string | number) { diff --git a/src/language/blockString.js b/src/language/blockString.js index 928cfd9c82..dba151a125 100644 --- a/src/language/blockString.js +++ b/src/language/blockString.js @@ -5,7 +5,7 @@ * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. * * This implements the GraphQL spec's BlockStringValue() static algorithm. - * + * * @internal */ export function dedentBlockStringValue(rawString: string): string { @@ -74,7 +74,7 @@ function isBlank(str) { * Print a block string in the indented block form by adding a leading and * trailing blank line. However, if a block string starts with whitespace and is * a single-line, adding a leading blank line would strip that whitespace. - * + * * @internal */ export function printBlockString( diff --git a/src/utilities/__tests__/introspectionFromSchema-benchmark.js b/src/utilities/__tests__/introspectionFromSchema-benchmark.js index 636df600e3..697d1d5788 100644 --- a/src/utilities/__tests__/introspectionFromSchema-benchmark.js +++ b/src/utilities/__tests__/introspectionFromSchema-benchmark.js @@ -15,7 +15,7 @@ export const name = 'Execute Introspection Query'; export const count = 10; /** - * @internal + * @internal */ export function measure() { execute(schema, queryAST); From 569fca3e9dbdd5e23c06155a023b2a4fc06b815c Mon Sep 17 00:00:00 2001 From: Enda Phelan Date: Mon, 30 Sep 2019 08:31:53 +0100 Subject: [PATCH 3/4] fix: remove internal tags from test files --- resources/build.js | 1 - src/__tests__/starWarsData.js | 8 -------- src/jsutils/Path.js | 2 -- src/language/__tests__/parser-benchmark.js | 4 ---- src/utilities/__tests__/buildASTSchema-benchmark.js | 4 ---- src/utilities/__tests__/buildClientSchema-benchmark.js | 4 ---- .../__tests__/introspectionFromSchema-benchmark.js | 4 ---- src/validation/__tests__/harness.js | 9 --------- src/validation/__tests__/validateGQL-benchmark.js | 4 ---- src/validation/__tests__/validateInvalidGQL-benchmark.js | 4 ---- src/validation/__tests__/validateSDL-benchmark.js | 4 ---- 11 files changed, 48 deletions(-) diff --git a/resources/build.js b/resources/build.js index f7711c0c57..21983ebefa 100644 --- a/resources/build.js +++ b/resources/build.js @@ -18,7 +18,6 @@ const { if (require.main === module) { rmdirRecursive('./dist'); mkdirRecursive('./dist'); - copyFile('./LICENSE', './dist/LICENSE'); copyFile('./README.md', './dist/README.md'); diff --git a/src/__tests__/starWarsData.js b/src/__tests__/starWarsData.js index dc0049a23a..efb8759f98 100644 --- a/src/__tests__/starWarsData.js +++ b/src/__tests__/starWarsData.js @@ -122,8 +122,6 @@ function getCharacter(id) { /** * Allows us to query for a character's friends. - * - * @internal */ export function getFriends(character: Character): Array> { // Notice that GraphQL accepts Arrays of Promises. @@ -132,8 +130,6 @@ export function getFriends(character: Character): Array> { /** * Allows us to fetch the undisputed hero of the Star Wars trilogy, R2-D2. - * - * @internal */ export function getHero(episode: number): Character { if (episode === 5) { @@ -146,8 +142,6 @@ export function getHero(episode: number): Character { /** * Allows us to query for the human with the given id. - * - * @internal */ export function getHuman(id: string): Human { return humanData[id]; @@ -155,8 +149,6 @@ export function getHuman(id: string): Human { /** * Allows us to query for the droid with the given id. - * - * @internal */ export function getDroid(id: string): Droid { return droidData[id]; diff --git a/src/jsutils/Path.js b/src/jsutils/Path.js index d78b2aa443..17f78e6c77 100644 --- a/src/jsutils/Path.js +++ b/src/jsutils/Path.js @@ -7,8 +7,6 @@ export type Path = {| /** * Given a Path and a key, return a new Path containing the new key. - * - * @internal */ export function addPath(prev: $ReadOnly | void, key: string | number) { return { prev, key }; diff --git a/src/language/__tests__/parser-benchmark.js b/src/language/__tests__/parser-benchmark.js index ec3931cb64..3a9dc8f579 100644 --- a/src/language/__tests__/parser-benchmark.js +++ b/src/language/__tests__/parser-benchmark.js @@ -6,10 +6,6 @@ import { kitchenSinkQuery } from '../../__fixtures__'; export const name = 'Parse kitchen sink'; export const count = 1000; - -/** - * @internal - */ export function measure() { parse(kitchenSinkQuery); } diff --git a/src/utilities/__tests__/buildASTSchema-benchmark.js b/src/utilities/__tests__/buildASTSchema-benchmark.js index 138b3e11be..58f65dd5cf 100644 --- a/src/utilities/__tests__/buildASTSchema-benchmark.js +++ b/src/utilities/__tests__/buildASTSchema-benchmark.js @@ -10,10 +10,6 @@ const schemaAST = parse(bigSchemaSDL); export const name = 'Build Schema from AST'; export const count = 10; - -/** - * @internal - */ export function measure() { buildASTSchema(schemaAST, { assumeValid: true }); } diff --git a/src/utilities/__tests__/buildClientSchema-benchmark.js b/src/utilities/__tests__/buildClientSchema-benchmark.js index 57444aca63..d7d9500ed3 100644 --- a/src/utilities/__tests__/buildClientSchema-benchmark.js +++ b/src/utilities/__tests__/buildClientSchema-benchmark.js @@ -6,10 +6,6 @@ import { bigSchemaIntrospectionResult } from '../../__fixtures__'; export const name = 'Build Schema from Introspection'; export const count = 10; - -/** - * @internal - */ export function measure() { buildClientSchema(bigSchemaIntrospectionResult.data, { assumeValid: true }); } diff --git a/src/utilities/__tests__/introspectionFromSchema-benchmark.js b/src/utilities/__tests__/introspectionFromSchema-benchmark.js index 697d1d5788..f591b8a889 100644 --- a/src/utilities/__tests__/introspectionFromSchema-benchmark.js +++ b/src/utilities/__tests__/introspectionFromSchema-benchmark.js @@ -13,10 +13,6 @@ const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); export const name = 'Execute Introspection Query'; export const count = 10; - -/** - * @internal - */ export function measure() { execute(schema, queryAST); } diff --git a/src/validation/__tests__/harness.js b/src/validation/__tests__/harness.js index ee663b109d..c4f313504d 100644 --- a/src/validation/__tests__/harness.js +++ b/src/validation/__tests__/harness.js @@ -370,9 +370,6 @@ export const testSchema = new GraphQLSchema({ ], }); -/** - * @internal - */ export function expectValidationErrorsWithSchema( schema: GraphQLSchema, rule: ValidationRule, @@ -383,16 +380,10 @@ export function expectValidationErrorsWithSchema( return expect(errors); } -/** - * @internal - */ export function expectValidationErrors(rule: ValidationRule, queryStr: string) { return expectValidationErrorsWithSchema(testSchema, rule, queryStr); } -/** - * @internal - */ export function expectSDLValidationErrors( schema: ?GraphQLSchema, rule: SDLValidationRule, diff --git a/src/validation/__tests__/validateGQL-benchmark.js b/src/validation/__tests__/validateGQL-benchmark.js index bd6fb274e0..509fd7cdc9 100644 --- a/src/validation/__tests__/validateGQL-benchmark.js +++ b/src/validation/__tests__/validateGQL-benchmark.js @@ -13,10 +13,6 @@ const queryAST = parse(getIntrospectionQuery()); export const name = 'Validate Introspection Query'; export const count = 50; - -/** - * @internal - */ export function measure() { validate(schema, queryAST); } diff --git a/src/validation/__tests__/validateInvalidGQL-benchmark.js b/src/validation/__tests__/validateInvalidGQL-benchmark.js index 16993a7026..13e9402d64 100644 --- a/src/validation/__tests__/validateInvalidGQL-benchmark.js +++ b/src/validation/__tests__/validateInvalidGQL-benchmark.js @@ -24,10 +24,6 @@ const queryAST = parse(` export const name = 'Validate Invalid Query'; export const count = 50; - -/** - * @internal - */ export function measure() { validate(schema, queryAST); } diff --git a/src/validation/__tests__/validateSDL-benchmark.js b/src/validation/__tests__/validateSDL-benchmark.js index 327d0afabf..921ce506e7 100644 --- a/src/validation/__tests__/validateSDL-benchmark.js +++ b/src/validation/__tests__/validateSDL-benchmark.js @@ -10,10 +10,6 @@ const sdlAST = parse(bigSchemaSDL); export const name = 'Validate SDL Document'; export const count = 10; - -/** - * @internal - */ export function measure() { validateSDL(sdlAST); } From 88b4aa8184f3c3f60211cc385fc209d414a20bf2 Mon Sep 17 00:00:00 2001 From: Enda Phelan Date: Mon, 30 Sep 2019 08:37:26 +0100 Subject: [PATCH 4/4] fix: use JSDoc style for comments --- resources/build.js | 1 + src/validation/rules/KnownArgumentNames.js | 4 +++- src/validation/rules/ProvidedRequiredArguments.js | 4 +++- src/validation/specifiedRules.js | 8 +++++--- tstypes/language/blockString.d.ts | 4 +++- tstypes/language/directiveLocation.d.ts | 4 +++- tstypes/language/kinds.d.ts | 4 +++- tstypes/utilities/findBreakingChanges.d.ts | 8 ++++++-- tstypes/validation/rules/KnownArgumentNames.d.ts | 4 +++- tstypes/validation/rules/ProvidedRequiredArguments.d.ts | 4 +++- tstypes/validation/specifiedRules.d.ts | 8 +++++--- tstypes/validation/validate.d.ts | 4 +++- 12 files changed, 41 insertions(+), 16 deletions(-) diff --git a/resources/build.js b/resources/build.js index 21983ebefa..f7711c0c57 100644 --- a/resources/build.js +++ b/resources/build.js @@ -18,6 +18,7 @@ const { if (require.main === module) { rmdirRecursive('./dist'); mkdirRecursive('./dist'); + copyFile('./LICENSE', './dist/LICENSE'); copyFile('./README.md', './dist/README.md'); diff --git a/src/validation/rules/KnownArgumentNames.js b/src/validation/rules/KnownArgumentNames.js index 25a539df1e..7bcee2b072 100644 --- a/src/validation/rules/KnownArgumentNames.js +++ b/src/validation/rules/KnownArgumentNames.js @@ -45,7 +45,9 @@ export function KnownArgumentNames(context: ValidationContext): ASTVisitor { }; } -// @internal +/** + * @internal + */ export function KnownArgumentNamesOnDirectives( context: ValidationContext | SDLValidationContext, ): ASTVisitor { diff --git a/src/validation/rules/ProvidedRequiredArguments.js b/src/validation/rules/ProvidedRequiredArguments.js index 2a019304b2..99151aa732 100644 --- a/src/validation/rules/ProvidedRequiredArguments.js +++ b/src/validation/rules/ProvidedRequiredArguments.js @@ -71,7 +71,9 @@ export function ProvidedRequiredArguments( }; } -// @internal +/** + * @internal + */ export function ProvidedRequiredArgumentsOnDirectives( context: ValidationContext | SDLValidationContext, ): ASTVisitor { diff --git a/src/validation/specifiedRules.js b/src/validation/specifiedRules.js index 1d0c48788b..017b25191f 100644 --- a/src/validation/specifiedRules.js +++ b/src/validation/specifiedRules.js @@ -60,7 +60,7 @@ import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation // Spec Section: "Argument Names" import { KnownArgumentNames, - KnownArgumentNamesOnDirectives, // @internal + KnownArgumentNamesOnDirectives, } from './rules/KnownArgumentNames'; // Spec Section: "Argument Uniqueness" @@ -72,7 +72,7 @@ import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType'; // Spec Section: "Argument Optionality" import { ProvidedRequiredArguments, - ProvidedRequiredArgumentsOnDirectives, // @internal + ProvidedRequiredArgumentsOnDirectives, } from './rules/ProvidedRequiredArguments'; // Spec Section: "All Variable Usages Are Allowed" @@ -127,7 +127,9 @@ import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames'; import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames'; import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions'; -// @internal +/** + * @internal + */ export const specifiedSDLRules = Object.freeze([ LoneSchemaDefinition, UniqueOperationTypes, diff --git a/tstypes/language/blockString.d.ts b/tstypes/language/blockString.d.ts index 7a9a5f7a82..a25329b3f4 100644 --- a/tstypes/language/blockString.d.ts +++ b/tstypes/language/blockString.d.ts @@ -6,7 +6,9 @@ */ export function dedentBlockStringValue(rawString: string): string; -// @internal +/** + * @internal + */ export function getBlockStringIndentation(lines: ReadonlyArray): number; /** diff --git a/tstypes/language/directiveLocation.d.ts b/tstypes/language/directiveLocation.d.ts index 7b1bd51bca..31365f5901 100644 --- a/tstypes/language/directiveLocation.d.ts +++ b/tstypes/language/directiveLocation.d.ts @@ -3,7 +3,9 @@ */ export const DirectiveLocation: _DirectiveLocation; -// @internal +/** + * @internal + */ type _DirectiveLocation = { // Request Definitions QUERY: 'QUERY'; diff --git a/tstypes/language/kinds.d.ts b/tstypes/language/kinds.d.ts index f61ace5fc4..e655af00d8 100644 --- a/tstypes/language/kinds.d.ts +++ b/tstypes/language/kinds.d.ts @@ -3,7 +3,9 @@ */ export const Kind: _Kind; -// @internal +/** + * @internal + */ type _Kind = { // Name NAME: 'Name'; diff --git a/tstypes/utilities/findBreakingChanges.d.ts b/tstypes/utilities/findBreakingChanges.d.ts index 87fa0c028e..afc2694598 100644 --- a/tstypes/utilities/findBreakingChanges.d.ts +++ b/tstypes/utilities/findBreakingChanges.d.ts @@ -4,7 +4,9 @@ import { DirectiveLocationEnum } from '../language/directiveLocation'; export const BreakingChangeType: _BreakingChangeType; -// @internal +/** + * @internal + */ type _BreakingChangeType = { TYPE_REMOVED: 'TYPE_REMOVED'; TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND'; @@ -25,7 +27,9 @@ type _BreakingChangeType = { export const DangerousChangeType: _DangerousChangeType; -// @internal +/** + * @internal + */ type _DangerousChangeType = { VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM'; TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION'; diff --git a/tstypes/validation/rules/KnownArgumentNames.d.ts b/tstypes/validation/rules/KnownArgumentNames.d.ts index 33541a7906..5ff0033dbd 100644 --- a/tstypes/validation/rules/KnownArgumentNames.d.ts +++ b/tstypes/validation/rules/KnownArgumentNames.d.ts @@ -9,7 +9,9 @@ import { ASTVisitor } from '../../language/visitor'; */ export function KnownArgumentNames(context: ValidationContext): ASTVisitor; -// @internal +/** + * @internal + */ export function KnownArgumentNamesOnDirectives( context: ValidationContext | SDLValidationContext, ): ASTVisitor; diff --git a/tstypes/validation/rules/ProvidedRequiredArguments.d.ts b/tstypes/validation/rules/ProvidedRequiredArguments.d.ts index 4a02ae6151..d67e2fceb7 100644 --- a/tstypes/validation/rules/ProvidedRequiredArguments.d.ts +++ b/tstypes/validation/rules/ProvidedRequiredArguments.d.ts @@ -11,7 +11,9 @@ export function ProvidedRequiredArguments( context: ValidationContext, ): ASTVisitor; -// @internal +/** + * @internal + */ export function ProvidedRequiredArgumentsOnDirectives( context: ValidationContext | SDLValidationContext, ): ASTVisitor; diff --git a/tstypes/validation/specifiedRules.d.ts b/tstypes/validation/specifiedRules.d.ts index e26fae8980..61ad92e72c 100644 --- a/tstypes/validation/specifiedRules.d.ts +++ b/tstypes/validation/specifiedRules.d.ts @@ -60,7 +60,7 @@ import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation // Spec Section: "Argument Names" import { KnownArgumentNames, - KnownArgumentNamesOnDirectives, // @internal + KnownArgumentNamesOnDirectives, } from './rules/KnownArgumentNames'; // Spec Section: "Argument Uniqueness" @@ -72,7 +72,7 @@ import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType'; // Spec Section: "Argument Optionality" import { ProvidedRequiredArguments, - ProvidedRequiredArgumentsOnDirectives, // @internal + ProvidedRequiredArgumentsOnDirectives, } from './rules/ProvidedRequiredArguments'; // Spec Section: "All Variable Usages Are Allowed" @@ -94,5 +94,7 @@ export const specifiedRules: ReadonlyArray; import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition'; -// @internal +/** + * @internal + */ export const specifiedSDLRules: ReadonlyArray; diff --git a/tstypes/validation/validate.d.ts b/tstypes/validation/validate.d.ts index a4baff7f73..492af890f1 100644 --- a/tstypes/validation/validate.d.ts +++ b/tstypes/validation/validate.d.ts @@ -29,7 +29,9 @@ export function validate( options?: { maxErrors?: number }, ): ReadonlyArray; -// @internal +/** + * @internal + */ export function validateSDL( documentAST: DocumentNode, schemaToExtend?: Maybe,