Skip to content

Commit

Permalink
post-fix code-suggestion (missing removal of extra })
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 committed Sep 5, 2024
1 parent 977d65e commit 5ad4c30
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/compiler/pre-transform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,32 +113,31 @@ export async function codemodLegacyNodes(params: Params): Promise<Root> {
)) {
return;
}
const transformed = transformExportMetaToDefineMeta(node);
const { currentScript } = state;
const transformed = transformExportMetaToDefineMeta(node);
const { currentScript } = state;

if (currentScript === 'instance') {
state.defineMetaFromExportConstMeta = transformed;
}
if (currentScript === 'instance') {
state.defineMetaFromExportConstMeta = transformed;
}

// NOTE:
// Type assertion because we already ran transform codemod function by this point (`transformed`).
// So the possible issue is on our side, not user.
const { init } = declaration.declarations[0] as ObjectExpression;
// NOTE:
// Type assertion because we already ran transform codemod function by this point (`transformed`).
// So the possible issue is on our side, not user.
const { init } = declaration.declarations[0] as ObjectExpression;

const { properties } = init;
const { properties } = init;

for (const property of properties) {
if (
property.type === 'Property' &&
property.key.name === 'component' &&
property.value.type === 'Identifier'
) {
state.storiesComponentIdentifier = property.value;
}
for (const property of properties) {
if (
property.type === 'Property' &&
property.key.name === 'component' &&
property.value.type === 'Identifier'
) {
state.storiesComponentIdentifier = property.value;
}

return transformed;
}

return transformed;
},

Fragment(_node, context) {
Expand Down

0 comments on commit 5ad4c30

Please sign in to comment.