From 1ae53a12ab375d0bd6d03bcb051192406cfe1812 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:09:48 +0100 Subject: [PATCH] put double quotes back --- .../get-declarations.ts | 52 +++++++++---------- .../custom-elements-manifest/get-exports.ts | 12 ++--- .../custom-elements-manifest/transformer.ts | 28 +++++----- .../custom-elements-manifest/utils.ts | 26 +++++----- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/transformers/custom-elements-manifest/get-declarations.ts b/src/transformers/custom-elements-manifest/get-declarations.ts index e7a0f64..2ed6809 100644 --- a/src/transformers/custom-elements-manifest/get-declarations.ts +++ b/src/transformers/custom-elements-manifest/get-declarations.ts @@ -8,19 +8,19 @@ * * For example, mapping known exports into a list of manifest declarations. */ -import * as tsModule from 'typescript'; -import {isSimpleType, toSimpleType} from 'ts-simple-type'; -import {ComponentDeclaration} from '../../analyze/types/component-declaration'; +import * as tsModule from "typescript"; +import {isSimpleType, toSimpleType} from "ts-simple-type"; +import {ComponentDeclaration} from "../../analyze/types/component-declaration"; import { getMixinHeritageClauses, getSuperclassHeritageClause -} from '../../analyze/util/component-declaration-util'; -import {findParent, getNodeName} from '../../analyze/util/ast-util'; -import {getJsDoc} from '../../analyze/util/js-doc-util'; -import {getTypeHintFromType} from '../../util/get-type-hint-from-type'; -import {AnalyzerResult} from '../../analyze/types/analyzer-result'; -import * as schema from 'custom-elements-manifest'; -import {TransformerContext} from '../transformer-context'; +} from "../../analyze/util/component-declaration-util"; +import {findParent, getNodeName} from "../../analyze/util/ast-util"; +import {getJsDoc} from "../../analyze/util/js-doc-util"; +import {getTypeHintFromType} from "../../util/get-type-hint-from-type"; +import {AnalyzerResult} from "../../analyze/types/analyzer-result"; +import * as schema from "custom-elements-manifest"; +import {TransformerContext} from "../transformer-context"; import { typeToSchemaType, getSummaryFromJsDoc, @@ -28,7 +28,7 @@ import { getReturnFromJsDoc, getReferenceFromHeritageClause, getInheritedFromReference -} from './utils'; +} from "./utils"; /** * Computes the exported symbols of a result (e.g. variables, functions, etc.) @@ -60,7 +60,7 @@ function* getExportedDeclarationsFromResult( const jsDoc = getJsDoc(variableStatement, tsModule); yield { - kind: 'variable', + kind: "variable", name: node.name.getText(), description: jsDoc?.description, type: typeToSchemaType(context, context.checker.getTypeAtLocation(node)), @@ -101,7 +101,7 @@ function* getExportedDeclarationsFromResult( const {description: returnDescription, typeHint: returnTypeHint} = getReturnFromJsDoc(jsDoc); yield { - kind: 'function', + kind: "function", name: node.name.getText(), description: jsDoc?.description, summary: getSummaryFromJsDoc(jsDoc), @@ -124,11 +124,11 @@ function* getClassFieldsForComponent( declaration: ComponentDeclaration, context: TransformerContext ): IterableIterator { - const visibility = context.config.visibility ?? 'public'; + const visibility = context.config.visibility ?? "public"; for (const member of declaration.members) { if (member.visibility === visibility && member.propName != null) { yield { - kind: 'field', + kind: "field", name: member.propName, privacy: member.visibility, description: member.jsDoc?.description, @@ -151,7 +151,7 @@ function* getMethodsForComponent( declaration: ComponentDeclaration, context: TransformerContext ): IterableIterator { - const visibility = context.config.visibility ?? 'public'; + const visibility = context.config.visibility ?? "public"; for (const method of declaration.methods) { const parameters: schema.Parameter[] = []; const node = method.node; @@ -190,7 +190,7 @@ function* getMethodsForComponent( ); yield { - kind: 'method', + kind: "method", name: method.name, privacy: method.visibility, description: method.jsDoc?.description, @@ -228,20 +228,20 @@ function* getEventsFromComponent( declaration: ComponentDeclaration, context: TransformerContext ): IterableIterator { - const visibility = context.config.visibility ?? 'public'; + const visibility = context.config.visibility ?? "public"; for (const event of declaration.events) { if (event.visibility === visibility) { - const type = event.type?.() ?? {kind: 'ANY'}; + const type = event.type?.() ?? {kind: "ANY"}; const simpleType = isSimpleType(type) ? type : toSimpleType(type, context.checker); const typeName = - simpleType.kind === 'GENERIC_ARGUMENTS' ? simpleType.target.name : simpleType.name; + simpleType.kind === "GENERIC_ARGUMENTS" ? simpleType.target.name : simpleType.name; yield { description: event.jsDoc?.description, name: event.name, inheritedFrom: getInheritedFromReference(declaration, event, context), type: - typeName === null || typeName === undefined || simpleType.kind === 'ANY' - ? {text: 'Event'} + typeName === null || typeName === undefined || simpleType.kind === "ANY" + ? {text: "Event"} : {text: typeName} }; } @@ -260,7 +260,7 @@ function* getSlotsFromComponent( for (const slot of declaration.slots) { yield { description: slot.jsDoc?.description, - name: slot.name ?? '' + name: slot.name ?? "" }; } } @@ -274,7 +274,7 @@ function* getAttributesFromComponent( declaration: ComponentDeclaration, context: TransformerContext ): IterableIterator { - const visibility = context.config.visibility ?? 'public'; + const visibility = context.config.visibility ?? "public"; for (const member of declaration.members) { if (member.visibility === visibility && member.attrName) { const type = getTypeHintFromType( @@ -341,7 +341,7 @@ function getDeclarationForComponent( result: AnalyzerResult, context: TransformerContext ): schema.Declaration | undefined { - if (declaration.kind === 'interface') { + if (declaration.kind === "interface") { return undefined; } @@ -364,7 +364,7 @@ function getDeclarationForComponent( } const classDecl: schema.ClassDeclaration = { - kind: 'class', + kind: "class", name, superclass: superClass, mixins: mixins.length > 0 ? mixins : undefined, diff --git a/src/transformers/custom-elements-manifest/get-exports.ts b/src/transformers/custom-elements-manifest/get-exports.ts index 5d173c9..9cce7e7 100644 --- a/src/transformers/custom-elements-manifest/get-exports.ts +++ b/src/transformers/custom-elements-manifest/get-exports.ts @@ -1,7 +1,7 @@ -import {AnalyzerResult} from '../../analyze/types/analyzer-result'; -import {TransformerContext} from '../transformer-context'; -import * as schema from './schema'; -import {getReferenceForNode} from './utils'; +import {AnalyzerResult} from "../../analyze/types/analyzer-result"; +import {TransformerContext} from "../transformer-context"; +import * as schema from "./schema"; +import {getReferenceForNode} from "./utils"; function* getCustomElementExportsFromResult( result: AnalyzerResult, @@ -15,7 +15,7 @@ function* getCustomElementExportsFromResult( } yield { - kind: 'custom-element-definition', + kind: "custom-element-definition", name: definition.tagName, declaration: getReferenceForNode(definition.declaration.node, context) }; @@ -35,7 +35,7 @@ function* getExportedNamesFromResult( for (const exp of exports) { yield { - kind: 'js', + kind: "js", name: exp.name, declaration: getReferenceForNode(exp.valueDeclaration, context) }; diff --git a/src/transformers/custom-elements-manifest/transformer.ts b/src/transformers/custom-elements-manifest/transformer.ts index c738711..6ec86a4 100644 --- a/src/transformers/custom-elements-manifest/transformer.ts +++ b/src/transformers/custom-elements-manifest/transformer.ts @@ -1,15 +1,15 @@ -import * as tsModule from 'typescript'; -import {Program, SourceFile} from 'typescript'; -import {AnalyzerResult} from '../../analyze/types/analyzer-result'; -import {ComponentDeclaration} from '../../analyze/types/component-declaration'; -import {visitAllHeritageClauses} from '../../analyze/util/component-declaration-util'; -import {TransformerConfig} from '../transformer-config'; -import {TransformerFunction} from '../transformer-function'; -import * as schema from './schema'; -import {TransformerContext} from '../transformer-context'; -import {getExportsFromResult} from './get-exports'; -import {getDeclarationsFromResult} from './get-declarations'; -import {getRelativePath} from './utils'; +import * as tsModule from "typescript"; +import {Program, SourceFile} from "typescript"; +import {AnalyzerResult} from "../../analyze/types/analyzer-result"; +import {ComponentDeclaration} from "../../analyze/types/component-declaration"; +import {visitAllHeritageClauses} from "../../analyze/util/component-declaration-util"; +import {TransformerConfig} from "../transformer-config"; +import {TransformerFunction} from "../transformer-function"; +import * as schema from "./schema"; +import {TransformerContext} from "../transformer-context"; +import {getExportsFromResult} from "./get-exports"; +import {getDeclarationsFromResult} from "./get-declarations"; +import {getRelativePath} from "./utils"; /** * Transforms results to a custom elements manifest @@ -36,7 +36,7 @@ export const transformer: TransformerFunction = ( const modules = flattenedAnalyzerResults.map((result) => resultToModule(result, context)); const manifest: schema.Package = { - schemaVersion: '1.0.0', + schemaVersion: "1.0.0", modules }; @@ -56,7 +56,7 @@ function resultToModule( const declarations = [...getDeclarationsFromResult(result, context)]; return { - kind: 'javascript-module', + kind: "javascript-module", path: getRelativePath(result.sourceFile.fileName, context), declarations: declarations.length === 0 ? undefined : declarations, exports: exports.length === 0 ? undefined : exports diff --git a/src/transformers/custom-elements-manifest/utils.ts b/src/transformers/custom-elements-manifest/utils.ts index 986cba9..d40a28b 100644 --- a/src/transformers/custom-elements-manifest/utils.ts +++ b/src/transformers/custom-elements-manifest/utils.ts @@ -1,16 +1,16 @@ -import {basename, relative} from 'path'; -import {SimpleType} from 'ts-simple-type'; -import {Node, SourceFile, Type} from 'typescript'; -import {TransformerContext} from '../transformer-context'; -import {JsDoc} from '../../analyze/types/js-doc'; -import * as schema from 'custom-elements-manifest'; -import {getNodeName, resolveDeclarations} from '../../analyze/util/ast-util'; +import {basename, relative} from "path"; +import {SimpleType} from "ts-simple-type"; +import {Node, SourceFile, Type} from "typescript"; +import {TransformerContext} from "../transformer-context"; +import {JsDoc} from "../../analyze/types/js-doc"; +import * as schema from "custom-elements-manifest"; +import {getNodeName, resolveDeclarations} from "../../analyze/util/ast-util"; import { ComponentDeclaration, ComponentHeritageClause -} from '../../analyze/types/component-declaration'; -import {ComponentFeatureBase} from '../../analyze/types/features/component-feature'; -import {getTypeHintFromType} from '../../util/get-type-hint-from-type'; +} from "../../analyze/types/component-declaration"; +import {ComponentFeatureBase} from "../../analyze/types/features/component-feature"; +import {getTypeHintFromType} from "../../util/get-type-hint-from-type"; /** * Returns a Reference to a node @@ -105,7 +105,7 @@ export function getParameterFromJsDoc( for (const tag of jsDoc.tags) { const parsed = tag.parsed(); - if (parsed.tag === 'param' && parsed.name === name) { + if (parsed.tag === "param" && parsed.name === name) { return {description: parsed.description, typeHint: parsed.type}; } } @@ -120,7 +120,7 @@ export function getParameterFromJsDoc( export function getReturnFromJsDoc( jsDoc: JsDoc | undefined ): {description?: string; typeHint?: string} { - const tag = jsDoc?.tags?.find((tag) => ['returns', 'return'].includes(tag.tag)); + const tag = jsDoc?.tags?.find((tag) => tag.tag === "returns" || tag.tag === "return"); if (tag == null) { return {}; @@ -155,7 +155,7 @@ export function typeToSchemaType( * @param jsDoc */ export function getSummaryFromJsDoc(jsDoc: JsDoc | undefined): string | undefined { - const summaryTag = jsDoc?.tags?.find((tag) => tag.tag === 'summary'); + const summaryTag = jsDoc?.tags?.find((tag) => tag.tag === "summary"); if (summaryTag == null) { return undefined;