-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
content_for
tag parser support + ValidContentForArguments
check
Fixes #466
- Loading branch information
1 parent
6af0983
commit f80a511
Showing
29 changed files
with
499 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@shopify/theme-check-browser': minor | ||
'@shopify/theme-check-common': minor | ||
'@shopify/theme-check-node': minor | ||
--- | ||
|
||
Add the `ValidContentForArguments` check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@shopify/liquid-html-parser': minor | ||
'@shopify/prettier-plugin-liquid': minor | ||
'@shopify/theme-language-server-common': minor | ||
--- | ||
|
||
Add support for the `content_for` Liquid tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/prettier-plugin-liquid/src/test/liquid-tag-content-for/fixed.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
It should never break a name | ||
printWidth: 1 | ||
{% content_for 'block' %} | ||
{%- content_for 'blocks' -%} | ||
|
||
It should break on named args | ||
printWidth: 1 | ||
{% content_for 'block', | ||
key1: val1, | ||
key2: (0..1) | ||
%} | ||
|
||
It should not require commas (as per syntax) but add them when pretty printed | ||
{% content_for 'block', key1: val1, key2: (0..1) %} | ||
|
||
It should not require spaces (as per syntax) but add them when pretty printed | ||
{% content_for 'block', key1: val1, key2: (0..1) %} | ||
|
||
It should strip trailing commas by default | ||
{% content_for 'foo' %} | ||
{% content_for 'foo', product: product %} |
18 changes: 18 additions & 0 deletions
18
packages/prettier-plugin-liquid/src/test/liquid-tag-content-for/index.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
It should never break a name | ||
printWidth: 1 | ||
{% content_for "block" %} | ||
{%- content_for "blocks" -%} | ||
|
||
It should break on named args | ||
printWidth: 1 | ||
{% content_for "block", key1: val1, key2: (0..1) %} | ||
|
||
It should not require commas (as per syntax) but add them when pretty printed | ||
{% content_for "block" key1: val1 key2: (0..1) %} | ||
|
||
It should not require spaces (as per syntax) but add them when pretty printed | ||
{%content_for "block",key1:val1,key2:(0..1)%} | ||
|
||
It should strip trailing commas by default | ||
{% content_for "foo", %} | ||
{% content_for "foo",product:product, %} |
6 changes: 6 additions & 0 deletions
6
packages/prettier-plugin-liquid/src/test/liquid-tag-content-for/index.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test } from 'vitest'; | ||
import { assertFormattedEqualsFixed } from '../test-helpers'; | ||
|
||
test('Unit: liquid-tag-content-for', async () => { | ||
await assertFormattedEqualsFixed(__dirname); | ||
}); |
Oops, something went wrong.