Open julien-lmnr opened 3 days ago
Hi @julien-lmnr Thanks for reporting the issue. It would be nice to support linting for this twig as well, since it is used with many different template engines, rather than just HTML as is. However, I don't think it's a good idea to have special treatment only in sort-attrs. Perhaps it would be nice to allow es-html-parser to handle template engine syntax. This will take some time to develop, but it would be great to see it developed, thank you.
Hi 👋,
I've encountered an issue with the
sort-attrs
rule when working with Twig files. The rule works correctly for standard HTML attributes, such as:However, it fails when there is Twig-specific syntax within the attributes. For example, with the following code:
This should be considered valid, but it is not. When I run
eslint
with the--fix
option, it produces incorrect output:The Twig directive is broken, and the output is no longer valid.
Expected Behavior:
The
sort-attrs
rule should correctly handle attributes that contain Twig-specific syntax and maintain their structure when sorting.Actual Behavior:
The rule fails to validate attributes with Twig directives and produces invalid code when using the
--fix
option.Steps to Reproduce:
eslint
with the--fix
option using thesort-attrs
rule enabled:Suggestion:
Would it be possible to enhance the
sort-attrs
rule to correctly handle attributes that include Twig directives or custom syntax? Perhaps the rule could recognize such syntax and exclude it from sorting operations or process it as a single unit.Thank you for your work on this project, and let me know if I can provide more information!