Skip to content

Commit

Permalink
fix: error message when args used with tag tag
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Mar 22, 2022
1 parent 497a87d commit d56d991
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/__tests__/fixtures/tag/templates/error-args.marko(1,2): The <tag> tag does not support attributes.
src/__tests__/fixtures/tag/templates/error-args.marko(1,2): The <tag> tag does not support arguments.
> 1 | <tag(y)/myTag|{ name }|>
| ^^^
2 | <div>Hello ${name}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/__tests__/fixtures/tag/templates/error-args.marko(1,2): The <tag> tag does not support attributes.
src/__tests__/fixtures/tag/templates/error-args.marko(1,2): The <tag> tag does not support arguments.
> 1 | <tag(y)/myTag|{ name }|>
| ^^^
2 | <div>Hello ${name}</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/tag/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export = {
enter(tag: t.NodePath<t.MarkoTag>) {
const tagVar = tag.node.var! as t.Identifier;
const body = tag.node.body;
const errorMessage = tag.node.attributes.length
const errorMessage = tag.node.arguments
? "does not support arguments"
: tag.node.attributes.length
? "does not support attributes"
: !tagVar
? "requires a tag variable"
: !t.isIdentifier(tagVar)
? "cannot have a destructured tag variable"
: tag.node.arguments
? "does not support arguments"
: !body.body.length
? "requires body content"
: undefined;
Expand Down

0 comments on commit d56d991

Please sign in to comment.