thibaudcolas / curlylint

Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid
https://www.curlylint.org/
MIT License
239 stars 25 forks source link

Make use of forward_declaration from Parsy 1.4 for cleanup #142

Open spookylukey opened 2 years ago

spookylukey commented 2 years ago

I'm the maintainer of Parsy (although not the original author) and I came across curlylint - I think it is one of the most advanced uses of Parsy I've found! Anyway, I happened to see this bit of code that can be cleaned up a bit with a feature from 1.4 - https://parsy.readthedocs.io/en/latest/ref/primitives.html#parsy.forward_declaration

This PR also loosens the dependency from == to >=, which might more friendly for users in some situations, although I can also see you might want to pin it for your use case. FWIW, as the maintainer I'm very conservative with breaking changes for this library. In version 2.0 I dropped support for Python < 3.6, other than that it's very rare I break anything deliberately.

Also, if you wanted, I could include testing against curlylint's test suite for regression testing, as part of Parsy's own test suite - it might help both projects.

There's a linting failure, but it's happening on main as well.