HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
Find a file
Christopher Pickering eef8fdb63b
added tests
2021-07-13 10:45:57 -05:00
.github/workflows added tests 2021-07-13 10:45:57 -05:00
src/djlint added tests 2021-07-13 10:45:57 -05:00
tests added tests 2021-07-13 10:45:57 -05:00
.coveragerc added tests 2021-07-13 10:45:57 -05:00
.gitignore added tests 2021-07-13 10:45:57 -05:00
.pre-commit-config.yaml initial commit 2021-07-12 13:26:46 -05:00
CHANGELOG.md added more rules. 2021-07-12 17:07:52 -05:00
LICENSE initial commit 2021-07-12 13:26:46 -05:00
MANIFEST.in updated rev. added manifest. 2021-07-12 14:23:20 -05:00
pyproject.toml initial commit 2021-07-12 13:26:46 -05:00
README.md added more rules. 2021-07-12 17:07:52 -05:00
setup.py added tests 2021-07-13 10:45:57 -05:00
tox.ini added tests 2021-07-13 10:45:57 -05:00

djlint

Simple Django template linter.

Install

pip install djlint

Usage

djlint <file or path>

Optional args

Arg Definition Default
-e, --extension File extension to lint. default=html

Rules

Error Codes

Code Meaning
E001 Variables should be wrapped in a single whitespace. Ex: {{ this }}
E002 Double quotes should be used in tags. Ex {% extends "this.html" %}

Warning Codes

Code Meaning
W003 Endblock should have name. Ex: {% endblock body %}.
W004 Status urls should follow {% static path/to/file %} pattern.
W005 Html tag should have lang attribute.
W006 Img tag should have alt, height and width attributes.
W007 <!DOCTYPE ... > should be present before the html tag.
W008 Attributes should be double quoted.
W009 Tag names should be lowercase.
W010 Attribute names should be lowercase.
W011 Attirbute values should be quoted.
W012 There should be no spaces around attribute =.
W013 Line is longer than 99 chars.
W014 More than 2 blank lines.
W015 Follow h tags with a blank line.
W016 Missging title tag in html.