Skip to content

Commit

Permalink
feat(linter): updated rule 18 to allow "tel:"
Browse files Browse the repository at this point in the history
closes #334
  • Loading branch information
christopherpickering committed Aug 17, 2022
1 parent 919d034 commit f08e3ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/djlint/rules.yaml
Expand Up @@ -134,15 +134,15 @@
message: (Django) Internal links should use the {% url ... %} pattern.
flags: re.DOTALL|re.I
patterns:
- <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:)[\w|/]+
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:)[\w|/]+
- <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
- rule:
name: J018
message: (Jinja) Internal links should use the {{ url_for() ... }} pattern.
flags: re.DOTALL|re.I
patterns:
- <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:)[\w|/]+
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:)[\w|/]+
- <(?:a|div|span|input)\b[^>]*?\s(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:|mailto:|tel:)[\w|/]+
- rule:
name: H019
message: Replace 'javascript:abc()' with on_ event and real url.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linter/test_linter.py
Expand Up @@ -299,7 +299,7 @@ def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None:
# test mailto:
write_to_file(
tmp_file.name,
b'<a href="mailto:joe"></a>',
b'<a href="mailto:joe"></a><a href="tel:joe"></a>',
)
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 0
Expand Down

0 comments on commit f08e3ac

Please sign in to comment.