djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
686 stars 84 forks source link

[BUG] [Linter] False positiv ophan tag for option in datalist #822

Closed henhuy closed 6 months ago

henhuy commented 7 months ago

System Info

Issue

Actually linter and formatter are not detecting my template correctly. First formatter tries to "fix" template, afterwards I'm getting following error: H025 6:36 Tag seems to be an orphan. <option value="{{ ab Maybe it cannot handle datalist ?

How To Reproduce

I use following template:

<datalist id="abbreviations">
  {% for abb in abbreviation_list %}<option value="{{ abb }}">{% endfor %}
</datalist>

Contents of .djlintrc/pyproject.toml [tool.djlint]

blank_line_after_tag = "load,extends"
close_void_tags = true
format_css = true
format_js = true
# TODO: remove T002 when fixed https://github.com/Riverside-Healthcare/djLint/issues/687
ignore = "H006,H030,H031,T002"
include = "H017,H035"
indent = 2
max_line_length = 119
profile = "django"
henhuy commented 6 months ago

I don't know why I did not see this before. Closing tag for option </option> is missing. Sorry for making this up. Will close