Skip to content

About

Lints Shopify Liquid templates for deprecated tags and filters, missing image alt attributes, and other common mistakes.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shopify-liquid-linter

A zero-dependency Node.js linter for Shopify Liquid templates. It flags deprecated tags and filters, accessibility problems, and inline styles that are easy to miss during manual review.

Why

Shopify themes accumulate small mistakes over time: the deprecated include tag instead of render, the deprecated img_url filter instead of image_url, img tags with no alt attribute, and inline style attributes scattered through markup. None of these break a theme, but they quietly hurt accessibility, SEO and maintainability. This linter scans a theme's Liquid files and reports each occurrence with a file and line number.

Install

git clone https://github.com/EcomswiftLLC/shopify-liquid-linter.git

cd shopify-liquid-linter

No dependencies to install. It only uses Node's built in fs and path modules.

Usage

node bin/lint.js THEME_PATH

Example: node bin/lint.js ./my-theme

Add --json to print a machine readable report instead of the human readable one. The process exits with code 1 when issues are found, so it can be wired into CI.

Rules

no-deprecated-include flags the include tag and suggests render. no-deprecated-img-url flags the img_url filter and suggests image_url. img-missing-alt flags img tags with no alt attribute. no-inline-style flags elements with an inline style attribute and suggests a CSS class instead.

Running the tests

npm test

Contributing

Issues and pull requests that add new rules are welcome. Good candidates include flagging hardcoded strings that should go through the translation filter, or flagging deprecated section schema settings.

Need help?

This project is maintained by Ecom Swift LLC, a Shopify Partner.

License

MIT

About

Lints Shopify Liquid templates for deprecated tags and filters, missing image alt attributes, and other common mistakes.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages