diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index f618a78..f625008 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -136,7 +136,7 @@ flags: re.DOTALL|re.I patterns: - <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:|data:)[\w|/]+ - - ]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+ + - ]*?(?:\saction)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+ - rule: name: J018 message: (Jinja) Internal links should use the {{ url_for() ... }} pattern. diff --git a/tests/test_linter/test_linter.py b/tests/test_linter/test_linter.py index 9505691..7901ef7 100644 --- a/tests/test_linter/test_linter.py +++ b/tests/test_linter/test_linter.py @@ -451,6 +451,15 @@ def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None: result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"]) assert result.exit_code == 0 + # test data-actions + write_to_file( + tmp_file.name, + b"""
""", + ) + + result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"]) + assert "D018" not in result.output + def test_H019(runner: CliRunner, tmp_file: TextIO) -> None: write_to_file(tmp_file.name, b"asdf")