Skip to content

Commit

Permalink
fix: if directive migration for else tags should not migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Aug 18, 2023
1 parent 22d876e commit 0044e93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-planets-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/compat-v4": patch
---

Fix issue where if directive migration was running on valid else tags
8 changes: 7 additions & 1 deletion packages/compat-v4/src/migrate/if-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export default {
}

const tag = attr.parentPath as t.NodePath<t.MarkoTag>;
if (willMigrateAllAttrs(tag)) return;
if (
(tag.node.name.type === "StringLiteral" &&
tag.node.name.value === "if") ||
willMigrateAllAttrs(tag)
) {
return;
}

diagnosticDeprecate(attr, {
label: `The "${name}" directive is deprecated. Please use "<${name}>" tag instead. See: https://github.com/marko-js/marko/wiki/Deprecation:-control-flow-attributes`,
Expand Down

0 comments on commit 0044e93

Please sign in to comment.