theme-check 0.10.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/theme-check.yml +2 -6
- data/CHANGELOG.md +41 -0
- data/README.md +39 -0
- data/RELEASING.md +34 -2
- data/Rakefile +1 -1
- data/config/default.yml +39 -3
- data/config/nothing.yml +11 -0
- data/config/theme_app_extension.yml +153 -0
- data/data/shopify_liquid/objects.yml +2 -0
- data/docs/checks/asset_size_app_block_css.md +52 -0
- data/docs/checks/asset_size_app_block_javascript.md +57 -0
- data/docs/checks/asset_size_css_stylesheet_tag.md +50 -0
- data/docs/checks/deprecate_bgsizes.md +66 -0
- data/docs/checks/deprecate_lazysizes.md +61 -0
- data/docs/checks/html_parsing_error.md +50 -0
- data/docs/checks/liquid_tag.md +2 -2
- data/docs/checks/template_length.md +12 -2
- data/exe/theme-check-language-server.bat +3 -0
- data/exe/theme-check.bat +3 -0
- data/lib/theme_check.rb +15 -0
- data/lib/theme_check/analyzer.rb +25 -21
- data/lib/theme_check/asset_file.rb +3 -15
- data/lib/theme_check/bug.rb +3 -1
- data/lib/theme_check/check.rb +24 -2
- data/lib/theme_check/checks/asset_size_app_block_css.rb +44 -0
- data/lib/theme_check/checks/asset_size_app_block_javascript.rb +44 -0
- data/lib/theme_check/checks/asset_size_css.rb +11 -74
- data/lib/theme_check/checks/asset_size_css_stylesheet_tag.rb +24 -0
- data/lib/theme_check/checks/asset_size_javascript.rb +10 -36
- data/lib/theme_check/checks/deprecate_bgsizes.rb +14 -0
- data/lib/theme_check/checks/deprecate_lazysizes.rb +16 -0
- data/lib/theme_check/checks/html_parsing_error.rb +12 -0
- data/lib/theme_check/checks/img_lazy_loading.rb +1 -6
- data/lib/theme_check/checks/liquid_tag.rb +2 -2
- data/lib/theme_check/checks/remote_asset.rb +2 -0
- data/lib/theme_check/checks/space_inside_braces.rb +1 -1
- data/lib/theme_check/checks/template_length.rb +18 -4
- data/lib/theme_check/cli.rb +34 -13
- data/lib/theme_check/config.rb +56 -10
- data/lib/theme_check/exceptions.rb +29 -27
- data/lib/theme_check/html_check.rb +2 -0
- data/lib/theme_check/html_visitor.rb +3 -1
- data/lib/theme_check/json_file.rb +2 -29
- data/lib/theme_check/language_server/constants.rb +8 -0
- data/lib/theme_check/language_server/document_link_engine.rb +40 -4
- data/lib/theme_check/language_server/handler.rb +1 -1
- data/lib/theme_check/language_server/server.rb +13 -2
- data/lib/theme_check/liquid_check.rb +0 -12
- data/lib/theme_check/parsing_helpers.rb +3 -1
- data/lib/theme_check/regex_helpers.rb +17 -0
- data/lib/theme_check/tags.rb +62 -8
- data/lib/theme_check/template.rb +3 -32
- data/lib/theme_check/theme_file.rb +40 -0
- data/lib/theme_check/version.rb +1 -1
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28cb25e47867151bea85360a9f07667f46ea30ad90285f16cc74e85370ad39d9
|
4
|
+
data.tar.gz: 2023811dad002a72f00e2c26562ff3e6b5f2f49c748d44968fd94d1f9e72300f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a5339873aea7a325cbc3f3715e9166b1f7734226e3d9ac7b400f048629a514f3eec5d559c77eaf70febacda35416b8332d8d1a6ebefa1d9a34f29474a4e41d
|
7
|
+
data.tar.gz: 19eec11d1eb86188fe170bce61f884072340d848e800b2bb2b344cddf3561d60594e4f066199b7f9157b54da81ce8afebc5e6db0f3dbfbc5fac208c95d2b5ed8
|
@@ -1,10 +1,6 @@
|
|
1
1
|
name: ThemeCheck
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ master ]
|
3
|
+
on: [push]
|
8
4
|
|
9
5
|
jobs:
|
10
6
|
test:
|
@@ -36,4 +32,4 @@ jobs:
|
|
36
32
|
run: bundle exec rake
|
37
33
|
- name: Test runtime
|
38
34
|
# Testing that runtime can execute, not testing the results themselves
|
39
|
-
run: bundle exec theme-check ./test/theme | grep -q "files inspected"
|
35
|
+
run: bundle exec theme-check ./test/theme | grep -q "files inspected"
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,45 @@
|
|
1
1
|
|
2
|
+
v1.2.0 / 2021-07-15
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Add Windows Support ([#364](https://github.com/shopify/theme-check/issues/364))
|
6
|
+
* Ignore empty `{{}}` in SpaceInsideBraces ([#350](https://github.com/shopify/theme-check/issues/350))
|
7
|
+
* Switch to main branch
|
8
|
+
* Minor documentation fixes
|
9
|
+
|
10
|
+
v1.1.0 / 2021-07-06
|
11
|
+
==================
|
12
|
+
|
13
|
+
* Add `--fail-level` CLI flag to configure exit code
|
14
|
+
* Refactor all theme file classes to inherit from `ThemeFile`
|
15
|
+
* Fix `undefined method liquid?` error when scanning from LSP
|
16
|
+
* Adding asset document links
|
17
|
+
* Allow initializing theme app extension configuration files
|
18
|
+
* Allow disabling registering mock Liquid tags w/ `ThemeCheck::Tags.register_tags = false`
|
19
|
+
* Support Theme App Extensions
|
20
|
+
* Add checks for theme app extension block JS/CSS
|
21
|
+
* Disable Liquid::C when parsing Liquid templates
|
22
|
+
|
23
|
+
v1.0.0 / 2021-06-28
|
24
|
+
==================
|
25
|
+
|
26
|
+
* Convert `AssetSizeCSS` to `HtmlCheck`
|
27
|
+
* Add `DeprecateLazysizes` & `DeprecateBgsizes` checks
|
28
|
+
* Allow hardcoded CDN urls in `RemoteAsset`
|
29
|
+
* Bump `LiquidTag` `min_consecutive_statements` default to 5
|
30
|
+
* Exclude {% javascript %} and {% stylesheet %} from line counts in `TemplateLength`
|
31
|
+
* Bump `TemplateLength` `max_length` default to 500
|
32
|
+
* Fix `StringScanner#skip(String)` not being supported on some Rubies
|
33
|
+
* Fix `ParsingHelpers#outside_of_strings` handling of empty strings
|
34
|
+
* Update to support new `{% render %}` syntax
|
35
|
+
* Converted `AssetSizeJavaScript` to `HtmlCheck`
|
36
|
+
|
37
|
+
v0.10.2 / 2021-06-18
|
38
|
+
==================
|
39
|
+
|
40
|
+
* Fix error when parsing a template with lots of HTML attributes.
|
41
|
+
* Add `HtmlParsingError` check for reporting errors during HTML parsing.
|
42
|
+
|
2
43
|
v0.10.1 / 2021-06-11
|
3
44
|
==================
|
4
45
|
|
data/README.md
CHANGED
@@ -100,6 +100,8 @@ TemplateLength:
|
|
100
100
|
# Or ignore certain paths
|
101
101
|
ignore:
|
102
102
|
- snippets/icon-*
|
103
|
+
# Or change the severity (error|suggestion|style)
|
104
|
+
severity: suggestion
|
103
105
|
|
104
106
|
# Enable a custom check
|
105
107
|
MyCustomCheck
|
@@ -141,3 +143,40 @@ Disable checks for the _entire document_ by placing the comment on the first lin
|
|
141
143
|
|
142
144
|
{%assign x = 1%}
|
143
145
|
```
|
146
|
+
|
147
|
+
## Exit Code and `--fail-level`
|
148
|
+
|
149
|
+
Use the `--fail-level` (default: `error`) flag to configure the exit code of theme-check. Useful in CI scenarios.
|
150
|
+
|
151
|
+
Example:
|
152
|
+
|
153
|
+
```
|
154
|
+
# Make CI fail on styles warnings, suggestions, and errors
|
155
|
+
theme-check --fail-level style path_to_theme
|
156
|
+
|
157
|
+
# Make CI fail on suggestions, and errors
|
158
|
+
theme-check --fail-level suggestion path_to_theme
|
159
|
+
|
160
|
+
# Make CI fail on errors
|
161
|
+
theme-check path_to_theme
|
162
|
+
```
|
163
|
+
|
164
|
+
There are three fail levels:
|
165
|
+
|
166
|
+
- `error`
|
167
|
+
- `suggestion`
|
168
|
+
- `style`
|
169
|
+
|
170
|
+
Exit code meanings:
|
171
|
+
|
172
|
+
- 0: Success!
|
173
|
+
- 1: Your code doesn't pass the checks
|
174
|
+
- 2: There's a bug in theme-check
|
175
|
+
|
176
|
+
If you would like to change the severity of a check, you can do so with the `severity` attribute. Example:
|
177
|
+
|
178
|
+
```yaml
|
179
|
+
DeprecateLazysizes:
|
180
|
+
enabled: true
|
181
|
+
severity: error
|
182
|
+
```
|
data/RELEASING.md
CHANGED
@@ -13,7 +13,14 @@
|
|
13
13
|
|
14
14
|
4. Commit your changes and make a PR.
|
15
15
|
|
16
|
-
|
16
|
+
```bash
|
17
|
+
git checkout -b "bump/theme-check-$VERSION"
|
18
|
+
git add docs/checks CHANGELOG.md lib/theme_check/version.rb
|
19
|
+
git commit -m "Bump theme-check version to $VERSION"
|
20
|
+
hub compare "main:bump/theme-check-$VERSION"
|
21
|
+
```
|
22
|
+
|
23
|
+
5. Merge your PR to main.
|
17
24
|
|
18
25
|
6. On [Shipit](https://shipit.shopify.io/shopify/theme-check/rubygems), deploy your commit.
|
19
26
|
|
@@ -46,5 +53,30 @@
|
|
46
53
|
|
47
54
|
```bash
|
48
55
|
# shortcut if you have `hub` installed
|
49
|
-
hub compare "
|
56
|
+
hub compare "main:bump/theme-check-$VERSION"
|
57
|
+
```
|
58
|
+
|
59
|
+
## Shopify CLI Release Process
|
60
|
+
|
61
|
+
1. Release `theme-check` on RubyGems by following the steps in the previous section.
|
62
|
+
|
63
|
+
2. Update the `theme-check` version in [`shopify-cli`](https://github.com/shopify/shopify-cli)'s `Gemfile.lock` and `shopify-cli.gemspec` files.
|
64
|
+
|
65
|
+
Such as in [this PR.](https://github.com/Shopify/shopify-cli/pull/1357/files)
|
66
|
+
|
67
|
+
3. Create a branch + a commit on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
|
68
|
+
|
69
|
+
```bash
|
70
|
+
VERSION=X.X.X
|
71
|
+
git checkout -b "bump/theme-check-$VERSION"
|
72
|
+
git add Gemfile.lock
|
73
|
+
git add shopify-cli.gemspec
|
74
|
+
git commit -m "Bump theme-check version to $VERSION"
|
75
|
+
```
|
76
|
+
|
77
|
+
4. Create a pull-request for those changes on the [`shopify-cli`](https://github.com/Shopify/shopify-cli) repository.
|
78
|
+
|
79
|
+
```bash
|
80
|
+
# shortcut if you have `hub` installed
|
81
|
+
hub compare "main:bump/theme-check-$VERSION"
|
50
82
|
```
|
data/Rakefile
CHANGED
data/config/default.yml
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
root: .
|
2
2
|
|
3
|
+
extends: :nothing
|
4
|
+
|
3
5
|
require: []
|
4
6
|
|
7
|
+
include_categories: []
|
8
|
+
|
9
|
+
exclude_categories: []
|
10
|
+
|
5
11
|
ignore:
|
6
12
|
- node_modules/*
|
7
13
|
|
@@ -12,7 +18,7 @@ ConvertIncludeToRender:
|
|
12
18
|
LiquidTag:
|
13
19
|
enabled: true
|
14
20
|
ignore: []
|
15
|
-
min_consecutive_statements:
|
21
|
+
min_consecutive_statements: 5
|
16
22
|
|
17
23
|
MissingTemplate:
|
18
24
|
enabled: true
|
@@ -38,9 +44,13 @@ SyntaxError:
|
|
38
44
|
TemplateLength:
|
39
45
|
enabled: true
|
40
46
|
ignore: []
|
41
|
-
max_length:
|
47
|
+
max_length: 500
|
42
48
|
# Exclude content of {% schema %} in line count
|
43
49
|
exclude_schema: true
|
50
|
+
# Exclude content of {% stylesheet %} in line count
|
51
|
+
exclude_stylesheet: true
|
52
|
+
# Exclude content of {% javascript %} in line count
|
53
|
+
exclude_javascript: true
|
44
54
|
|
45
55
|
UnknownFilter:
|
46
56
|
enabled: true
|
@@ -99,6 +109,14 @@ DeprecatedFilter:
|
|
99
109
|
enabled: true
|
100
110
|
ignore: []
|
101
111
|
|
112
|
+
DeprecateLazysizes:
|
113
|
+
enabled: true
|
114
|
+
ignore: []
|
115
|
+
|
116
|
+
DeprecateBgsizes:
|
117
|
+
enabled: true
|
118
|
+
ignore: []
|
119
|
+
|
102
120
|
MissingEnableComment:
|
103
121
|
enabled: true
|
104
122
|
ignore: []
|
@@ -109,16 +127,20 @@ ParserBlockingJavaScript:
|
|
109
127
|
|
110
128
|
ParserBlockingScriptTag:
|
111
129
|
enabled: true
|
130
|
+
ignore: []
|
112
131
|
|
113
132
|
AssetSizeJavaScript:
|
114
133
|
enabled: false
|
115
|
-
ignore: []
|
116
134
|
threshold_in_bytes: 10_000
|
117
135
|
ignore: []
|
118
136
|
|
119
137
|
AssetSizeCSS:
|
120
138
|
enabled: false
|
139
|
+
threshold_in_bytes: 100_000
|
121
140
|
ignore: []
|
141
|
+
|
142
|
+
AssetSizeCSSStylesheetTag:
|
143
|
+
enabled: false
|
122
144
|
threshold_in_bytes: 100_000
|
123
145
|
ignore: []
|
124
146
|
|
@@ -141,3 +163,17 @@ ContentForHeaderModification:
|
|
141
163
|
ImgLazyLoading:
|
142
164
|
enabled: true
|
143
165
|
ignore: []
|
166
|
+
|
167
|
+
HtmlParsingError:
|
168
|
+
enabled: true
|
169
|
+
ignore: []
|
170
|
+
|
171
|
+
AssetSizeAppBlockJavaScript:
|
172
|
+
enabled: false
|
173
|
+
ignore: []
|
174
|
+
threshold_in_bytes: 10_000
|
175
|
+
|
176
|
+
AssetSizeAppBlockCSS:
|
177
|
+
enabled: false
|
178
|
+
ignore: []
|
179
|
+
threshold_in_bytes: 100_000
|
data/config/nothing.yml
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
root: .
|
2
|
+
|
3
|
+
extends: :nothing
|
4
|
+
|
5
|
+
require: []
|
6
|
+
|
7
|
+
include_categories: []
|
8
|
+
|
9
|
+
exclude_categories: []
|
10
|
+
|
11
|
+
ignore:
|
12
|
+
- node_modules/*
|
13
|
+
|
14
|
+
ConvertIncludeToRender:
|
15
|
+
enabled: true
|
16
|
+
ignore: []
|
17
|
+
|
18
|
+
LiquidTag:
|
19
|
+
enabled: true
|
20
|
+
ignore: []
|
21
|
+
min_consecutive_statements: 4
|
22
|
+
|
23
|
+
MissingTemplate:
|
24
|
+
enabled: true
|
25
|
+
ignore: []
|
26
|
+
|
27
|
+
NestedSnippet:
|
28
|
+
enabled: true
|
29
|
+
ignore: []
|
30
|
+
max_nesting_level: 3
|
31
|
+
|
32
|
+
RequiredLayoutThemeObject:
|
33
|
+
enabled: true
|
34
|
+
ignore: []
|
35
|
+
|
36
|
+
SpaceInsideBraces:
|
37
|
+
enabled: true
|
38
|
+
ignore: []
|
39
|
+
|
40
|
+
SyntaxError:
|
41
|
+
enabled: true
|
42
|
+
ignore: []
|
43
|
+
|
44
|
+
TemplateLength:
|
45
|
+
enabled: true
|
46
|
+
ignore: []
|
47
|
+
max_length: 200
|
48
|
+
# Exclude content of {% schema %} in line count
|
49
|
+
exclude_schema: true
|
50
|
+
|
51
|
+
UnknownFilter:
|
52
|
+
enabled: true
|
53
|
+
ignore: []
|
54
|
+
|
55
|
+
UnusedAssign:
|
56
|
+
enabled: true
|
57
|
+
ignore: []
|
58
|
+
|
59
|
+
UnusedSnippet:
|
60
|
+
enabled: true
|
61
|
+
ignore: []
|
62
|
+
|
63
|
+
MatchingSchemaTranslations:
|
64
|
+
enabled: true
|
65
|
+
ignore: []
|
66
|
+
|
67
|
+
MatchingTranslations:
|
68
|
+
enabled: true
|
69
|
+
ignore: []
|
70
|
+
|
71
|
+
TranslationKeyExists:
|
72
|
+
enabled: true
|
73
|
+
ignore: []
|
74
|
+
|
75
|
+
ValidHTMLTranslation:
|
76
|
+
enabled: true
|
77
|
+
ignore: []
|
78
|
+
|
79
|
+
ValidJson:
|
80
|
+
enabled: true
|
81
|
+
ignore: []
|
82
|
+
|
83
|
+
ValidSchema:
|
84
|
+
enabled: true
|
85
|
+
ignore: []
|
86
|
+
|
87
|
+
UndefinedObject:
|
88
|
+
enabled: true
|
89
|
+
ignore: []
|
90
|
+
exclude_snippets: true
|
91
|
+
|
92
|
+
RequiredDirectories:
|
93
|
+
enabled: false
|
94
|
+
ignore: []
|
95
|
+
|
96
|
+
DeprecatedFilter:
|
97
|
+
enabled: true
|
98
|
+
ignore: []
|
99
|
+
|
100
|
+
MissingEnableComment:
|
101
|
+
enabled: true
|
102
|
+
ignore: []
|
103
|
+
|
104
|
+
ParserBlockingJavaScript:
|
105
|
+
enabled: true
|
106
|
+
ignore: []
|
107
|
+
|
108
|
+
ParserBlockingScriptTag:
|
109
|
+
enabled: true
|
110
|
+
|
111
|
+
AssetSizeJavaScript:
|
112
|
+
enabled: true
|
113
|
+
ignore: []
|
114
|
+
threshold_in_bytes: 10_000
|
115
|
+
|
116
|
+
AssetSizeCSS:
|
117
|
+
enabled: true
|
118
|
+
ignore: []
|
119
|
+
threshold_in_bytes: 100_000
|
120
|
+
|
121
|
+
ImgWidthAndHeight:
|
122
|
+
enabled: true
|
123
|
+
ignore: []
|
124
|
+
|
125
|
+
RemoteAsset:
|
126
|
+
enabled: true
|
127
|
+
ignore: []
|
128
|
+
|
129
|
+
AssetUrlFilters:
|
130
|
+
enabled: true
|
131
|
+
ignore: []
|
132
|
+
|
133
|
+
ContentForHeaderModification:
|
134
|
+
enabled: true
|
135
|
+
ignore: []
|
136
|
+
|
137
|
+
ImgLazyLoading:
|
138
|
+
enabled: true
|
139
|
+
ignore: []
|
140
|
+
|
141
|
+
HtmlParsingError:
|
142
|
+
enabled: true
|
143
|
+
ignore: []
|
144
|
+
|
145
|
+
AssetSizeAppBlockJavaScript:
|
146
|
+
enabled: true
|
147
|
+
ignore: []
|
148
|
+
threshold_in_bytes: 10_000
|
149
|
+
|
150
|
+
AssetSizeAppBlockCSS:
|
151
|
+
enabled: true
|
152
|
+
ignore: []
|
153
|
+
threshold_in_bytes: 100_000
|
@@ -40,6 +40,7 @@
|
|
40
40
|
- linklist
|
41
41
|
- linklists
|
42
42
|
- location
|
43
|
+
- localization
|
43
44
|
- metafield
|
44
45
|
- model
|
45
46
|
- model_source
|
@@ -55,6 +56,7 @@
|
|
55
56
|
- powered_by_link
|
56
57
|
- product
|
57
58
|
- product_option
|
59
|
+
- product_variant
|
58
60
|
- recommendations
|
59
61
|
- request
|
60
62
|
- routes
|