diff --git a/docs/djlint/changelog.rst b/docs/djlint/changelog.rst index c0ba0b1..67d0fde 100644 --- a/docs/djlint/changelog.rst +++ b/docs/djlint/changelog.rst @@ -1,6 +1,10 @@ Changelog ========= +Next Release +------------ +- Added rule H020 to find empty tag pairs + 0.5.3 ----- - Change stdout for ``--reformat/check`` options to only print new html when using stdin as the input diff --git a/docs/djlint/rules.rst b/docs/djlint/rules.rst index 698f7f7..7643f4e 100644 --- a/docs/djlint/rules.rst +++ b/docs/djlint/rules.rst @@ -49,6 +49,8 @@ Codes +--------+-------------------------------------------------------------------------+ | H019 | Replace 'javascript:abc()' with on_ event and real url. | +--------+-------------------------------------------------------------------------+ +| H020 | Empty tag pair found. Consider removing. | ++--------+-------------------------------------------------------------------------+ Adding Rules ------------ diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index dabcaf5..569c44d 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -269,3 +269,9 @@ patterns: - <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url)=[\"|']javascript:[\w|/]+ - ]*?(?:action)=[\"|']javascript:[\w|/]+ +- rule: + name: H020 + message: Empty tag pair found. Consider removing. + flags: re.DOTALL|re.I + patterns: + - <(\w+)\s*?>\s*?<\/\1>