Skip to content

support any valid html attributes so that things like AlpineJS work #37

@hanoii

Description

@hanoii

I saw that you are adding the melody-parser into the module, I hope this is now easier to fix.

Things like (coming from https://alpinejs.dev/):

<button @click="toggle()" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-aida-blue-logo" aria-expanded="false">

Gives:

[error] Expected a valid attribute name, but instead found "@", which is not part of a valid attribute name.
[error]     at TokenStream.error (/var/www/html/web/themes/custom/aida_theme/node_modules/melody-parser/lib/index.js:1362:22)
[error]     at new TokenStream (/var/www/html/web/themes/custom/aida_theme/node_modules/melody-parser/lib/index.js:1301:18)
[error]     at createConfiguredParser (file:///var/www/html/web/themes/custom/aida_theme/node_modules/@zackad/prettier-plugin-twig/src/parser.js:46:9)
[error]     at Object.parse (file:///var/www/html/web/themes/custom/aida_theme/node_modules/@zackad/prettier-plugin-twig/src/parser.js:76:20)
[error]     at parse4 (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/index.mjs:20685:24)
[error]     at async coreFormat (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/index.mjs:21146:7)
[error]     at async formatWithCursor (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/index.mjs:21348:14)
[error]     at async formatFiles (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/internal/cli.mjs:3468:18)
[error]     at async main (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/internal/cli.mjs:3876:5)
[error]     at async Module.run (file:///var/www/html/web/themes/custom/aida_theme/node_modules/prettier/internal/cli.mjs:3822:5)

And other things breaks into different things too:

  • :class
  • x-on:click="scrollTo($event)"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions