Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

TypeError: Cannot read properties of undefined (reading 'startsWith') #134

Closed
albchu opened this issue Dec 6, 2022 · 1 comment · Fixed by #135
Closed

TypeError: Cannot read properties of undefined (reading 'startsWith') #134

albchu opened this issue Dec 6, 2022 · 1 comment · Fixed by #135
Labels
bug Something isn't working

Comments

@albchu
Copy link
Contributor

albchu commented Dec 6, 2022

Describe the bug
Discovered a bit of a funky edge case when reviewing bug reports. The current playground is still on 0.4.0 and shows a different error than 1.0.0RC1. I bumped the version of the playground here if you wish to compare the error messages #133

Unformatted source

 <div class="bundle-product"
                  data-variantId="{{ variant_id }}"
                  {% for i in (1..3) %}
                      {% assign plan_id = i | minus: 1 %}
                      data-sellingId-{{i}}="{{ product.selling_plan_groups[0].selling_plans[plan_id].id }}"
                  {% endfor %}
              ></div>

Expected output
This current error isnt a prettier syntax error so the theme code editor can't show loc details with it. A standard syntax error would give more meaningful details to the user. The 0.4.0 playground was showing a different error which seems more detailed to my untrained eye. Not sure which one is more correct though.

Actual output

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at isBlockLikeCssDisplay (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2755:20)
    at isOuterRightWhitespaceSensitiveCssDisplay (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2767:13)
    at isLeadingWhitespaceSensitiveNode (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2578:10)
    at augmentWithWhitespaceHelpers (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2523:39)
    at walk (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2183:5)
    at https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2177:36
    at Array.forEach (<anonymous>)
    at walk (https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2177:18)
    at https://www.unpkg.com/@shopify/prettier-plugin-liquid@v1.0.0-rc.1/standalone.js:2177:36
    at Array.forEach (<anonymous>)
@albchu albchu added the bug Something isn't working label Dec 6, 2022
charlespwd added a commit that referenced this issue Dec 6, 2022
e.g. `<h{{ header_number }}>` or `<{{ type }}-header>`

And, at the same time, fixes the error in compound attribute names where
the previous node was a string and not a node.

Fixes #128
Fixes #134
@zub0r
Copy link

zub0r commented Jun 3, 2024

Still an issue. The file that errors out

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants