Skip to content

Commit

Permalink
chore(): misc refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaskiewicz committed Apr 18, 2024
1 parent 4fd647d commit 644ef96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/contributions/html-contributions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ describe('generateElementInfo', () => {
});

/**
* Attribution: https://github.com/ionic-team/stencil/blob/85221bca12087f658328f05aba3f038c5abd4abf/src/compiler/types/tests/ComponentCompilerMeta.stub.ts#L10
*
* Generates a stub {@link ComponentCompilerMeta}. This function uses sensible defaults for the initial stub. However,
* any field in the object may be overridden via the `overrides` argument.
* @param overrides a partial implementation of `ComponentCompilerMeta`. Any provided fields will override the
Expand Down
12 changes: 6 additions & 6 deletions src/contributions/html-contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { ElementInfo } from '../index';
// https://github.com/JetBrains/web-types/blob/2c07137416e4151bfaf44bf3226dca7f1a5e9bd3/schema/web-types.json#L922
/**
* Generate an array of symbol contributions to the HTML namespace
* @param components the Stencil components to generate info for to contribute to the HTML namespace
* @param compnentMetadata the Stencil component metadata to generate info for to contribute to the HTML namespace
*/
export const generateElementInfo = (components: ComponentCompilerMeta[]): ElementInfo[] => {
return components.map((cmpMeta: ComponentCompilerMeta): ElementInfo => {
export const generateElementInfo = (compnentMetadata: ComponentCompilerMeta[]): ElementInfo[] => {
return compnentMetadata.map((cmpMeta: ComponentCompilerMeta): ElementInfo => {
return {
name: cmpMeta.tagName,
deprecated: !!cmpMeta.docs.tags.find((tag) => tag.name.toLowerCase() === 'deprecated'),
Expand All @@ -31,11 +31,11 @@ export const generateElementInfo = (components: ComponentCompilerMeta[]): Elemen
.map((slotTag: CompilerJsDocTagInfo) => {
// Stencil supports the following ways of recording slot data in a class component's JSDoc:
// 1. Document a default slot, with a description:
// @slot - Content is placed between the named slots if provided without a slot.
// `@slot - Content is placed between the named slots if provided without a slot.`
// 2. Document a named slot, without a description:
// @slot primary
// `@slot primary`
// 3. Document a named slot, without a description:
// @slot secondary - Content is placed to the right of the main slotted-in text.
// `@slot secondary - Content is placed to the right of the main slotted-in text.`
// Split on the first '-' to differentiate between the name and the description
const [first, ...rest] = slotTag.text!.split('-');

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { generateJsEvents, generateJsProperties } from './contributions/js-contr
export const webTypesOutputTarget = (): OutputTargetCustom => ({
type: 'custom',
name: 'web-types',
// TODO(NOW)
validate(config: Config, diagnostics: Diagnostic[]) {
return true;
},
Expand Down

0 comments on commit 644ef96

Please sign in to comment.