-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ability to do simple checks on template tag content #131
Comments
Hi @lb- :) I’ve been working on such a Technically what you’re describing is already possible – Curlylint creates an AST from templates with nodes for DTL/Jinja syntax, as well as HTML. The node you’re looking for here is JinjaTag, specifically its The main issue to implementing this is that Curlylint currently provides the raw AST to each and every linting rules – most linters implement the visitor design pattern, which makes implementations much simpler. |
Hmmmm interesting - a JS version - I guess it's just html so doesn't really matter what is used. Now I see why you were not a fan of the make lint rule server / client separation. However, it does add another ecosystem for template linting that some projects may not be keen on adopting. Nonetheless - I might try to understand what you mean by visitor pattern and see what is possible with this library instead |
@lb- it’s definitely possible with this library, visitor pattern or otherwise. The visitor pattern is just one of the most common ways to structure code working on tree structures, ASTs in particular. Here’s an example Python implementation. The consequence of not having it is "just" that every linting rule currently needs to reimplement its own variant of AST parsing :) The main reasons I’m keen on trying out a JS version of curlylint is that:
|
Is your proposal related to a problem?
Describe the solution you’d like
{% ... %}
Describe alternatives you’ve considered
Additional context
The text was updated successfully, but these errors were encountered: