Add linting support for all formats supported by djlint (#4920)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions

* Refactor djlint linter code

This patch moves the code to the `autoload` directory, so it's available
when it's needed by a specific linter. This avoids redundant code when
another format supported by djlint is added.

* Add linting support for all formats supported by djlint

So far, the `djlint` linter in ALE only supported `html`, which is only
one of several file types supported by `djlint`.

This patch adds support for the following file types:

* gohtmltmpl
* handlebars
* htmlangular
* htmldjango
* jinja
* nunjucks

* Add djlint fixer for various HTML template formats

* Supported formats:
    - html
    - htmlangular
    - htmldjango
    - jinja
    - handlebars
    - nunjucks
    - gohtmltmpl

* Add doc entries

* Add vader tests

---------

Co-authored-by: Adrian Vollmer <computerfluesterer@protonmail.com>
This commit is contained in:
Adrian Vollmer
2025-03-17 23:56:32 +01:00
committed by GitHub
parent fe6a91fb92
commit 47f1f49655
23 changed files with 448 additions and 38 deletions

11
doc/ale-gohtmltmpl.txt Normal file
View File

@@ -0,0 +1,11 @@
===============================================================================
ALE Go HTML Template Integration *ale-gohtmltmpl-options*
===============================================================================
djlint *ale-gohtmltmpl-djlint*
See |ale-html-djlint|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -2,6 +2,13 @@
ALE Handlebars Integration *ale-handlebars-options*
===============================================================================
djlint *ale-handlebars-djlint*
See |ale-html-djlint|
===============================================================================
===============================================================================
prettier *ale-handlebars-prettier*

View File

@@ -36,6 +36,9 @@ See |ale-cspell-options|
===============================================================================
djlint *ale-html-djlint*
`djlint` options for HTML are the same as the options for htmlangular,
htmldjango, jinja, handlebars, nunjucks and gotmplhtml.
g:ale_html_djlint_executable *g:ale_html_djlint_executable*
*b:ale_html_djlint_executable*
Type: |String|

12
doc/ale-htmlangular.txt Normal file
View File

@@ -0,0 +1,12 @@
===============================================================================
ALE HTML Angular Template Integration *ale-htmlangular-options*
===============================================================================
djlint *ale-htmlangular-djlint*
See |ale-html-djlint|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

12
doc/ale-htmldjango.txt Normal file
View File

@@ -0,0 +1,12 @@
===============================================================================
ALE HTML Django Template Integration *ale-htmldjango-options*
===============================================================================
djlint *ale-htmldjango-djlint*
See |ale-html-djlint|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

12
doc/ale-jinja.txt Normal file
View File

@@ -0,0 +1,12 @@
===============================================================================
ALE Jinja Integration *ale-jinja-options*
===============================================================================
djlint *ale-jinja-djlint*
See |ale-html-djlint|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

12
doc/ale-nunjucks.txt Normal file
View File

@@ -0,0 +1,12 @@
===============================================================================
ALE Nunjucks Integration *ale-nunjucks-options*
===============================================================================
djlint *ale-nunjucks-djlint*
See |ale-html-djlint|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -234,6 +234,8 @@ Notes:
* `gotype`!!
* `revive`!!
* `staticcheck`!!
* Go HTML Templates
* djlint
* GraphQL
* `eslint`
* `gqlint`
@@ -247,6 +249,7 @@ Notes:
* Haml
* `haml-lint`
* Handlebars
* djlint
* `ember-template-lint`
* Haskell
* `brittany`
@@ -284,6 +287,10 @@ Notes:
* `rustywind`
* `tidy`
* `write-good`
* HTML Angular
* djlint
* HTML Django
* djlint
* Hurl
* `hurlfmt`
* Idris
@@ -321,6 +328,8 @@ Notes:
* `standard`
* `tsserver`
* `xo`
* Jinja
* djlint
* JSON
* `VSCode JSON language server`
* `biome`
@@ -421,6 +430,8 @@ Notes:
* `alex`
* `proselint`
* `write-good`
* Nunjucks
* djlint
* Objective-C
* `ccls`
* `clang`

View File

@@ -3067,6 +3067,8 @@ documented in additional help files.
govet.................................|ale-go-govet|
revive................................|ale-go-revive|
staticcheck...........................|ale-go-staticcheck|
go html template........................|ale-gohtmltmpl-options|
djlint................................|ale-gohtmltmpl-djlint|
graphql.................................|ale-graphql-options|
eslint................................|ale-graphql-eslint|
gqlint................................|ale-graphql-gqlint|
@@ -3078,6 +3080,7 @@ documented in additional help files.
hackfmt...............................|ale-hack-hackfmt|
hhast.................................|ale-hack-hhast|
handlebars..............................|ale-handlebars-options|
djlint................................|ale-handlebars-djlint|
prettier..............................|ale-handlebars-prettier|
ember-template-lint...................|ale-handlebars-embertemplatelint|
haskell.................................|ale-haskell-options|
@@ -3116,6 +3119,10 @@ documented in additional help files.
tidy..................................|ale-html-tidy|
vscodehtml............................|ale-html-vscode|
write-good............................|ale-html-write-good|
html angular template...................|ale-htmlangular-options|
djlint................................|ale-htmlangular-djlint|
html django template....................|ale-htmldjango-options|
djlint................................|ale-htmldjango-djlint|
hurl....................................|ale-hurl-options|
hurlfmt...............................|ale-hurl-hurlfmt|
idris...................................|ale-idris-options|
@@ -3153,6 +3160,8 @@ documented in additional help files.
prettier-standard.....................|ale-javascript-prettier-standard|
standard..............................|ale-javascript-standard|
xo....................................|ale-javascript-xo|
jinja...................................|ale-jinja-options|
djlint................................|ale-jinja-djlint|
json....................................|ale-json-options|
biome.................................|ale-json-biome|
clang-format..........................|ale-json-clangformat|
@@ -3231,6 +3240,8 @@ documented in additional help files.
deadnix...............................|ale-nix-deadnix|
nroff...................................|ale-nroff-options|
write-good............................|ale-nroff-write-good|
nunjucks................................|ale-nunjucks-options|
djlint................................|ale-nunjucks-djlint|
objc....................................|ale-objc-options|
ccls..................................|ale-objc-ccls|
clang.................................|ale-objc-clang|