Skip to content

Add Liquid cursor rule#45

Closed
mxstbr wants to merge 2 commits intomainfrom
liquid-cursor-rule
Closed

Add Liquid cursor rule#45
mxstbr wants to merge 2 commits intomainfrom
liquid-cursor-rule

Conversation

@mxstbr
Copy link
Copy Markdown

@mxstbr mxstbr commented Jun 1, 2025

This adds our internal Liquid cursor rule that enables Cursor to better understand Liquid development to the skeleton-theme for all theme developers to enjoy. (and ideally contribute to so we can make it even better!)

This adds our internal Liquid cursor rule that enables Cursor to better understand Liquid development to the skeleton-theme for all theme developers to enjoy. (and ideally contribute to so we can make it even better!)
@t-kelly
Copy link
Copy Markdown
Contributor

t-kelly commented Jun 1, 2025

hellyes

Copy link
Copy Markdown

@tyleralsbury tyleralsbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few potential tweaks, but approving.

Comment on lines +464 to +470
<bem>
- Use BEM naming convention:
- Block: the component
- Element: child of component (block__element)
- Modifier: variant (block--modifier, block__element--modifier)
- Use dashes to separate words in blocks/elements/modifiers
</bem>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is too specific - some developers may not want to use bem.

</media-queries>

<nesting>
- Do not use & operator
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ended up a bit outdated - we do use that operator in Horizon, in the end.


<nesting>
- Do not use & operator
- Never nest beyond first level
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also break this rule. The whole bit here about nesting could probably use a rewrite.

It's more that we try to avoid doing nesting where & bounces around too much, for example:

.foo {
  & .bar {
    .baz & {  // <-- the selector here is hard to understand at a glance.  It becomes worse when you've got things like `:not` or `is` in the mix.
    }
  }
}

Co-authored-by: Tyler Alsbury <60230011+tyleralsbury@users.noreply.github.com>
@charlespwd
Copy link
Copy Markdown

charlespwd commented Jun 3, 2025

I feel like we should add this to the CLI/theme-liquid-docs so that folks can add it to any theme.

We could also include logic in the CLI/theme-liquid-docs to make this file updatable.

Otherwise this file will grow stale and we'll depend on a human to update it.

Comment on lines +12 to +24
{ name: "item_count_for_variant", usage: "cart | item_count_for_variant: {variant_id}" },
{ name: "line_items_for", usage: "cart | line_items_for: object" },

// html
{ name: "class_list", usage: "settings.layout | class_list" },
{ name: "time_tag", usage: "string | time_tag: string" },
{ name: "inline_asset_content", usage: "asset_name | inline_asset_content" },
{ name: "highlight", usage: "string | highlight: string" },
{ name: "link_to", usage: "string | link_to: string" },
{ name: "placeholder_svg_tag", usage: "string | placeholder_svg_tag" },
{ name: "preload_tag", usage: "string | preload_tag: as: string" },
{ name: "script_tag", usage: "string | script_tag" },
{ name: "stylesheet_tag", usage: "string | stylesheet_tag" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like that is something that we should not have to maintain given that https://github.com/Shopify/theme-liquid-docs/blob/main/data/filters.json exists.

This <liquid_rules> thing should be a derived value of the filters.json file that we get updated automatically from core.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Love this. Let's do it that way instead!

@mxstbr mxstbr closed this Jun 3, 2025
@lukecharle
Copy link
Copy Markdown

@mxstbr Wondering if you have a completed version you can share?

@charlespwd
Copy link
Copy Markdown

@lukecharle https://github.com/Shopify/theme-liquid-docs/blob/main/ai/liquid.mdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants