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

[BUG] [Linter] H037 false positive with AlpineJS #639

Closed
danjac opened this issue May 11, 2023 · 4 comments
Closed

[BUG] [Linter] H037 false positive with AlpineJS #639

danjac opened this issue May 11, 2023 · 4 comments
Labels
🔍 linter 🦠 bug Something isn't working released

Comments

@danjac
Copy link

danjac commented May 11, 2023

System Info

  • OS: Fedora Linux 38
  • Python Version: 3.11
  • djLint Version: 1.27.1
  • template language: Django

Issue

I have a number of templates using attributes in addition to equivalent AlpineJS bindings. For example:

<img src="img.jpg" :src="isLoaded ? url : defaultValue" />

This is being flagged e.g. H037 10:8 Duplicate attribute found. src

Using the full Alpine namespace e.g . x-bind:src results in the same error.

This was not an issue with djLint 1.26.

I could add H037 to the ignore list, but I would prefer that djlint flags duplicate issues when they are genuine duplicates.

How To Reproduce

See above

Contents of .djlintrc/pyproject.toml [tool.djlint]

[tool.djlint]
ignore = "H030,H031,H017,H021"
@danjac danjac added 🔍 linter 🦠 bug Something isn't working labels May 11, 2023
@welcome
Copy link

welcome bot commented May 11, 2023

Thanks for opening your first issue here!

@danjac danjac changed the title [BUG] [Linter] HO37 false positive with AlpineJS [BUG] [Linter] H037 false positive with AlpineJS May 11, 2023
@khink
Copy link

khink commented May 11, 2023

+1 on this report. We get a false positive for <tbody class="bg-white" x-data="{ open{{ item.history_id }}: false }" x-bind:class="open{{ item.history_id }} ? 'bg-gray-50' : ''">

@christopherpickering
Copy link
Contributor

Thanks, will get this fixed.

christopherpickering pushed a commit that referenced this issue May 11, 2023
## [1.27.2](v1.27.1...v1.27.2) (2023-05-11)

### Bug Fixes

* **formatter:** fixed an edge case wild regex grab ([0d57e75](0d57e75)), closes [#640](#640)
* **formatter:** fixed formatting of plural tag in blocktrans ([92c083b](92c083b)), closes [#641](#641)
* **formatter:** fixed js/css being formatted even inside ignored blocks ([cbf5796](cbf5796)), closes [#613](#613)
* **linter:** fixed a few false positives/missing positives, added tests ([30f8d31](30f8d31)), closes [#643](#643) [#642](#642)
* **linter:** fixed false postive in alpinejs tags for H037 ([6520f63](6520f63)), closes [#639](#639)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.27.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 linter 🦠 bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

3 participants