theme-check 1.12.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cffdb593f51dd3714a1e3d861ebd75e518c8c272781a1c108aecd9f05972370e
4
- data.tar.gz: 696290b60cc9475824c82a8c9543ce48c7e5ccd687a31c04cf87ecbd4ebe5ebb
3
+ metadata.gz: 6510c266c71be36555ad42b3de0dc88db11710ac631dd2d7292175764b3ce51f
4
+ data.tar.gz: d8eb627ff4f5de44cfea7a21049f37c42c007ff617fe2f07760ade8e1b0dc283
5
5
  SHA512:
6
- metadata.gz: 7df5112c720a4647202b67240c955fde5356c90b91fd29a30865b1e34e95bc955d5a562218bbdaa39d21e7ae501042b94de95444940419e98e319d2e880a0f19
7
- data.tar.gz: 654f7c3cce5ac06ff3499d4d801b0a27a84a0768bfd9961d824d8cf43123d8cdb64a698a91b24e7bb6be39f64cb4389d92248340b13fc23f61a20b3f9e48d41f
6
+ metadata.gz: 79f4683785b839a91731540fdf4b0e23d1d4f4a0a949aae3beb8637f651b8b0030ef5a3f9506da5de63109636410fc4cdb31616aade995442e61de43da4e2c55
7
+ data.tar.gz: 5dda4447bb00c1b4f225255c628d9f5ab6c5e17c619065681631d68953e3b0b4562a523a3c359a5e566007de0042282aec775f82dcecd05e2c4c5b4c8eee0003
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ v1.13.0 / 2023-01-04
3
+ ==================
4
+
5
+ * Add support for new sections liquid tag in theme check ([#694](https://github.com/Shopify/theme-check/issues/694))
6
+
2
7
  v1.12.1 / 2022-12-15
3
8
  ==================
4
9
 
@@ -1,4 +1,36 @@
1
1
  [
2
+ {
3
+ "category": "cart",
4
+ "deprecated": false,
5
+ "deprecation_reason": "",
6
+ "description": "",
7
+ "parameters": [
8
+
9
+ ],
10
+ "return_type": [
11
+ {
12
+ "type": "number",
13
+ "name": "",
14
+ "description": "",
15
+ "array_value": ""
16
+ }
17
+ ],
18
+ "examples": [
19
+ {
20
+ "name": "",
21
+ "description": "",
22
+ "syntax": "",
23
+ "path": "/cart",
24
+ "raw_liquid": "{{ cart | item_count_for_variant: 39888235757633 }}",
25
+ "parameter": false,
26
+ "display_type": "text",
27
+ "show_data_tab": true
28
+ }
29
+ ],
30
+ "summary": "Returns the total item count of a variant in the cart.",
31
+ "syntax": "cart | item_count_for_variant: {variant_id}",
32
+ "name": "item_count_for_variant"
33
+ },
2
34
  {
3
35
  "category": "collection",
4
36
  "deprecated": false,
@@ -1 +1 @@
1
- { "revision": "016ae22f41c987c61ca817075533d9d3deb0f64a" }
1
+ { "revision": "dc81fa4ea744b4fbd308801f059755084090fe42" }
@@ -568,7 +568,12 @@
568
568
  "data_from_file": ""
569
569
  },
570
570
  "return_type": [
571
-
571
+ {
572
+ "type": "array",
573
+ "name": "",
574
+ "description": "",
575
+ "array_value": "collection"
576
+ }
572
577
  ]
573
578
  },
574
579
  {
@@ -12407,12 +12412,12 @@
12407
12412
  }
12408
12413
  ],
12409
12414
  "summary": "Returns `true` when being referenced inside a section that's been rendered using the Product Recommendations API and\nthe Section Rendering API. Returns `false` if not.",
12410
- "name": "recommendations.performed?"
12415
+ "name": "performed?"
12411
12416
  },
12412
12417
  {
12413
12418
  "deprecated": false,
12414
12419
  "deprecation_reason": "",
12415
- "description": "If `recommendations.performed?` is `false`, then an [EmptyDrop](/api/liquid/basics#emptydrop) is returned.",
12420
+ "description": "If `performed?` is `false`, then an [EmptyDrop](/api/liquid/basics#emptydrop) is returned.",
12416
12421
  "examples": [
12417
12422
 
12418
12423
  ],
@@ -12430,7 +12435,7 @@
12430
12435
  {
12431
12436
  "deprecated": false,
12432
12437
  "deprecation_reason": "",
12433
- "description": "If `recommendations.performed` is `false`, then 0 is returned.",
12438
+ "description": "If `performed?` is `false`, then 0 is returned.",
12434
12439
  "examples": [
12435
12440
 
12436
12441
  ],
@@ -12448,7 +12453,7 @@
12448
12453
  {
12449
12454
  "deprecated": false,
12450
12455
  "deprecation_reason": "",
12451
- "description": "If `recommendations.performed` is `false`, then `nil` is returned.",
12456
+ "description": "If `performed?` is `false`, then `nil` is returned.",
12452
12457
  "examples": [
12453
12458
 
12454
12459
  ],
@@ -15075,12 +15080,7 @@
15075
15080
 
15076
15081
  ],
15077
15082
  "return_type": [
15078
- {
15079
- "type": "metafield",
15080
- "name": "",
15081
- "description": "",
15082
- "array_value": ""
15083
- }
15083
+
15084
15084
  ],
15085
15085
  "summary": "The [metafields](/api/liquid/objects/metafield) applied to the store.",
15086
15086
  "name": "metafields"
@@ -11,6 +11,7 @@ This rule verifies none of the below tags are used in theme app extension blocks
11
11
  - `{% include 'foo' %}`
12
12
  - `{% layout 'foo' %}`
13
13
  - `{% section 'foo' %}`
14
+ - `{% sections 'foo' %}`
14
15
 
15
16
  :-1: **Incorrect** code for this check occurs with the use of any of the above tags in the liquid code of theme app extension blocks.
16
17
 
@@ -32,5 +32,9 @@ module ThemeCheck
32
32
  def on_section(node)
33
33
  add_offense(OFFENSE_MSG % 'section', node: node)
34
34
  end
35
+
36
+ def on_sections(node)
37
+ add_offense(OFFENSE_MSG % 'sections', node: node)
38
+ end
35
39
  end
36
40
  end
@@ -22,6 +22,24 @@ module ThemeCheck
22
22
  end
23
23
  end
24
24
 
25
+ class Sections < Liquid::Tag
26
+ SYNTAX = /\A\s*(?<sections_name>#{Liquid::QuotedString})\s*\z/o
27
+
28
+ attr_reader :sections_name
29
+
30
+ def initialize(tag_name, markup, options)
31
+ super
32
+
33
+ match = markup.match(SYNTAX)
34
+ raise(
35
+ Liquid::SyntaxError,
36
+ "Error in tag 'sections' - Valid syntax: sections '[type]'",
37
+ ) unless match
38
+ @sections_name = match[:sections_name].tr(%('"), '')
39
+ @sections_name.chomp!(".liquid") if @sections_name.end_with?(".liquid")
40
+ end
41
+ end
42
+
25
43
  class Form < Liquid::Block
26
44
  TAG_ATTRIBUTES = /([\w\-]+)\s*:\s*(#{Liquid::QuotedFragment})/o
27
45
  # Matches forms with arguments:
@@ -204,6 +222,7 @@ module ThemeCheck
204
222
  register_tag('render', Render)
205
223
  register_tag('paginate', Paginate)
206
224
  register_tag('section', Section)
225
+ register_tag('sections', Sections)
207
226
  register_tag('style', Style)
208
227
  register_tag('schema', Schema)
209
228
  register_tag('javascript', Javascript)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "1.12.1"
3
+ VERSION = "1.13.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theme-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Cournoyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid