{"id":13479096,"url":"https://github.com/Shopify/theme-check","last_synced_at":"2025-03-27T09:30:46.901Z","repository":{"id":37789461,"uuid":"315978274","full_name":"Shopify/theme-check","owner":"Shopify","description":"The Ultimate Shopify Theme Linter","archived":false,"fork":false,"pushed_at":"2024-04-11T15:52:13.000Z","size":3656,"stargazers_count":329,"open_issues_count":100,"forks_count":92,"subscribers_count":255,"default_branch":"main","last_synced_at":"2024-04-14T09:45:34.108Z","etag":null,"topics":["linter","liquid","static-code-analysis"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shopify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-11-25T15:22:58.000Z","updated_at":"2024-04-16T23:41:59.537Z","dependencies_parsed_at":"2024-04-16T23:41:47.726Z","dependency_job_id":null,"html_url":"https://github.com/Shopify/theme-check","commit_stats":{"total_commits":647,"total_committers":37,"mean_commits":"17.486486486486488","dds":0.6012364760432767,"last_synced_commit":"3fb2e382a54cdcacb533d0a6030a245449387b23"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Ftheme-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Ftheme-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Ftheme-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Ftheme-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shopify","download_url":"https://codeload.github.com/Shopify/theme-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222222202,"owners_count":16951399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linter","liquid","static-code-analysis"],"created_at":"2024-07-31T16:02:09.277Z","updated_at":"2024-10-30T12:31:32.823Z","avatar_url":"https://github.com/Shopify.png","language":"Ruby","readme":"\u003e **Warning**\n\u003e\n\u003e This project has been absorbed by and moved to [Shopify/theme-tools](https://github.com/Shopify/theme-tools).\n\n# Theme Check ✅ - A linter for Themes\n\nThink RuboCop, or eslint, but for Shopify themes.\n\nTheme Check is a command line tool that helps you follow Shopify Themes \u0026 Liquid best practices by analyzing the Liquid \u0026 JSON inside your theme.\n\nTheme Check is also available [inside some code editors](https://github.com/Shopify/theme-check/wiki).\n\n![](docs/preview.png)\n\n## Supported Checks\n\nTheme Check currently checks for the following:\n\n✅ Liquid syntax errors  \n✅ JSON syntax errors  \n✅ Missing snippet \u0026 section templates  \n✅ Unused `{% assign ... %}`  \n✅ Unused snippet templates  \n✅ Template length  \n✅ Deprecated tags  \n✅ Unknown tags  \n✅ Unknown filters  \n✅ Missing `{{ content_for_* }}` in `theme.liquid`  \n✅ Excessive nesting of snippets  \n✅ Missing or extra spaces inside `{% ... %}` and `{{ ... }}`  \n✅ Missing default locale file  \n✅ Unmatching translation keys in locale files  \n✅ Using unknown translation keys in `{{ 'missing_key' | t }}`  \n✅ Using several `{% ... %}` instead of `{% liquid ... %}`  \n✅ Undefined [objects](https://shopify.dev/docs/themes/liquid/reference/objects)  \n✅ Deprecated filters  \n✅ Missing `theme-check-enable` comment  \n\nAs well as checks that prevent easy to spot performance problems:\n\n✅ Use of [parser-blocking](/docs/checks/parser_blocking_javascript.md) JavaScript  \n✅ [Use of non-Shopify domains for assets](/docs/checks/remote_asset.md)  \n✅ [Missing width and height attributes on `img` tags](/docs/checks/img_width_and_height.md)  \n✅ [Too much JavaScript](/docs/checks/asset_size_javascript.md)  \n✅ [Too much CSS](/docs/checks/asset_size_css.md)  \n\nFor detailed descriptions and configuration options, [take a look at the complete list.](/docs/checks/)\n\nWith more to come! Suggestions welcome ([create an issue](https://github.com/Shopify/theme-check/issues)).\n\n## Requirements\n\n- Ruby 2.7+\n\n## Installation\n\nTheme Check is available through Homebrew _or_ RubyGems.\n\n**Homebrew**\n\nYou’ll need to run `brew tap` first to add Shopify’s third-party repositories to Homebrew.\n\n```sh\nbrew tap shopify/shopify\nbrew install theme-check\n```\n\n**RubyGems**\n\n```sh\ngem install theme-check\n```\n\n## Usage\n\n```\ntheme-check /path/to/your/theme\n\n# or from /path/to/your/theme\ntheme-check\n```\n\nRun `theme-check --help` to get full usage.\n\n## Configuration\n\nAdd a `.theme-check.yml` file at the root of your theme to configure:\n\n```yaml\n# If your theme is not using the supported directory structure, provide the root path\n# where to find the `templates/`, `sections/`, `snippets/` directories as they would\n# be uploaded to Shopify.\nroot: dist\n\n# It is possible to extend theme-check with custom checks\nrequire:\n  - ./path/to/my_custom_check.rb\n\nTemplateLength:\n  # Disable some checks\n  enabled: false\n  # Or configure options\n  max_length: 300\n  # Or ignore certain paths\n  ignore:\n    - snippets/icon-*\n  # Or change the severity (error|suggestion|style)\n  severity: suggestion\n\n# Enable a custom check\nMyCustomCheck\n  enabled: true\n```\n\nSee [config/default.yml](config/default.yml) for available options \u0026 defaults.\n\n## Disable checks with comments\n\nUse Liquid comments to disable and re-enable all checks for a section of your template:\n\n```liquid\n{% # theme-check-disable %}\n{% assign x = 1 %}\n{% # theme-check-enable %}\n```\n\nDisable a specific check by including it in the comment:\n\n```liquid\n{% # theme-check-disable UnusedAssign %}\n{% assign x = 1 %}\n{% # theme-check-enable UnusedAssign %}\n```\n\nDisable multiple checks by including them as a comma-separated list:\n\n```liquid\n{% # theme-check-disable UnusedAssign,SpaceInsideBraces %}\n{%assign x = 1%}\n{% # theme-check-enable UnusedAssign,SpaceInsideBraces %}\n```\n\nDisable checks for the _entire document_ by placing the comment on the first line:\n\n```liquid\n{% # theme-check-disable SpaceInsideBraces %}\n{%assign x = 1%}\n```\n\n## Exit Code and `--fail-level`\n\nUse the `--fail-level` (default: `error`) flag to configure the exit code of theme-check. Useful in CI scenarios.\n\nExample:\n\n```\n# Make CI fail on styles warnings, suggestions, and errors\ntheme-check --fail-level style path_to_theme\n\n# Make CI fail on suggestions, and errors\ntheme-check --fail-level suggestion path_to_theme\n\n# Make CI fail on errors\ntheme-check path_to_theme\n```\n\nThere are three fail levels:\n\n- `error`\n- `suggestion`\n- `style`\n\nExit code meanings:\n\n- 0: Success!\n- 1: Your code doesn't pass the checks\n- 2: There's a bug in theme-check\n\nIf you would like to change the severity of a check, you can do so with the `severity` attribute. Example:\n\n```yaml\nDeprecateLazysizes:\n  enabled: true\n  severity: error\n```\n\n## Language Server Configurations\n\n- `themeCheck.checkOnOpen` (default: `true`) makes it so theme check runs on file open.\n- `themeCheck.checkOnChange` (default: `true`) makes it so theme check runs on file change.\n- `themeCheck.checkOnSave` (default: `true`) makes it so theme check runs on file save.\n- `themeCheck.onlySingleFileChecks` (default: `false`) makes it so we only check the opened files and disable \"whole theme\" checks (e.g. UnusedSnippet, TranslationKeyExists)\n\n⚠️ **Note:** Quickfixes only work on a freshly checked file. If any of those configurations are turned off, you will need to rerun theme-check in order to apply quickfixes.\n\nIn VS Code, these can be set directly in your `settings.json`.\n\n## Contributing\n\nFor guidance on contributing, refer to this [doc](/CONTRIBUTING)\n","funding_links":[],"categories":["Ruby","Tools","工具","Developer Tools"],"sub_categories":["Command Line Tools","命令行工具","CLI Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShopify%2Ftheme-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShopify%2Ftheme-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShopify%2Ftheme-check/lists"}