chore(deps): update pre-commit hook djlint/djlint to v1.43.0 - #4081
Open
renovate[bot] wants to merge 2 commits into
Open
chore(deps): update pre-commit hook djlint/djlint to v1.43.0#4081renovate[bot] wants to merge 2 commits into
renovate[bot] wants to merge 2 commits into
Conversation
for more information, see https://pre-commit.ci
Contributor
Author
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4081 +/- ##
=======================================
Coverage 90.09% 90.09%
=======================================
Files 72 72
Lines 12804 12804
Branches 1060 1060
=======================================
Hits 11536 11536
Misses 919 919
Partials 349 349 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.40.8→v1.43.0Note: The
pre-commitmanager in Renovate is not supported by thepre-commitmaintainers or community. Please do not report any problems there, instead create a Discussion in the Renovate repository if you have any questions.Release Notes
djlint/djLint (djlint/djLint)
v1.43.0Compare Source
Feature
--stdin-filenameoption gives content piped in on stdin (djlint -) its real path, soper-file-ignoresmatches against that name and linter messages report it. Per-file ignores were previously dead for piped input, since nothing matches the name-. Path separators are normalized as they are for files on disk.Fix
title="{% translate "You don't have permission" %}") no longer swallows the rest of the document, which madeH025report every enclosing element as an orphan. A template tag in a value is now skipped whole unless it holds a>, so a quoted literal likea="{{"is still left alone.</span>tail<textarea>y</textarea>) unindents again; everything after it stayed one level too deep.{% endif %} <td class="x">y</td>) indents as a block tag again, so{% endif %}unindents and{% else %}aligns with its{% if %}. A line only takes that shape once the tag fits on one line, so reformatting an already formatted file moved it.</pre> <span>x) is tracked again; its closing tag took a level from a tag opened before the block, dedenting that tag's siblings.<div>{% if x %}), and the choice is no longer applied to the wrong block. Blocks were paired with the source by position, which does not line up with the expanded html; they are now matched by tag and contents.style,srcset,data-srcsetorsizesvalue was written over several lines is no longer spread over multiple lines and pulled back together on the next run.max_attribute_lengthis now measured against what is written out, not against padding that the rewrite drops.<pre>or<textarea>opened on a line that also holds a self-contained comment (<pre>x<!--c-->) is recognized as opening a verbatim block again. Its contents were re-indented instead of left alone, and the closing</pre>gained an indent level on every run - unbounded whitespace growth inside preformatted text.text <b>bold/</b> tail). The loss accumulated, so a document repeating that shape drifted further left with each occurrence. A closing tag with nothing to pair against still dedents as before.<inside a one-line<script>,<style>,<textarea>or<title>no longer counts as a tag when indenting.<script>var a = '<span>'</script>left a phantom open<span>on the tag stack, leaving everything after it one level too deep.text <b>bold/more</b> tailinside a<p>) - a regression in 1.40.8. The wrong output was idempotent, so it survived later runs.{{/* ... */}}is no longer read as a block close tag. It starts with{{/, the handlebars block-close prefix, so it popped a block off the stack:H037reportedDuplicate attribute found.for mutually exclusive attributes such as<a {{if .A}}href="a"{{else}}{{/* c */}}href="b"{{end}}>, and the formatter unindented the rest of the block. A comment renders as nothing, soH037no longer treats one as a template-generated attribute name prefix either.{% if x %}{# comment #}- was skipped by the linter, most visibly makingT038reportEnd tag has no matching block tagfor a balanced{% if %}. Affects every rule that skips ignored blocks (H025,H037,H041,H042,T002,T003,T027,T038,T039) and every kind of ignored block.djlint:offpragma no longer ignores the tag written immediately before it.<img>{# djlint:off #}silently dropped every error on that<img>, while<img>{# djlint:off H013 #}correctly reported it - a pragma covers what follows it, not what precedes it.v1.42.3Compare Source
Fix
-,.,:,@and*no longer stop a tag from being wrapped over multiple lines. The attribute parser now accepts any character HTML allows in an attribute name, so Alpine key modifiers (@keydown.prevent.?), Angular bindings ((click),[disabled]) and Vue shorthands (#slot) are formatted like every other attribute instead of leaving the whole tag on one long line. Angular bindings also reach--format-attribute-js-jsonfor the first time, which already listed them.src={{ MEDIA_URL }}/logo.png,href={{ .Permalink }}#{{ .Anchor }}) is no longer split into a truncated value plus a bogus standalone attribute when attributes are wrapped; it stays one value, quoted when spread.v1.42.2Compare Source
Fix
${...}inside a quoted value (e.g. JS template literals like:name="`x[${i}]`") respectmax_attribute_lengthagain and are spread over multiple lines - a regression in 1.40.6. Unquoted Mako-style${...}expressions in tags are still left unformatted.<!--that is not a real HTML comment (for example inside a{# ... #}template comment or inside a<textarea>/<pre>) no longer swallows the rest of the document. This fixes falseH025orphan-tag reports and over-indentation of the tags that follow - a regression in 1.40.6.{{{ ... }}}and raw-block{{{{ ... }}}}expressions used as tag attributes are tokenized correctly again, fixing falseH025orphan-tag reports - a regression in 1.40.6.data-x="{{") no longer makes the tokenizer scan into later content looking for a matching}}, which could collapse<pre>/<textarea>whitespace - a regression in 1.40.6.}}of a handlebars{{#if}}/{{#each}}block-open tag is now idempotent; it no longer leaks a trailing space into the following{{...}}tag on later formatting passes.T038no longer reports block tags that appear only inside a handlebars comment ({{!-- ... --}},{{! ... }}) or inside a handlebars raw block ({{{{raw}}}} ... {{{{/raw}}}}).T039no longer reports handlebars raw-block delimiters ({{{{raw}}}}/{{{{/raw}}}}) as unclosed template tags.<or dangling=) are now left untouched instead of having the unparsable characters silently dropped when attributes are wrapped.<used as a less-than operator inside a template expression in text or<script>content (e.g.${a<b},{{a<b}}) is no longer mistaken for an HTML tag start, which could merge or drop following content and break idempotency - a regression in 1.40.6.:or/(e.g.href=https://example.com/page) are no longer split into a truncated value plus a bogus standalone attribute when attributes are wrapped - a regression in 1.40.6.="value"attribute is no longer rewritten with the literal attribute nameNone; malformed attributes are left untouched.<textarea>/<pre>is preserved instead of being collapsed by whitespace cleanup (it is verbatim content).Performance
{% comment %},{% blocktrans %},{% filter %},<pre>,<script>, etc.) is dramatically faster on templates with many{% ... %}tags. A lazy[ ]*?before the block keywords caused pathological backtracking; the equivalent greedy[ ]*removes it, cutting reformat time on large template-heavy files by roughly 5x.v1.42.1Compare Source
Fix
command,keygenandmenuitem- elements that were removed from the HTML standard.Changed
Linter rule defaults were reviewed against a simple bar: on by default means correctness, security, clear accessibility, or a consistency check the formatter also enforces - with near-zero false positives. Four rules moved to opt-in (
--include=...):{% endblock %}; the name demand is a style preference. The correctness checks T003 used to bundle - unclosed{% block %}, orphan{% endblock %}and mismatched endblock names, all hard template errors - moved into T038, which stays on by default, so nothing real is lost when T003 is off.aspect-ratio, preventing layout shift) but performance rather than correctness, and the dimensions are frequently unknowable in a template - user uploads, CMS urls, art-directed<picture>sources - so the rule demands data the author may not have.--include=H031.{{ ... }}output (form widgets),{% include %}/{% extends %}or unrecognized template tag silences the rule for that file, so where it does run, every report is a genuinely broken label association (a WCAG 1.3.1/4.1.2 failure the W3C validator also treats as an error).v1.42.0Compare Source
Feature
Template languages:
askamaprofile for Askama (jinja-style templates in Rust). Rust expressions are never reformatted: function and{% set %}/{% let %}formatting are disabled sosome_macro!("foo")?, char literals'a'and tuples keep their exact spelling, and string quotes are never rewritten. The Flask-specificurl_forrules (J004/J018) don't apply.teraprofile for Tera (Rust, used by Zola): jinja-style formatting plus Tera v2{% component %}/{% endcomponent %}blocks and single-tag{% set_global %}. The Flask-specificurl_forrules don't apply. MiniJinja needs no profile of its own - it is fully Jinja2-compatible, use--profile=jinja.liquidprofile for Liquid (Shopify themes, Jekyll, Eleventy, the Rustliquidcrate).{% case %}/{% when %},{% capture %},{% tablerow %},{% form %},{% paginate %},{% highlight %}and{% unless %}/{% elsif %}indent correctly,{%- -%}whitespace control is handled, and the bodies of Shopify section tags ({% schema %},{% style %},{% javascript %},{% stylesheet %}) are left untouched - they contain JSON, CSS or JS rather than html.golangprofile now indents template blocks:{{ if }},{{ range }},{{ with }},{{ block }}and{{ define }}indent their contents up to the matching{{ end }}, with{{ else }}/{{ else if }}as branches and the{{- -}}whitespace-control forms included. Blocks opened and closed on one line are left alone; single tags like{{ template }}and lookalike variables such as{{ .end }}are unaffected.New linter rules:
{% extends %}or{% include %}with a missing or empty template name - an error the engine only raises at render time, so the typo is easy to ship.{% block %}and closed in a different one. The pair looks balanced in the file, but a child template overriding either block renders unbalanced html.--include=H018): void tags closed with/>instead of>, e.g.<br/>- the trailing slash has no effect in HTML. The opposite convention of the optional H017 ("void tags should be self closing"); enable one or the other, not both.--include=H042): a<label for="...">whose value matches no elementidin the same file. Template-generated values are skipped; the rule is opt-in because inputs rendered by e.g.{{ form.email }}carry ids the linter cannot see.Configuration:
indentandmax_line_lengthnow fall back toindent_sizeandmax_line_lengthfrom a.editorconfigat the project root. The command line and djlint config files still take precedence, and only sections applying to html (or the configuredextension) are read.Documentation:
Fix
<cola>(matched by a brokencolgroupexclusion) and custom elements like<img-icon>are no longer reported.<meta>tags, missing from the rule's void tag list, are now reported.v1.41.0Compare Source
Feature
{% if %}without{% endif %}, handlebars{{#if}}without{{/if}}, end tags with no opening tag, and crossed blocks like{% if %}{% for %}{% endif %}. Tags fromcustom_blocksare checked too;{% block %}/{% endblock %}pairs stay covered by T003.{% url 'x" user.url }}(closed by}}instead of%}),{{ user.name }(missing a brace), or a tag cut off by the next tag or the end of the file. Complements T027 (unclosed string in a complete tag) and T034 (}%typo), which keep reporting their own cases.--rules FILECLI option: load a custom rules file in.djlint_rules.yamlformat from any path, instead of only next topyproject.toml.Changed
{% if abc == 101 %}becomes{% if abc == 101 %}. This fixes what rule T032 reports, so the linter and formatter no longer conflict. Whitespace inside string literals is preserved, including strings with backslash-escaped quotes; multiline tags, ignored blocks, the literal contents of{% verbatim %}/{% raw %}and the handlebars/golang profiles are untouched.excludelist is now tailored to djLint instead of copying ruff/black. Added directories that hold generated or third-party HTML:htmlcov(coverage.py reports),site-packages(installed packages' templates such as Django admin and DRF, matched in any virtualenv layout) and_site(Jekyll/Eleventy output). Removed Python tool caches and editor config that never contain HTML:.ipynb_checkpoints,.mypy_cache,.pytest_cache,.pytype,.ruff_cache,.pants.d,.vscodeandbuck-out.Fix
Formatter indentation:
<div>rendered by{% if %}...{% endif %}and closed by a later conditional) no longer shift the indentation of everything after it. When every branch of an{% if %}/{% elif %}/{% else %}shifts the depth equally, e.g. a<tr>opened in both branches, the shift is kept after{% endif %}.{% story ... with { ... } %},{% include ... with { ... } %}and non-JSON{{ func(...) }}calls are now indented by bracket depth.{% endtrans %}(Jinja/Twig block{% trans %}) no longer decreases the indentation level, which shifted the{% endtrans %}line and everything after it one level to the left.{% set %}objects nested inside HTML elements are no longer over-indented in proportion to their nesting depth.{% component "calendar" date="2015-06-19" / %}withcustom_blocks = "component") no longer indent the lines that follow them as if a block had been opened.Formatter line breaks and spacing:
{% set x %}...{% endset %}is no longer expanded onto multiple lines. The block captures its content verbatim, so the added whitespace changed the value of the variable. Authored multi-line set blocks are still indented as before.{{ ... }}function calls, a call passed as an argument no longer causes a stray space before the following comma, and the arguments after it keep the same indentation as the other arguments.blank_line_after_tagno longer inserts a blank line when the next line closes a block and decreases the indentation, e.g. between{% endblock %}and</div>.blank_line_before_tagnow inserts the blank line above a comment directly preceding the tag, keeping the comment attached to the tag it documents.Linter:
<slot></slot>: an empty slot element is the standard way to declare a default slot outlet.{% if %}/{% else %}and closed once outside it (and vice versa for close tags), since only one branch renders.<b>in<h1>blah <b>bold</h1>.{% endblock %}is on the same line as its{% block ... %}, e.g.{% block title %}{% endblock %}. The formatter keeps such blocks on one line, so the linter and formatter no longer conflict.{% verbatim %}...{% endverbatim %}blocks, matching the existing treatment of jinja{% raw %}blocks.Configuration:
ignore,include,custom_blocks,custom_html,exclude,extend_exclude,ignore_blocks,blank_line_after_tag,blank_line_before_tag) can now also be given as lists, e.g.ignore = ["H017", "H031"]inpyproject.toml; previously list values were silently ignored.--max-blank-linesgiven on the command line is no longer overridden by the config file, matching all other options.v1.40.10Compare Source
Fix
AttributeError: attribute 'reformat' of 'Config' objects is not writablewhen linting or formatting multiple files, andAttributeError: attribute 'start' of 'TagToken' objects is not writablewhen processing a file.v1.40.9Compare Source
Fix
{% cache %},{% timezone %},{% localtime %}and{% localize %}blocks instead of dedenting everything after them.<c-card>and<c-forms.input />as block HTML tags without requiringcustom_htmlconfiguration.<b>bold</b><span> </span><i>italic</i>keep rendering a space; non-collapsible whitespace such as U+2005 is kept verbatim._attribute values, where a newline separates commands and--comments run to the end of the line.classandstylevalues are spread over multiple lines withformat_attribute_template_tags.{% comment %}block content untouched when reformatting, e.g. bare URLs ending in/>.djlint:off RULEsuppression to any finding overlapping the region, so reformatted guards keep linting clean.{% if x %}data-{% endif %}srcset.Configuration
📅 Schedule: (UTC)
* * * * 6)🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.