Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]Is it possible to add a function to fix H017 automatically? #252

Closed
2 tasks done
Taikono-Himazin opened this issue May 27, 2022 · 7 comments
Closed
2 tasks done
Labels

Comments

@Taikono-Himazin
Copy link

Taikono-Himazin commented May 27, 2022

Feature Request

Djlint outputs H017 for the following code.
Tag should be self closing. (H017)

<img src="{% static 'img/item02.png' %}">

I want this to be automatically corrected as follows.

<img src="{% static 'img/item02.png' %}" />

H017 happens frequently and I think it's okay to fix it automatically.
Will djlint provide the ability to fix this automatically?

@christopherpickering
Copy link
Contributor

Its definitely a nice idea.. fix linter errors vs reformatting the entire file 👍🏽

@andrewtavis
Copy link

Hi @christopherpickering :)

Wanted to bring mdn/content#17138 to your attention in relation to this feature request. The original PR was based on H017 from djlint, with the consensus being that this is an XHTML convention that is incorrectly being applied to HTML5.

Result was this pattern being removed from the remaining instances in the Mozilla Developer Network learning area in mdn/django-locallibrary-tutorial#106 and mdn/content#17149.

@christopherpickering
Copy link
Contributor

Thanks for pointing that out. I agree its not needed, It's a matter of personal preference in the end. Thanks!

@christopherpickering
Copy link
Contributor

Also see #372

@christopherpickering
Copy link
Contributor

Sorry for the delay, this should be in the next release.

christopherpickering pushed a commit that referenced this issue May 8, 2023
# [1.26.0](v1.25.1...v1.26.0) (2023-05-08)

### Bug Fixes

* **blocktrans:** fixes whitespace issues on blocktrans, allows indenting on blocktrans trimmed ([249c8e8](249c8e8)), closes [#623](#623)

### Features

* **formatter:** added white space cleanup for template tags ([13d0d4f](13d0d4f)), closes [#485](#485)
* **linter:** added rule H037 ([6048c46](6048c46))
* **void tags:** added option to auto close void tags (linter rule H017) ([9050d30](9050d30)), closes [#252](#252)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.26.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Taikono-Himazin
Copy link
Author

thank you!
I haven't tried it yet, but I'm sure it will be very easy to use.
I hope djlint keeps getting better and better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants