djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

[Proposal] Add a linter for Django templates

Open sarahboyce opened this issue 3 weeks ago • 8 comments

I was looking at a PR and wanted to suggest that {{example}} should be {{ example }}

Perhaps a linter, such djade, can be used to prevent the need for these suggestions 😊

sarahboyce avatar Dec 05 '25 18:12 sarahboyce

Hi @sarahboyce, I would like to work on this issue. I can add djade to the project's configuration to automate these template formatting checks (like {{ example }}) and prevent future style inconsistencies. Could you please assign this to me?

aNsHuL5217 avatar Dec 06 '25 13:12 aNsHuL5217

Great idea.

I've used djLint before.

https://github.com/djlint/djLint

marksweb avatar Dec 06 '25 21:12 marksweb

I'm not opposed.

adamzap avatar Dec 06 '25 23:12 adamzap

Thanks for the suggestion @marksweb!

@sarahboyce @adamzap — Do you guys have a preference here? I’m happy to pick this up using djade (as originally proposed), or I can look into djLint if you think that's better.

Just let me know which direction you want to go so I can get started on the PR!

aNsHuL5217 avatar Dec 07 '25 04:12 aNsHuL5217

@aNsHuL5217 this project is managed by the website working group. Before something like this can be merged, we would need the team to agree it should be done šŸ‘ You're welcome to make a draft PR but be aware that this proposal may not be accepted. As this is a volunteer run project, it may take a month or so before there is clear agreement this should be implemented

sarahboyce avatar Dec 07 '25 10:12 sarahboyce

I think this is a good idea. I think I personally would prefer djade over djLint since the djLint readme says Maintainers needed, please reach out on discord or email! currently. @aNsHuL5217 if you would like to open a PR, that would be great! We can discuss it more while reviewing the PR, but as Sarah said, given this is a volunteer run project, it can take some time to get merged / agreed upon the correct way to do this while reviewing the PR.

SaptakS avatar Dec 08 '25 06:12 SaptakS

Thanks @SaptakS, that makes perfect sense regarding djLint's maintenance status. I'll stick with djade as planned and open a PR shortly!

aNsHuL5217 avatar Dec 08 '25 17:12 aNsHuL5217

Hi @SaptakS, thanks for the guidance!

I have opened a Draft PR here

It implements djade (v1.6.0) and formats the existing templates as discussed. I'll wait for the Working Group's review.

aNsHuL5217 avatar Dec 08 '25 17:12 aNsHuL5217

We already have the PR (thanks @aNsHuL5217 ) but I wanted to express my support. Linters all the way šŸ”” šŸŽ„ (šŸ™Š)

ulgens avatar Dec 20 '25 10:12 ulgens