theme-check 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +50 -0
- data/CONTRIBUTING.md +5 -2
- data/README.md +9 -4
- data/RELEASING.md +2 -2
- data/config/default.yml +7 -0
- data/data/shopify_liquid/tags.yml +27 -0
- data/docs/checks/CHECK_DOCS_TEMPLATE.md +47 -0
- data/docs/checks/asset_size_javascript.md +79 -0
- data/docs/checks/convert_include_to_render.md +48 -0
- data/docs/checks/default_locale.md +46 -0
- data/docs/checks/deprecated_filter.md +46 -0
- data/docs/checks/liquid_tag.md +65 -0
- data/docs/checks/matching_schema_translations.md +93 -0
- data/docs/checks/matching_translations.md +72 -0
- data/docs/checks/missing_enable_comment.md +50 -0
- data/docs/checks/missing_required_template_files.md +26 -0
- data/docs/checks/missing_template.md +40 -0
- data/docs/checks/nested_snippet.md +69 -0
- data/docs/checks/parser_blocking_javascript.md +97 -0
- data/docs/checks/required_directories.md +25 -0
- data/docs/checks/required_layout_theme_object.md +28 -0
- data/docs/checks/space_inside_braces.md +63 -0
- data/docs/checks/syntax_error.md +49 -0
- data/docs/checks/template_length.md +50 -0
- data/docs/checks/translation_key_exists.md +63 -0
- data/docs/checks/undefined_object.md +53 -0
- data/docs/checks/unknown_filter.md +45 -0
- data/docs/checks/unused_assign.md +47 -0
- data/docs/checks/unused_snippet.md +32 -0
- data/docs/checks/valid_html_translation.md +53 -0
- data/docs/checks/valid_json.md +60 -0
- data/docs/checks/valid_schema.md +50 -0
- data/lib/theme_check.rb +4 -0
- data/lib/theme_check/asset_file.rb +34 -0
- data/lib/theme_check/check.rb +19 -9
- data/lib/theme_check/checks/asset_size_javascript.rb +74 -0
- data/lib/theme_check/checks/convert_include_to_render.rb +1 -1
- data/lib/theme_check/checks/default_locale.rb +1 -0
- data/lib/theme_check/checks/deprecated_filter.rb +1 -1
- data/lib/theme_check/checks/liquid_tag.rb +3 -3
- data/lib/theme_check/checks/matching_schema_translations.rb +1 -0
- data/lib/theme_check/checks/matching_translations.rb +1 -0
- data/lib/theme_check/checks/missing_enable_comment.rb +1 -0
- data/lib/theme_check/checks/missing_required_template_files.rb +1 -2
- data/lib/theme_check/checks/missing_template.rb +1 -0
- data/lib/theme_check/checks/nested_snippet.rb +1 -0
- data/lib/theme_check/checks/parser_blocking_javascript.rb +2 -1
- data/lib/theme_check/checks/required_directories.rb +1 -1
- data/lib/theme_check/checks/required_layout_theme_object.rb +1 -1
- data/lib/theme_check/checks/space_inside_braces.rb +1 -0
- data/lib/theme_check/checks/syntax_error.rb +1 -0
- data/lib/theme_check/checks/template_length.rb +1 -0
- data/lib/theme_check/checks/translation_key_exists.rb +1 -0
- data/lib/theme_check/checks/undefined_object.rb +29 -10
- data/lib/theme_check/checks/unknown_filter.rb +1 -0
- data/lib/theme_check/checks/unused_assign.rb +5 -3
- data/lib/theme_check/checks/unused_snippet.rb +1 -0
- data/lib/theme_check/checks/valid_html_translation.rb +1 -0
- data/lib/theme_check/checks/valid_json.rb +1 -0
- data/lib/theme_check/checks/valid_schema.rb +1 -0
- data/lib/theme_check/cli.rb +22 -6
- data/lib/theme_check/config.rb +2 -2
- data/lib/theme_check/in_memory_storage.rb +1 -1
- data/lib/theme_check/language_server.rb +10 -0
- data/lib/theme_check/language_server/completion_engine.rb +38 -0
- data/lib/theme_check/language_server/completion_helper.rb +25 -0
- data/lib/theme_check/language_server/completion_provider.rb +24 -0
- data/lib/theme_check/language_server/completion_providers/filter_completion_provider.rb +47 -0
- data/lib/theme_check/language_server/completion_providers/object_completion_provider.rb +31 -0
- data/lib/theme_check/language_server/completion_providers/tag_completion_provider.rb +31 -0
- data/lib/theme_check/language_server/handler.rb +62 -6
- data/lib/theme_check/language_server/position_helper.rb +27 -0
- data/lib/theme_check/language_server/protocol.rb +41 -0
- data/lib/theme_check/language_server/server.rb +6 -1
- data/lib/theme_check/language_server/tokens.rb +55 -0
- data/lib/theme_check/offense.rb +51 -14
- data/lib/theme_check/regex_helpers.rb +15 -0
- data/lib/theme_check/remote_asset_file.rb +44 -0
- data/lib/theme_check/shopify_liquid.rb +1 -0
- data/lib/theme_check/shopify_liquid/tag.rb +16 -0
- data/lib/theme_check/theme.rb +7 -1
- data/lib/theme_check/version.rb +1 -1
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7beb3a827afcd22a262b82b436ed03a7130a1237ab11351bf4e1b36769c62d1a
|
4
|
+
data.tar.gz: a92529eac6dcaa689b708ecfda3e53a6b132e61ae01f26ae3ebb0bf3ec03e962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4554837884b203c2bca10cdbd09e29d0f485d814c8aff72d8680d1d7f44e82e8bef74b192953aba8a61622434ff3f466a24109f6eb3bee83500585f462672f
|
7
|
+
data.tar.gz: 75ece7d25c463748ae1d810920b488e732e50602988f3dd40bccb25a649af4d9336d4a3dc12310dbb1b53e1492728f8900da1050759e43e826457991f0bf6a11
|
data/.rubocop.yml
CHANGED
@@ -7,6 +7,7 @@ AllCops:
|
|
7
7
|
TargetRubyVersion: 2.7
|
8
8
|
Exclude:
|
9
9
|
- 'vendor/bundle/**/*'
|
10
|
+
- 'packaging/builds/**/*'
|
10
11
|
|
11
12
|
Metrics/MethodLength:
|
12
13
|
Enabled: false
|
@@ -16,3 +17,9 @@ Layout/LineLength:
|
|
16
17
|
|
17
18
|
Lint/MissingSuper:
|
18
19
|
Enabled: false
|
20
|
+
|
21
|
+
Style/StringLiterals:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/StringLiteralsInInterpolation:
|
25
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
0.5.0 / 2021-03-12
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Add [AssetSizeJavaScript](/docs/checks/asset_size_javascript.md) check ([#194](https://github.com/Shopify/theme-check/pull/194))
|
6
|
+
* Add [documentation for all checks](/docs/checks)
|
7
|
+
* Make documentation for checks mandatory
|
8
|
+
* Add link to documentation from within the editor (via `codeDescription` in the Language Server) ()
|
9
|
+
* Allow checks to have multiple categories
|
10
|
+
* Fix multiple occurrences of UndefinedObject not being reported ([#192](https://github.com/shopify/theme-check/issues/192))
|
11
|
+
|
12
|
+
v0.4.0 / 2021-02-25
|
13
|
+
==================
|
14
|
+
|
15
|
+
* Add Completion Engine ([#161](https://github.com/shopify/theme-check/issues/161))
|
16
|
+
* Add init command to CLI ([#174](https://github.com/shopify/theme-check/issues/174))
|
17
|
+
* Refactor start and end Position logic ([#172](https://github.com/shopify/theme-check/issues/172))
|
18
|
+
|
19
|
+
v0.3.3 / 2021-02-18
|
20
|
+
==================
|
21
|
+
|
22
|
+
* Fix column_end issues ([#164](https://github.com/Shopify/theme-check/issues/164))
|
23
|
+
* Fix stack overflow in UndefinedObject + UnusedAssign when snippets renders itself ([#165](https://github.com/Shopify/theme-check/issues/165))
|
24
|
+
|
25
|
+
v0.3.2 / 2021-02-17
|
26
|
+
==================
|
27
|
+
|
28
|
+
* Ignore snippets in UndefinedObject check
|
29
|
+
|
30
|
+
v0.3.1 / 2021-02-16
|
31
|
+
===================
|
32
|
+
|
33
|
+
* Fixup version flag
|
34
|
+
|
35
|
+
v0.3.0 / 2021-02-16
|
36
|
+
===================
|
37
|
+
|
38
|
+
* Add ParserBlockingJavaScript Check ([#78](https://github.com/Shopify/theme-check/issues/78), [#146](https://github.com/Shopify/theme-check/issues/146))
|
39
|
+
* Internal refactor to enable running theme-check in servers ([#145](https://github.com/Shopify/theme-check/issues/145), [#148](https://github.com/Shopify/theme-check/issues/148))
|
40
|
+
* Add -v, --version flag ([#126](https://github.com/Shopify/theme-check/issues/126))
|
41
|
+
* Exclude content of {% schema %} in line count for TemplateLength ([#140](https://github.com/Shopify/theme-check/issues/140))
|
42
|
+
* Fix Language Server removed files bug ([#136](https://github.com/Shopify/theme-check/issues/136))
|
43
|
+
* Add ignore config ([#147](https://github.com/Shopify/theme-check/issues/147))
|
44
|
+
* Add ability to disable checks with comments ([#79](https://github.com/Shopify/theme-check/issues/79))
|
45
|
+
* Adding checks for shopify plus objects in checkout ([#121](https://github.com/Shopify/theme-check/issues/121))
|
46
|
+
|
47
|
+
v0.2.2 / 2021-01-22
|
48
|
+
===================
|
49
|
+
|
50
|
+
* [Language Server] Send empty dianogstics to flush errors
|
data/CONTRIBUTING.md
CHANGED
@@ -44,7 +44,6 @@ module ThemeCheck
|
|
44
44
|
# NOTE: inherit from JsonCheck to implement a JSON based check.
|
45
45
|
class MyCheckName < LiquidCheck
|
46
46
|
severity :suggestion # :error or :style
|
47
|
-
doc "https://..." # Optional link to doc
|
48
47
|
|
49
48
|
def on_document(node)
|
50
49
|
# Called with the root node of all templates
|
@@ -122,7 +121,7 @@ module ThemeCheck
|
|
122
121
|
end
|
123
122
|
```
|
124
123
|
|
125
|
-
Add the new check to `config/default.yml` to enable it.
|
124
|
+
Add the new check to `config/default.yml` to enable it. If the check is configurable, the `initialize` argument name and default values should also be duplicated inside `config/default.yml`.
|
126
125
|
|
127
126
|
```yaml
|
128
127
|
MyCheckName:
|
@@ -131,4 +130,8 @@ MyCheckName:
|
|
131
130
|
|
132
131
|
Add a corresponding test file under `test/checks`.
|
133
132
|
|
133
|
+
Add a documentation file in `docs/checks/#{name_of_check}.md` based off of the [check documentation template][doctemplate].
|
134
|
+
|
134
135
|
When done, run the tests with `dev test`.
|
136
|
+
|
137
|
+
[doctemplate]: /docs/checks/CHECK_DOCS_TEMPLATE.md
|
data/README.md
CHANGED
@@ -8,8 +8,6 @@ Theme Check is also available [inside some code editors](https://github.com/Shop
|
|
8
8
|
|
9
9
|

|
10
10
|
|
11
|
-
_Disclaimer: This tool is not supported as part of the Partners program._
|
12
|
-
|
13
11
|
## Supported Checks
|
14
12
|
|
15
13
|
Theme Check currently checks for the following:
|
@@ -34,7 +32,14 @@ Theme Check currently checks for the following:
|
|
34
32
|
✅ Deprecated filters
|
35
33
|
✅ Missing `theme-check-enable` comment
|
36
34
|
|
37
|
-
|
35
|
+
As well as checks that prevent easy to spot performance problems:
|
36
|
+
|
37
|
+
✅ Use of [parser-blocking](/docs/checks/parser_blocking_javascript.md) JavaScript
|
38
|
+
✅ [Too much JavaScript](/docs/checks/asset_size_javascript.md)
|
39
|
+
|
40
|
+
For detailed descriptions and configuration options, [take a look at the complete list.](/docs/checks/)
|
41
|
+
|
42
|
+
With more to come! Suggestions welcome ([create an issue](https://github.com/Shopify/theme-check/issues)).
|
38
43
|
|
39
44
|
## Requirements
|
40
45
|
|
@@ -89,7 +94,7 @@ TemplateLength:
|
|
89
94
|
enabled: false
|
90
95
|
# Or configure options
|
91
96
|
max_length: 300
|
92
|
-
|
97
|
+
|
93
98
|
# Enable a custom check
|
94
99
|
MyCustomCheck
|
95
100
|
enabled: true
|
data/RELEASING.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
|
4
4
|
|
5
|
-
2. Create a PR to update the version in `lib/theme_check/version.rb`
|
5
|
+
2. Create a PR to update the version in `lib/theme_check/version.rb` and replace the `THEME_CHECK_VERSION` placeholder in the documentation for new rules.
|
6
6
|
|
7
7
|
3. Merge your PR to master
|
8
8
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
```bash
|
24
24
|
VERSION=X.X.X
|
25
|
-
cp packaging/builds/$VERSION/theme-check ../homebrew-shopify
|
25
|
+
cp packaging/builds/$VERSION/theme-check.rb ../homebrew-shopify
|
26
26
|
```
|
27
27
|
|
28
28
|
4. Create a branch + a commit on the [`homebrew-shopify`](https://github.com/Shopify/homebrew-shopify) repository.
|
data/config/default.yml
CHANGED
@@ -10,12 +10,14 @@ ConvertIncludeToRender:
|
|
10
10
|
|
11
11
|
LiquidTag:
|
12
12
|
enabled: true
|
13
|
+
min_consecutive_statements: 4
|
13
14
|
|
14
15
|
MissingTemplate:
|
15
16
|
enabled: true
|
16
17
|
|
17
18
|
NestedSnippet:
|
18
19
|
enabled: true
|
20
|
+
max_nesting_level: 2
|
19
21
|
|
20
22
|
RequiredLayoutThemeObject:
|
21
23
|
enabled: true
|
@@ -67,6 +69,7 @@ MissingRequiredTemplateFiles:
|
|
67
69
|
|
68
70
|
UndefinedObject:
|
69
71
|
enabled: true
|
72
|
+
exclude_snippets: true
|
70
73
|
|
71
74
|
RequiredDirectories:
|
72
75
|
enabled: true
|
@@ -79,3 +82,7 @@ MissingEnableComment:
|
|
79
82
|
|
80
83
|
ParserBlockingJavaScript:
|
81
84
|
enabled: true
|
85
|
+
|
86
|
+
AssetSizeJavaScript:
|
87
|
+
enabled: false
|
88
|
+
threshold_in_bytes: 10000
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
- assign
|
3
|
+
- break
|
4
|
+
- capture
|
5
|
+
- case
|
6
|
+
- comment
|
7
|
+
- continue
|
8
|
+
- cycle
|
9
|
+
- decrement
|
10
|
+
- echo
|
11
|
+
- for
|
12
|
+
- form
|
13
|
+
- if
|
14
|
+
- ifchanged
|
15
|
+
- increment
|
16
|
+
- javascript
|
17
|
+
- layout
|
18
|
+
- liquid
|
19
|
+
- paginate
|
20
|
+
- raw
|
21
|
+
- render
|
22
|
+
- schema
|
23
|
+
- section
|
24
|
+
- style
|
25
|
+
- stylesheet
|
26
|
+
- tablerow
|
27
|
+
- unless
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Check Title (`CheckClassName`)
|
2
|
+
|
3
|
+
A brief paragraph explaining why the check exists.
|
4
|
+
|
5
|
+
## Check Details
|
6
|
+
|
7
|
+
This check is aimed at eliminating ...
|
8
|
+
|
9
|
+
:-1: Examples of **incorrect** code for this check:
|
10
|
+
|
11
|
+
```liquid
|
12
|
+
```
|
13
|
+
|
14
|
+
:+1: Examples of **correct** code for this check:
|
15
|
+
|
16
|
+
```liquid
|
17
|
+
```
|
18
|
+
|
19
|
+
## Check Options
|
20
|
+
|
21
|
+
The default configuration for this check is the following:
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
CheckClassName:
|
25
|
+
enabled: true
|
26
|
+
some_option: 10
|
27
|
+
```
|
28
|
+
|
29
|
+
### `some_option`
|
30
|
+
|
31
|
+
The `some_option` option (Default: `10`) determines ...
|
32
|
+
|
33
|
+
## When Not To Use It
|
34
|
+
|
35
|
+
If you don't want to ..., then it's safe to disable this rule.
|
36
|
+
|
37
|
+
## Version
|
38
|
+
|
39
|
+
This check has been introduced in Theme Check X.X.X.
|
40
|
+
|
41
|
+
## Resources
|
42
|
+
|
43
|
+
- [Rule Source][codesource]
|
44
|
+
- [Documentation Source][docsource]
|
45
|
+
|
46
|
+
[codesource]: /lib/theme_check/checks/check_class_name.rb
|
47
|
+
[docsource]: /docs/checks/check_class_name.md
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Prevent JavaScript Abuse on Server Rendered Themes (`AssetSizeJavaScript`)
|
2
|
+
|
3
|
+
For server rendered pages, it is an anti-pattern to execute large JavaScript bundles on every navigation.
|
4
|
+
|
5
|
+
This doesn't mean they don't have a reason to exist. For instance, chat widgets are mini applications embedded inside web pages. Designing such an app with server rendered updates would be absurd. However, if only 10% of the users interact with the chat widget, the other 90% should not have to execute the entire bundle on every page load.
|
6
|
+
|
7
|
+
The natural solution to this problem is to implement the chat widget using the [Import on Interaction Pattern][ioip].
|
8
|
+
|
9
|
+
## Check Details
|
10
|
+
|
11
|
+
This rule disallows the use of theme JavaScript files and external scripts to have a compressed size greater than a configured `threshold_in_bytes`.
|
12
|
+
|
13
|
+
:-1: Examples of **incorrect** code for this check:
|
14
|
+
```liquid
|
15
|
+
<!-- Here assets/chat-widget.js is more than 10KB gzipped. -->
|
16
|
+
<script src="{{ 'chat-widget.js' | asset_url }}" defer></script>
|
17
|
+
|
18
|
+
<!-- The use of jQuery is discouraged in themes -->
|
19
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js" defer></script>
|
20
|
+
```
|
21
|
+
|
22
|
+
:+1: Example of **correct** code for this check:
|
23
|
+
```liquid
|
24
|
+
<script>
|
25
|
+
const chatWidgetButton = document.getElementById('#chat-widget')
|
26
|
+
|
27
|
+
chatWidgetButton.addEventListener('click', e => {
|
28
|
+
e.preventDefault();
|
29
|
+
import("{{ 'chat-widget.js' | asset_url }}")
|
30
|
+
.then(module => module.default)
|
31
|
+
.then(ChatWidget => ChatWidget.init())
|
32
|
+
.catch(err => {
|
33
|
+
console.error(err);
|
34
|
+
});
|
35
|
+
});
|
36
|
+
</script>
|
37
|
+
```
|
38
|
+
|
39
|
+
## Check Options
|
40
|
+
|
41
|
+
The default configuration is the following.
|
42
|
+
|
43
|
+
```yaml
|
44
|
+
AssetSizeJavaScript:
|
45
|
+
enabled: false
|
46
|
+
threshold_in_bytes: 10000
|
47
|
+
```
|
48
|
+
|
49
|
+
### `threshold_in_bytes`
|
50
|
+
|
51
|
+
The `threshold_in_bytes` option (default: `10000`) determines the maximum allowed compressed size in bytes that a single JavaScript file can take.
|
52
|
+
|
53
|
+
This includes theme and remote scripts.
|
54
|
+
|
55
|
+
## When Not To Use It
|
56
|
+
|
57
|
+
When you can't do anything about it, it is preferable to disable this rule using the comment syntax:
|
58
|
+
|
59
|
+
```
|
60
|
+
{% comment %}theme-check-disable AssetSizeJavaScript{% endcomment %}
|
61
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js" defer></script>
|
62
|
+
{% comment %}theme-check-enable AssetSizeJavaScript{% endcomment %}
|
63
|
+
```
|
64
|
+
|
65
|
+
This makes disabling the rule an explicit affair and shows that the code is smelly.
|
66
|
+
|
67
|
+
## Version
|
68
|
+
|
69
|
+
This check has been introduced in Theme Check 0.5.0.
|
70
|
+
|
71
|
+
## Resources
|
72
|
+
|
73
|
+
- [The Import On Interaction Pattern][ioip]
|
74
|
+
- [Rule Source][codesource]
|
75
|
+
- [Documentation Source][docsource]
|
76
|
+
|
77
|
+
[ioip]: https://addyosmani.com/blog/import-on-interaction/
|
78
|
+
[codesource]: /lib/theme_check/checks/asset_size_javascript.rb
|
79
|
+
[docsource]: /docs/checks/asset_size_javascript.md
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Discourage the use of `include` (`ConvertIncludeToRender`)
|
2
|
+
|
3
|
+
The `include` tag is [deprecated][deprecated]. This tag exists to enforce the use of the `render` tag instead of `include`.
|
4
|
+
|
5
|
+
The `include` tag works similarly to the `render` tag, but it lets the code inside of the snippet to access and overwrite the variables within its parent template. The `include` tag has been deprecated because the way that it handles variables reduces performance and makes theme code harder to both read and maintain.
|
6
|
+
|
7
|
+
## Check Details
|
8
|
+
|
9
|
+
This check is aimed at eliminating the use of `include` tags.
|
10
|
+
|
11
|
+
:-1: Examples of **incorrect** code for this check:
|
12
|
+
|
13
|
+
```liquid
|
14
|
+
{% include 'snippet' %}
|
15
|
+
```
|
16
|
+
|
17
|
+
:+1: Examples of **correct** code for this check:
|
18
|
+
|
19
|
+
```liquid
|
20
|
+
{% render 'snippet' %}
|
21
|
+
```
|
22
|
+
|
23
|
+
## Check Options
|
24
|
+
|
25
|
+
The default configuration for this check is the following:
|
26
|
+
|
27
|
+
```yaml
|
28
|
+
ConvertIncludeToRender:
|
29
|
+
enabled: true
|
30
|
+
```
|
31
|
+
|
32
|
+
## When Not To Use It
|
33
|
+
|
34
|
+
It is discouraged to disable this rule.
|
35
|
+
|
36
|
+
## Version
|
37
|
+
|
38
|
+
This check has been introduced in Theme Check 0.1.0.
|
39
|
+
|
40
|
+
## Resources
|
41
|
+
|
42
|
+
- [Deprecated Tags Reference][deprecated]
|
43
|
+
- [Rule Source][codesource]
|
44
|
+
- [Documentation Source][docsource]
|
45
|
+
|
46
|
+
[deprecated]: https://shopify.dev/docs/themes/liquid/reference/tags/deprecated-tags#include
|
47
|
+
[codesource]: /lib/theme_check/checks/convert_include_to_render.rb
|
48
|
+
[docsource]: /docs/checks/convert_include_to_render.md
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Ensure theme has a default locale (`DefaultLocale`)
|
2
|
+
|
3
|
+
This check makes sure the theme has a default translation file.
|
4
|
+
|
5
|
+
## Check Details
|
6
|
+
|
7
|
+
This check makes sure a theme has a default locale.
|
8
|
+
|
9
|
+
:-1: Example of **incorrect** theme for this check:
|
10
|
+
|
11
|
+
```
|
12
|
+
locales/
|
13
|
+
├── en.json
|
14
|
+
├── fr.json
|
15
|
+
└── zh-TW.json
|
16
|
+
```
|
17
|
+
|
18
|
+
:+1: Example of **correct** theme for this check:
|
19
|
+
|
20
|
+
```
|
21
|
+
locales/
|
22
|
+
├── en.default.json # a default translation file is required
|
23
|
+
├── fr.json
|
24
|
+
└── zh-TW.json
|
25
|
+
```
|
26
|
+
|
27
|
+
## Check Options
|
28
|
+
|
29
|
+
The default configuration for this check is the following:
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
DefaultLocale:
|
33
|
+
enabled: true
|
34
|
+
```
|
35
|
+
|
36
|
+
## Version
|
37
|
+
|
38
|
+
This check has been introduced in Theme Check 0.1.0.
|
39
|
+
|
40
|
+
## Resources
|
41
|
+
|
42
|
+
- [Rule Source][codesource]
|
43
|
+
- [Documentation Source][docsource]
|
44
|
+
|
45
|
+
[codesource]: /lib/theme_check/checks/default_locale.rb
|
46
|
+
[docsource]: /docs/checks/default_locale.md
|