theme-check 1.10.0 → 1.10.3

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: 542ffd23d66103c0ad13f740b9838c28ed1ef010faed69a9066a6301ed0e9692
4
- data.tar.gz: fdaa5345072521c1467ca5dc8c17d3460e5e299fbceed14b242bb27dc2001ca3
3
+ metadata.gz: c2774c1d3e2e9b8fa7dab0fdd4174dbfd3e625c608af349c30f526f00a6b9123
4
+ data.tar.gz: 69bdb078be8aa938b2dec75a62206840586ae1a015620ec3c9ce727e49fc2e07
5
5
  SHA512:
6
- metadata.gz: 4c0897c7d37ada167a220691d892879884fa3ef82539fd9b649e4b8f9ab10d813907bb77420a471ff3545c192a7794378fcf19acdb16a9a866715c49d2a5f03a
7
- data.tar.gz: 5543d2dafa855b025a28a3dc83742896d90ad8eba4c3bcb4b2bbea41fbd9c89b1f3a2695354bc35c62af4e8ca460d68ac6d5b3f4fa47032b218fe31eb8b70015
6
+ metadata.gz: aa83efd1994e95fd12defc06b13567fac6e80fd830fb870f7a50b650424b8ed339848271ac35c608b6bc40a3e884665a3136c1f75e150be937be8b78e74df9fc
7
+ data.tar.gz: 848e2752ecc6e6bb4b0954663dac298f869a191d0b4b146fd488b8a9a442a5573a1c716c84658b2654431f96db1572309c70991a2e29e37c1bf82bd337c79edd
data/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
1
 
2
+ v1.10.3 / 2022-06-16
3
+ ==================
4
+
5
+ * Support app drop in theme app extensions ([#566](https://github.com/shopify/theme-check/issues/566))
6
+ * Fix requiring custom check when root is specified ([#565](https://github.com/shopify/theme-check/issues/565))
7
+ * Fix TranslationKeyExists.on_end issue ([#587](https://github.com/shopify/theme-check/issues/587))
8
+ * Fix bad link on check documentation ([#575](https://github.com/shopify/theme-check/issues/575))
9
+ * Update TEMPLATE.md.erb to use shopify.dev URL
10
+ * Fixed broken URL ([#574](https://github.com/shopify/theme-check/issues/574))
11
+ * Fix unknown configuration issue for UndefinedObject checker ([#568](https://github.com/shopify/theme-check/issues/568))
12
+
13
+ v1.10.2 / 2022-03-07
14
+ ====================
15
+
16
+ * Handle nil paths in json_printer's sort_by ([#561](https://github.com/shopify/theme-check/issues/561))
17
+ * Prevent bad render tags from passing theme-check ([#559](https://github.com/shopify/theme-check/issues/559))
18
+
19
+ v1.10.1 / 2022-02-24
20
+ ====================
21
+
22
+ * Revert "Prevent bad render tags from passing theme-check ([#551](https://github.com/shopify/theme-check/issues/551))"
23
+
2
24
  v1.10.0 / 2022-02-24
3
25
  ====================
4
26
 
data/RELEASING.md CHANGED
@@ -73,11 +73,11 @@
73
73
 
74
74
  1. Release `theme-check` on RubyGems by following the steps in the previous section.
75
75
 
76
- 2. Update the `theme-check` version in [`shopify-cli`](https://github.com/shopify/shopify-cli)'s `Gemfile.lock` and `shopify-cli.gemspec` files.
76
+ 2. Update the `theme-check` version in [`shopify-cli`](https://github.com/shopify/shopify-cli)'s `shopify-cli.gemspec` file.
77
77
 
78
- Such as in [this PR.](https://github.com/Shopify/shopify-cli/pull/1357/files)
78
+ 3. Run `bundle update theme-check` and get an updated `Gemfile.lock`
79
79
 
80
- 3. Create a branch + a commit on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
80
+ 4. Create a branch + a commit on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
81
81
 
82
82
  ```bash
83
83
  VERSION=X.X.X
@@ -87,7 +87,7 @@
87
87
  git commit -m "Bump theme-check version to $VERSION"
88
88
  ```
89
89
 
90
- 4. Create a pull-request for those changes on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
90
+ 5. Create a pull-request for those changes on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
91
91
 
92
92
  ```bash
93
93
  # shortcut if you have `hub` installed
data/config/default.yml CHANGED
@@ -101,6 +101,7 @@ UndefinedObject:
101
101
  enabled: true
102
102
  ignore: []
103
103
  exclude_snippets: true
104
+ config_type: :default
104
105
 
105
106
  RequiredDirectories:
106
107
  enabled: true
@@ -89,6 +89,7 @@ UndefinedObject:
89
89
  enabled: true
90
90
  ignore: []
91
91
  exclude_snippets: true
92
+ config_type: :theme_app_extension
92
93
 
93
94
  RequiredDirectories:
94
95
  enabled: false
@@ -0,0 +1,2 @@
1
+ ---
2
+ - app
data/docs/api/check.md CHANGED
@@ -12,4 +12,4 @@ There are three types of checks currently supported:
12
12
 
13
13
  - [`LiquidCheck`](/docs/api/liquid_check.md)
14
14
  - [`HtmlCheck`](/docs/api/html_check.md)
15
- - [`JsonCheck`](/docs/api/html_check.md)
15
+ - [`JsonCheck`](/docs/api/json_check.md)
@@ -34,7 +34,7 @@ The following example contains the default configuration for this check:
34
34
  | Parameter | Description |
35
35
  | --- | --- |
36
36
  | enabled | Whether the check is enabled. |
37
- | severity | The [severity](https://shopify.developers/themes/tools/theme-check/configuration#check-severity) of the check. |
37
+ | severity | The [severity](https://shopify.dev/themes/tools/theme-check/configuration#check-severity) of the check. |
38
38
  | other_option | A description of the option. |
39
39
 
40
40
  ## Disabling this check
@@ -59,7 +59,7 @@ SchemaJsonFormat:
59
59
  | Parameter | Description |
60
60
  | --- | --- |
61
61
  | enabled | Whether the check is enabled. |
62
- | severity | The [severity](https://shopify.developers/themes/tools/theme-check/configuration#check-severity) of the check. |
62
+ | severity | The [severity](https://shopify.dev/themes/tools/theme-check/configuration#check-severity) of the check. |
63
63
  | start_level | The indentation level. If you prefer an indented schema, set this to 1. |
64
64
  | indent | The character(s) used for indentation levels. |
65
65
 
@@ -48,6 +48,7 @@ module ThemeCheck
48
48
 
49
49
  def key_exists?(key, pointer)
50
50
  key.split(".").each do |token|
51
+ return false unless pointer.is_a?(Hash)
51
52
  return false unless pointer.key?(token)
52
53
  pointer = pointer[token]
53
54
  end
@@ -55,7 +55,8 @@ module ThemeCheck
55
55
  end
56
56
  end
57
57
 
58
- def initialize(exclude_snippets: true)
58
+ def initialize(config_type: :default, exclude_snippets: true)
59
+ @config_type = config_type
59
60
  @exclude_snippets = exclude_snippets
60
61
  @files = {}
61
62
  end
@@ -111,6 +112,9 @@ module ThemeCheck
111
112
  shopify_plus_objects = ThemeCheck::ShopifyLiquid::Object.plus_labels
112
113
  shopify_plus_objects.freeze
113
114
 
115
+ theme_app_extension_objects = ThemeCheck::ShopifyLiquid::Object.theme_app_extension_labels
116
+ theme_app_extension_objects.freeze
117
+
114
118
  each_template do |(name, info)|
115
119
  if 'templates/customers/reset_password' == name
116
120
  # NOTE: `email` is exceptionally exposed as a theme object in
@@ -121,6 +125,8 @@ module ThemeCheck
121
125
  # the checkout template
122
126
  # https://shopify.dev/docs/themes/theme-templates/checkout-liquid#optional-objects
123
127
  check_object(info, all_global_objects + shopify_plus_objects)
128
+ elsif config_type == :theme_app_extension
129
+ check_object(info, all_global_objects + theme_app_extension_objects)
124
130
  else
125
131
  check_object(info, all_global_objects)
126
132
  end
@@ -129,6 +135,8 @@ module ThemeCheck
129
135
 
130
136
  private
131
137
 
138
+ attr_reader :config_type
139
+
132
140
  def ignore?(node)
133
141
  @exclude_snippets && node.theme_file.snippet?
134
142
  end
@@ -209,7 +209,8 @@ module ThemeCheck
209
209
 
210
210
  def resolve_requires
211
211
  self["require"]&.each do |path|
212
- require(File.join(@root, path))
212
+ file_to_require = @root.join(path).realpath
213
+ require(file_to_require.to_s)
213
214
  end
214
215
  end
215
216
  end
@@ -25,7 +25,7 @@ module ThemeCheck
25
25
  styleCount: path_offenses.count { |offense| offense[:severity] == Check::SEVERITY_VALUES[:style] },
26
26
  }
27
27
  end
28
- .sort_by { |o| o[:path] }
28
+ .sort_by { |o| o[:path] || Pathname.new('') }
29
29
  end
30
30
  end
31
31
  end
@@ -13,6 +13,10 @@ module ThemeCheck
13
13
  def plus_labels
14
14
  @plus_labels ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/plus_objects.yml"))
15
15
  end
16
+
17
+ def theme_app_extension_labels
18
+ @theme_app_extension_labels ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/theme_app_extension_objects.yml"))
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -125,7 +125,23 @@ module ThemeCheck
125
125
  end
126
126
 
127
127
  class Render < Liquid::Tag
128
- SYNTAX = /((?:#{Liquid::QuotedString}|\A#{Liquid::VariableSegment})+)(\s+(with|#{Liquid::Render::FOR})\s+(#{Liquid::QuotedFragment}+))?(\s+(?:as)\s+(#{Liquid::VariableSegment}+))?/o
128
+ SYNTAX = %r{
129
+ (
130
+ ## for {% render "snippet" %}
131
+ #{Liquid::QuotedString}+ |
132
+ ## for {% render block %}
133
+ ## We require the variable # segment to be at the beginning of the
134
+ ## string (with \A). This is to prevent code like {% render !foo! %}
135
+ ## from parsing
136
+ \A#{Liquid::VariableSegment}+
137
+ )
138
+ ## for {% render "snippet" with product as p %}
139
+ ## or {% render "snippet" for products p %}
140
+ (\s+(with|#{Liquid::Render::FOR})\s+(#{Liquid::QuotedFragment}+))?
141
+ (\s+(?:as)\s+(#{Liquid::VariableSegment}+))?
142
+ ## variables passed into the tag (e.g. {% render "snippet", var1: value1, var2: value2 %}
143
+ ## are not matched by this regex and are handled by Liquid::Render.initialize
144
+ }xo
129
145
 
130
146
  disable_tags "include"
131
147
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ThemeCheck
3
- VERSION = "1.10.0"
3
+ VERSION = "1.10.3"
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.10.0
4
+ version: 1.10.3
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-02-24 00:00:00.000000000 Z
11
+ date: 2022-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -84,6 +84,7 @@ files:
84
84
  - data/shopify_liquid/objects.yml
85
85
  - data/shopify_liquid/plus_objects.yml
86
86
  - data/shopify_liquid/tags.yml
87
+ - data/shopify_liquid/theme_app_extension_objects.yml
87
88
  - data/shopify_translation_keys.yml
88
89
  - dev.yml
89
90
  - docs/api/check.md
@@ -300,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
301
  - !ruby/object:Gem::Version
301
302
  version: '0'
302
303
  requirements: []
303
- rubygems_version: 3.2.20
304
+ rubygems_version: 3.3.3
304
305
  signing_key:
305
306
  specification_version: 4
306
307
  summary: A Shopify Theme Linter