Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error 'expected attribute value' at line 26, column 1 at src/components/Accordion.astro #36

Open
bjgavilanes opened this issue Jan 10, 2025 · 2 comments

Comments

@bjgavilanes
Copy link
Contributor

pnpm check outputs

pnpm check

> [email protected] check /home/bjgavilanes/Documents/ecuador_in_tech/www
> biome check --fix && dprint fmt

Checked 36 files in 22ms. Fixed 1 file.
Error formatting /home/bjgavilanes/Documents/ecuador_in_tech/www/src/components/Accordion.astro. Message: syntax error 'expected attribute value' at line 26, column 13
Had 1 error formatting

This is error is raised during dprint fmt invokation.


It just tested: this may be a bug inside dprint invocation.

I tried to replace biome for typescript and json plugins in dprint.json, and the error does get raised. We need those plugins for the markup_fmt dprint plugin, that I suspect is the culprit. More information, here:

https://github.com/g-plane/markup_fmt


I might do some testing -- for example, removing markup_fmt as plugin and see if the error does get raised -- and report back.

@nsandoya
Copy link
Collaborator

nsandoya commented Jan 10, 2025

[email protected] check /home/bjgavilanes/Documents/ecuador_in_tech/www
biome check --fix && dprint fmt

Checked 36 files in 22ms. Fixed 1 file.
Error formatting /home/bjgavilanes/Documents/ecuador_in_tech/www/src/components/Accordion.astro. Message: syntax error 'expected attribute value' at line 26, column 13
Had 1 error formatting

Hi @bjgavilanes ,

After running pnpm check locally, I found the same error. Upon try out some tweaks based on Biome error message, I found bug is caused by a syntax issue related to Alpine.js directives:
When using dynamic expressions in directives like x-on (shortened as @) and x-bind (shortened as :), these expressions need to be enclosed in curly braces for Alpine.js to interpret them correctly. Here's an example:

<!-- Wrong  -->
@click=`toggle(${id})`
:class=`isVisible(${id}) && 'text-blue-500'`
<!-- Fixed -->
@click={`toggle(${id})`}
:class={`isVisible(${id}) && 'text-blue-500'`}

After trying this solution in whole Accordion.astro code, fixing one css conflict related to this change, and testing again, the pnpm check command ran without any issues.

Hope this info helps to resolve the problem. Sorry for this unexpected bug :(

P.S.: Since this solution involves modifying Alpine.js directives in Accordion.astro, and there's another PR related to this issue (and other topics), what should we do next?

@bjgavilanes
Copy link
Contributor Author

bjgavilanes commented Jan 11, 2025 via email

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

No branches or pull requests

2 participants