Skip to content

Commit

Permalink
cleanup & prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 committed Aug 27, 2024
1 parent f4f0630 commit 40d16b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export function transformExportMetaToDefineMeta(
): VariableDeclaration {
const { declaration, leadingComments, start, end } = exportMeta;
if (!declaration || declaration.type !== 'VariableDeclaration') {
throw new Error("Invalid syntax - 'export meta' declaration was empty or not a variable declaration");
throw new Error(
"Invalid syntax - 'export meta' declaration was empty or not a variable declaration"
);
}
const { declarations } = declaration;
const { init } = declarations[0];
Expand Down
3 changes: 0 additions & 3 deletions src/compiler/pre-transform/codemods/legacy-story.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ describe(transformLegacyStory.name, () => {
it("transforms 'template' prop to 'children' and text expression becomes expression tag with identifier to snippet", async ({
expect,
}) => {
// TODO: Check if warning was emitted?
const code = `
<script context="module">
import { Story } from "@storybook/addon-svelte-csf";
Expand All @@ -151,7 +150,6 @@ describe(transformLegacyStory.name, () => {
it("when directive 'let:args' is used then it wraps Story fragment with 'children' snippet block", async ({
expect,
}) => {
// TODO: Check if warning was emitted?
const code = `
<script context="module">
import { Story } from "@storybook/addon-svelte-csf";
Expand All @@ -175,7 +173,6 @@ describe(transformLegacyStory.name, () => {
it("when directive 'let:context' is used then it wraps Story fragment with 'children' snippet block", async ({
expect,
}) => {
// TODO: Check if warning was emitted?
const code = `
<script context="module">
import { Story } from "@storybook/addon-svelte-csf";
Expand Down
3 changes: 0 additions & 3 deletions src/compiler/pre-transform/codemods/legacy-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
createASTProperty,
} from '#parser/ast';
import { InvalidTemplateAttribute } from '#utils/error/codemod/index';
import { storyNameToExportName } from '#utils/identifier-utils';

interface Params {
node: Component;
Expand Down Expand Up @@ -197,8 +196,6 @@ function transformSource(params: InsertSourceParams): void {
((parameters.value as ExpressionTag[])[0].expression as ObjectExpression).properties.push(
docsProperty
);
} else {
// TODO: Create a warning?
}

newAttributes.push(parameters);
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export function defineMeta<

export type Args<TStoryCmp> =
TStoryCmp extends StoryCmp<infer _TOverrideArgs, infer TCmpOrArgs, infer TMeta>
? NonNullable<StoryAnnotations<TCmpOrArgs, TMeta>['args']>
: never;
? NonNullable<StoryAnnotations<TCmpOrArgs, TMeta>['args']>
: never;

export type StoryContext<TStoryCmp> =
TStoryCmp extends StoryCmp<infer _TOverrideArgs, infer TCmpOrArgs, infer TMeta>
? BaseStoryContext<TCmpOrArgs, TMeta>
: never;
? BaseStoryContext<TCmpOrArgs, TMeta>
: never;

// TODO: Remove in next major release
export {
Expand Down

0 comments on commit 40d16b7

Please sign in to comment.